fix(android): shell-quote free-text arguments reaching the device shell - #1645
Conversation
8d1440f to
b6ab288
Compare
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
Reviewed exact head Not ready yet: required live Android evidence is absent. Rebuild the Android artifacts, run without the test IME/provider-native injector, and attach literal UI read-back for shell-metacharacter |
|
Coverage is red here, and it is not attributable to this change. Evidence, since "unrelated flake" deserves proof rather than assertion:
Root cause: the test asserts absolute indices into a timing-dependent event array. const firstStep = hookValue(hooks, 3, 'onTestStep');
expect(hookValue(hooks, 5, 'onTestStep')).toMatchObject({ attempt: 2, … });CI observed 6 hooks where 8 were expected ( This is a latent defect on main. What this branch does is change which Android provider-scenario files run concurrently in the same shard, shifting the scheduling enough to expose it — deterministically for this file set, which is why a rerun reproduced it exactly. Note it is outside Not fixing it in this PR — that would bundle an unrelated main-branch test defect into an Android platform change, which is exactly the mixing the split was meant to undo. Happy to send it as its own PR. This PR stays a draft regardless, pending live emulator evidence with the test IME off. |
Live Android evidence — exact head
|
|
Evidence re-review at unchanged head Readiness is still blocked by two concrete residuals:
No |
|
|
Re-reviewed unchanged head Readiness is still blocked by the confirmed red Coverage lane on untouched, load-sensitive absolute-index reporter assertions. No |
Text entry (input text) and clipboard write (cmd clipboard set text) now quote their free-form text argument with the same shellQuoteIfNeeded helper app-lifecycle.ts already uses for deep-link URLs and launch arguments, and app-lifecycle.ts's local duplicate of that helper is retired in favor of the shared one. Multi-word clipboard writes also now arrive at the device as a single argument instead of being re-tokenized into separate ones. Updates the provider-scenario test harness's scripted clipboard-state simulator to unwrap shell quoting the same way a device shell does, so it keeps modelling what the device actually receives.
b6ab288 to
10e0833
Compare
|
Summary
adb shellpath fortype/fillandclipboard write, so shell metacharacters cannot be re-tokenized as commands.shellQuoteIfNeeded, remove the Android-local duplicate, and preserve unquoted arguments that are already shell-safe.This is the Android shell-argument fix split from #1639 and is now rebased onto
mainafter #1708.Validation
10e0833ad:pnpm check:affected --head 10e0833ad --runpassed (207 test files, 1,713 tests; changed lines 2/2 and branches 2/2 covered).typeAndroid shell-quotes text containing shell metacharactersandwriteAndroidClipboardWithAdb shell-quotes text containing metacharactersfail; restoring them returns the suite to green.b6ab28803): Pixel 7 API 36, test IME disabled, diagnostic backend confirmed asadb-shell; shell-metacharacter text round-tripped exactly in the UI and raw UI Automator output. The device session and emulator were cleaned up afterward.cmd clipboardshell command (ClipboardServicehas no shell handler), so clipboard coverage is red-proven at the adb argument seam instead of claiming a live path that cannot execute on that image.