Skip to content

fix(android): bound helper stderr in client errors and the request log - #4888

Merged
thymikee merged 1 commit into
mainfrom
t3/android-snapshot-stderr-filter
Nov 21, 2026
Merged

thymikee merged 1 commit into
mainfrom
t3/android-snapshot-stderr-filter

Conversation

@thymikee

@thymikee thymikee commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Summary

A failing Android snapshot helper published its raw stderr to the client error, the failure-reason cause line, and the android_snapshot_helper_failed request-log entry. Remote clients download that log, so a tagless hierarchy fragment landing on stderr could carry screen text. Helper failures now publish stderr through one bounded, snapshot-content-free diagnostic: lines holding an attribute-like assignment, markup, an entity, or a payload record are withheld whole, kept text stays inside the 2,048-character cap, and stderrWithheldLines records the omission. The cause line a provider reads stays visible. Four files, no scope expansion. Fixes #4026.

Before / after

One failing run, stderr:

ret" text="<value>" />
uiautomator unavailable
am: Killed
  • Base c37bb956: the client error ends …parseable output: ret" text="<value>" />, details.stderr holds the raw stream, and the request-log reason holds the fragment.
  • Head 4ccdb14c: the error ends …parseable output: uiautomator unavailable, details.stderr is the two kept cause lines, details.stderrWithheldLines is 1, and no surface holds the fragment.
  • Stderr holding only a fragment: base publishes it, head publishes no stderr and stderrWithheldLines: 1.

Validation

Base c37bb956, head 4ccdb14c25.

  • vitest run --project unit-core packages/platform-android/src/__tests__/snapshot-helper-exit-result.test.ts: 4 failed at base (raw stderr in details, message and request log), 34 passed at head.
  • vitest run --project unit-core packages/platform-android: 1450 passed.
  • pnpm format, tsc --noEmit, oxlint: clean. CI owns the full gate: green at head (19 success, 0 failing), including coverage, integration, repo guards and the device smoke lanes.
  • Device-free: no helper, transport or dispatch change, so no device run.

🤖 Generated with Claude Code

…the request log

Helper stderr reached the client error, the failure reason, and the
android_snapshot_helper_failed request-log entry unfiltered. A tagless
hierarchy fragment that lands on stderr therefore travels to remote
clients and the downloadable request log. Failures now publish stderr
through a bounded, snapshot-content-free diagnostic: lines holding
attribute-like assignments, markup, entities or payload records are
withheld whole, the kept text stays inside the field cap, and
stderrWithheldLines records the omission. The cause line a provider
reads stays visible.

Refs #4026.
@github-actions

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.48 MB 6.48 MB +437 B
Package (unpacked) 6.48 MB 6.48 MB +437 B
Package (download) 1.97 MB 1.97 MB +156 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 17.9 ms 18.0 ms +0.1 ms
CLI --help 37.8 ms 42.8 ms +5.0 ms

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 4ccdb14

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (c37bb956307c).

💬 Talking to Sentinel

In a finding's thread, reply with:

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.

@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 4ccdb14: helper stderr is filtered and bounded before it reaches client errors and the request log, and the required fix sections are present. CI is green; the two cancelled Body rules runs were stopped by concurrency, and later runs of the same workflow passed at this head. There are no conflicts, and no further action is needed before merge. Not blocking, and fine to take or leave: (1) the filter in instrumentation-helper.ts is a deny-pattern, so plain prose that quotes a node label without quotes or markup, such as IllegalStateException: Transfer 500 to Alice, still passes; an allowlist of known cause shapes could be a follow-up issue; (2) the 2,048-character budget at line 381 fills from the head, so a trailing Caused by: or am: Killed line can be dropped from details; splitting it between head and tail lines would keep it; (3) snapshot.ts filters details.stderr a second time while the details spread keeps the raw value, so reading the first line directly there, or filtering once inside androidSnapshotHelperCaptureError, would keep one rule in one place; (4) the nonzero-exit-after-parseable-output test at snapshot-helper-exit-result.test.ts uses clean stderr, so reverting that site would stay green; a text="${SECRET}" line asserting stderr is am: Killed and stderrWithheldLines is 1 would pin it; (5) debugging-profiling.md could add one sentence that Android snapshot-helper stderr lines that look like snapshot content are withheld and counted in details.stderrWithheldLines. Not verified here: tests were not run, so the '4 failed at base' and '1450 passed' figures are inferred from the diff, and third-party AndroidAdbProvider executors were not audited. No live device run was needed, since the change only shapes error details.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 21, 2026
@thymikee
thymikee merged commit 2f435ae into main Nov 21, 2026
22 of 24 checks passed
@thymikee
thymikee deleted the t3/android-snapshot-stderr-filter branch November 21, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android: helper stderr reaches the client error and request log unfiltered

1 participant