Repository navigation
fix(android): bound helper output and verify installed bytes - #5339
Conversation
|
Fixed the clipped-prefix assertion blocker in Regression proof on source head At exact head pnpm exec vitest run --project unit-core packages/command-runtime/src/commands/interaction/runtime/selector-is.test.ts packages/daemon/src/execution/__tests__/selector-text-runtime.test.ts packages/platform-android/src/__tests__/text-input-fill.test.tsThe shared contracts admission now rejects incomplete assertion evidence with existing typed reason No local broad gates, device runs, remote transport tests or CI waits. Cold self-review completed; independent review and broad CI remain pending. #5245 untouched. |
Size Report
Startup median (7 runs, lower is better):
Affected plugins
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on d9abb91. The verdict and the full list are in the summary comment.
- 🟡 Minor · get attrs on a clipped Android node now fails instead of returning attributes ·
packages/daemon/src/execution/selector-text-runtime.ts:74
This comment has been minimized.
This comment has been minimized.
|
At 8546af3 the code review found one problem that must be fixed before merge: the device-facing changes have no live run. All 18 checks are green at this head, and no conflicts are known. The helper XML budget and clip marker, the snapshot and touch admission that now pulls and hashes the installed APK, and the newer-version refusal have no live run at this head (https://github.com/callstack/agent-device/blob/8546af3/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java#L32). The PR body says no device work ran, and the #5245 emulator evidence belongs to a different commit and a different admission design. So the helper Java and the adb pull of base.apk per command are only proven against fakes. Please run this on an Android emulator at this head: (1) with a TextView or EditText over 393,216 chars, Not blocking, and these can be taken or left: warm admission now runs Could the verified base APK path be memoized per device, since the install directory is unique per install on API 26+, so warm admission runs only The inline thread at #5339 (comment) does not apply and can be resolved: the get-attrs refusal does not occur because selector-read.ts returns attrs before readText, and a regression test was added. Not verified here: tests or a device (Java unit tests and TS suites are trusted from green CI), helper APK size and remote-transport pull latency, the kernel-error scope 601->600 claim, and host handling of an omitted class attribute now that Java omits an empty class instead of emitting class="". The live emulator run above is required before merge. After it, the per-command APK pull cost needs a decision. |
8546af3 to
bfb8eb5
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 8 new findings on bfb8eb5. The verdict and the full list are in the summary comment.
- 🟡 Minor · maxBuffer passed to the adb executor is not part of its options type, so the output cap is a no-op ·
packages/platform-android/src/snapshot-helper-capture.ts:108 - 🟡 Minor · Warm install memo trusts
pm pathequality as proof of APK bytes ·packages/platform-android/src/snapshot-helper-install.ts:90 - 🟡 Minor · Clipped fill verification reports text_mismatch with a truncated actual, hiding the real cause ·
packages/platform-android/src/fill-verification.ts:346 - 🟡 Minor · Clipped-text refusal preempts masked-field verification and leaks the prefix as
actual·packages/platform-android/src/fill-verification.ts:346 - 🟡 Minor · Post-install return no longer caches, so the first capture after an install re-pulls and re-hashes the APK ·
packages/platform-android/src/helper-package-install.ts:120 - 🟡 Minor · 32 MiB one-shot cap is an executor option no production code reads here ·
packages/platform-android/src/snapshot-helper-capture.ts:108 - 🟡 Minor · Memoized 'current' decision trusts pm path alone, so a re-pushed same-path APK passes ·
packages/platform-android/src/snapshot-helper-install.ts:90 - 🟡 Minor · Installed-helper fake-adb fixture is hand-copied into three new helpers that will drift ·
test/integration/provider-scenarios/composite-deadline.test.ts:27
|
Commit bfb8eb5 still has a gap in live evidence, and CI is red. The earlier findings at 8546af3 (#5339 (comment)) are only partly closed. The CI failures look related to this PR. Lint, Typecheck & Package, Numeric Ranges and Integration Tests fail on TS2353 at packages/platform-android/src/snapshot-helper-capture.ts:111, because The open blocker from 8546af3 is not closed: https://github.com/callstack/agent-device/blob/bfb8eb5/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java#L219. The helper text clip, the The open inline threads still stand: #5339 (comment) (maxBuffer type error). Five lower-priority threads still apply. Two threads do not apply, so please resolve them: #5339 (comment) (replacing base.apk in place needs root outside the package manager, and every package-manager install on API 26+ changes the Not verified here: remote and provider adb executors forwarding No conflicts are known. Before merge, fix the |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 2 findings moved to a new line on 68c91bc. The verdict and the full list are in the summary comment.
- 🟡 Minor · Warm install memo trusts pm path alone and is not recorded after an install ·
packages/platform-android/src/snapshot-helper-install.ts:88(moved) - 🟡 Minor · Clipped-node fill failure reports text_mismatch and echoes the truncated prefix ·
packages/platform-android/src/fill-verification.ts:346(moved)
- A newer installed helper versionCode is not the trusted artifact; the install step uninstalls it and installs the bundled APK. Warm admission compares the memoized verified base APK path with one pm path read instead of re-hashing. - The host caps helper output at 32 MiB on the session socket and passes the same cap as maxBuffer to one-shot helper captures. - The helper clips text past 64K chars and marks text-clipped; is text, get text, and fill verification refuse a clipped value with reason text_clipped.
… versions on all API levels - maxBuffer is an AndroidAdbExecutorOptions field, so the snapshot helper cap reaches runCmd. - The installed helper versionCode comes from dumpsys package, which Android 6.0+ answers; pm list packages --show-versioncode is absent before 8.0, so a newer helper read as missing. - The clipped-text refusal moves to command-runtime, keeping the selectors eager closure.
68c91bc to
1b905cd
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 2 findings moved to a new line on 1b905cd. The verdict and the full list are in the summary comment.
- 🟡 Minor · Clipped-node fill failure reports text_mismatch and echoes the truncated prefix ·
packages/platform-android/src/fill-verification.ts:346(moved) - 🟡 Minor · A successful install records no memo, so the next command re-pulls and re-hashes the APK ·
packages/platform-android/src/helper-package-install.ts:110(moved)
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 743cc47. The verdict and the full list are in the summary comment.
- 🟡 Minor · Filling text longer than 64K chars can never verify: fill fails with text_mismatch ·
packages/platform-android/src/fill-verification.ts:346
There was a problem hiding this comment.
2 issues found across 59 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/platform-android/src/__tests__/snapshot-helper-session.fixtures.ts">
<violation number="1" location="packages/platform-android/src/__tests__/snapshot-helper-session.fixtures.ts:32">
P3: The hardcoded `versionCode=13003` duplicates the fixture artifact's manifest version. Build the probe stdout from `ANDROID_SNAPSHOT_HELPER_FIXTURE_ARTIFACT.manifest.versionCode` so the 'current' state cannot drift from the artifact the tests install.</violation>
</file>
<file name="packages/platform-android/src/snapshot-helper-install.ts">
<violation number="1" location="packages/platform-android/src/snapshot-helper-install.ts:133">
P3: This stores a verified path without evicting older keys for the same device and package, so the process-global map grows with each artifact upgrade. Evict sibling keys for that device/package before storing the new path.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
This comment has been minimized.
This comment has been minimized.
|
The code findings from the earlier review (#5339 (comment)) are fixed at fb33027, and one finding remains: the device-facing paths have no live run. The helper now verifies installed bytes, the newer-helper case reinstalls with The device-facing changes in snapshot-helper-install.ts:93 still have no live run, and the PR body says "No device runs". This covers the text clip in None of the earlier inline threads still apply, and no high-priority thread or lower-priority thread is left open. These can be resolved: #5339 (comment) (maxBuffer typed, fixed), #5339 (comment) (cap reaches CI is pending at fb33027. Coverage and one other check are still running with no failure, and all other checks pass, including Repo Guards after the Not verified here: the Java test suite (the surrogate case) and the TypeScript tests were not run. The Before merge, the emulator run above at fb33027 or later is required. |
This comment has been minimized.
This comment has been minimized.
Emulator run at fb33027
1. Text clip,
|
|
The emulator run at fb33027 (#5339 (comment)) covers all four checks from the last review:
The device-run finding is closed. The |
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
|
The hung Coverage job from the earlier review (fb33027) is fixed at 8b0408d, and the code has no remaining problems. The change since then is test-only, so production code is identical and the emulator evidence already accepted on this PR (#5339 (comment)) still covers the behavior. CI is green: 18 checks, none failing, including Coverage and Integration Tests, with Proof skipped. No conflicts are known. Not verified here: the Coverage job was not run locally, and the import-cycle diagnosis rests on reading the import graph plus the green Coverage check at this head. The 24 review threads were resolved before the earlier review and none changed since, so they are not re-judged here. Maintainer review is the remaining step before merge. |
Summary
The installed Android helper must be the trusted artifact, and the host must stay bounded about app text. Install checks cover replacements that complete before admission. A holder of the helper signing key can still update the package between
pm pathandam instrument, so the guarantee depends on #5341's key rotation.Before / after
current, ran unverifiednewer: uninstall, then install the bundled APK. versionCode comes fromdumpsys packagepm pathcompared with the verified pathcommand_output_limitfor a one-shot call,android_snapshot_helper_session_response_too_largefor a sessiontext-clipped.get textandis textrefuse withtext_clipped. Fill verification accepts a clipped node only when it is the prefix of a longer expected valueValidation
0.22: about +240 / -170 lines.