[PR #4655] [CLOSED] fix(adb): preserve device and file error identity #6349

Closed
opened 2026-10-31 01:13:46 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4655
Author: @Xinglan233
Created: 10/17/2026
Status: ❌ Closed

Base: main ← Head: fix/adb-error-target-4643


📝 Commits (2)

  • ef1527e fix(adb): preserve device and file error identity
  • 84f5837 fix(adb): recognize legacy daemon startup notices

📊 Changes

6 files changed (+214 additions, -35 deletions)

View changed files

📝 src/adb/AdbCommand.test.ts (+1 -1)
📝 src/adb/AdbCommand.ts (+53 -14)
📝 src/adb/AdbDeviceOutput.ts (+1 -1)
📝 src/adb/AdbProvider.test.ts (+128 -2)
📝 src/adb/AdbProvider.ts (+30 -16)
📝 tests/boundary/providers/adb/adbCommandFinalization.test.ts (+1 -1)

📄 Description

Summary

Fixes #4643 and #4641. File refusals identify the file, and device-state refusals identify the selected serial.

Problem and expected behavior

pull-adb-file probe-device /sdcard/rea-repro/sample.bin reported the serial in details.path when the remote file was missing or unreadable. Push reported its destination path for offline/unauthorized failures. One shared error target could not represent both identities.

Change and scope

Keep device, file and known host-operand context at the existing ADB command owner. Recognize device diagnostics after known ADB wrappers and modern/legacy startup notices, sharing the existing success-notice predicate with device-list parsing; filename keywords are not device verdicts. Explicit host diagnostics must match the known host operand, including the actual push/install snapshot. Update direct consumers; preserve transfer results, raw reasons and existing process/resource behavior. This is an ordinary diagnostic fix within the existing contribution scope; no advance maintainer scope decision applies.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/adb/AdbCommand.ts, command-failure classification before shared CLI/MCP error projection.
  • Contribution scope fit and linked maintainer decision: ordinary fix; not applicable.
  • CLI and MCP/tool-catalog contract: unchanged schemas; corrected details.path and message target with the original reason retained.
  • Provider, bridge, target-format, or platform compatibility: known ADB diagnostic formats; Linux simulated producer evidence only.
  • Evidence, artifact, provenance, or reconstruction contract: success bytes/digests and raw refusal reasons retained.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): selected serial/operands, transfer authority and cleanup behavior unchanged.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none; no schema, package or installation edits.

Expected effects of existing transfer workflows (this patch only corrects diagnostics).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: eleven representative subprocess-backed provider cases, including legacy startup notices before offline and missing-device refusals; strengthen existing push-probe identity checks and correct the existing not-found diagnostic fixture. Existing pull/push success controls remain.
  • Base reproduction or other evidence: both issue-provided fake-adb CLI scripts reproduced on 150e996a86f2bec4982ba87f37bf502a8d5e8214. The original identity regressions fail on that base. Two controlled legacy-banner refusals also reproduced on the preceding PR head; both added regression scenarios pass on this revision.
  • User-visible CLI/MCP output (if applicable): missing/permission => unsupported_target, details.path=/sdcard/rea-repro/sample.bin; offline/unauthorized => details.path=probe-device. Pull and push success retain 14 bytes and SHA-256 eac2a5a0837a324061f4b038b4c0af8c011bf9c47b595cda9459fd9c90651623.
  • Remaining proof gaps: no physical device, emulator or real adb binary; no Windows/macOS execution or complete deterministic suite. Legacy stderr notices are simulated producer evidence; historical ADB source establishes the strings but prints them to stdout. Unknown future diagnostic formats and generated bugreport file attribution are not established.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- src/adb/AdbCommand.test.ts src/adb/AdbDeviceOutput.test.ts src/adb/AdbProvider.test.ts tests/boundary/cli/adbCli.test.ts tests/boundary/mcp/adbMcp.test.ts tests/boundary/providers/adb/adbCommandFinalization.test.ts — 154/154 passed.
  • npm run check — passed (typecheck, built lint, format, knip, metadata, module boundaries and architecture guards); lint reports 0 errors and 1606 warnings.
  • Public CLI legacy-banner controls — 2/2 passed, retaining the selected serial and exact original reason. Production stdio MCP matrix — 9/9 passed, including successful pull/push bytes and digests, post-error pings and awaited cleanup.
  • Independent review — no blocking findings; 118/118 source tests and 9/9 controlled child-process boundary probes passed, including unknown/failed notices remaining protocol errors and unchanged successful output.
  • A temporary clean merge with main e567033a7137d5eebf49147ed325cad141cff5c2 passed 136/136 targeted ADB source and command-finalization tests. The PR branch was not rebased or expanded with upstream changes.
  • Known baseline limitation: three BinarySessionStatus.test.ts source-test failures were reproduced on untouched base 150e996a86f2bec4982ba87f37bf502a8d5e8214; its parent passes all three. This PR does not change that async test migration issue. The complete deterministic suite was not rerun.
  • Pinned toolchain: Node v24.18.0, npm 11.16.0, Linux. Every ADB result above uses simulated producer output, not a live device.

Compatibility, safety, and release

  • Breaking changes or migration steps: no schema or command migration; error identity changes intentionally correct the reported target.
  • Real Hopper/Ghidra, browser, or OS coverage: unrelated providers unchanged; Linux cloud only, no real Android device or Windows/macOS run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new commands, permissions, lifecycle paths or network effects. Tests use synthetic serials, paths and file bytes.

Author readiness

AI assistance: Codex assisted with investigation, implementation, test execution and preparation of this PR.

Human owner: @Xinglan233

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4655 **Author:** [@Xinglan233](https://github.com/Xinglan233) **Created:** 10/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/adb-error-target-4643` --- ### 📝 Commits (2) - [`ef1527e`](https://github.com/morluto/rea/commit/ef1527e26f6ef62a0d378f8ef927d1cd1c22e2e9) fix(adb): preserve device and file error identity - [`84f5837`](https://github.com/morluto/rea/commit/84f5837a90694434fb15497b2b38b9c6c7528f7b) fix(adb): recognize legacy daemon startup notices ### 📊 Changes **6 files changed** (+214 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `src/adb/AdbCommand.test.ts` (+1 -1) 📝 `src/adb/AdbCommand.ts` (+53 -14) 📝 `src/adb/AdbDeviceOutput.ts` (+1 -1) 📝 `src/adb/AdbProvider.test.ts` (+128 -2) 📝 `src/adb/AdbProvider.ts` (+30 -16) 📝 `tests/boundary/providers/adb/adbCommandFinalization.test.ts` (+1 -1) </details> ### 📄 Description <!-- PR title: type(optional-scope): imperative outcome The title becomes the squash-merge commit subject and generated changelog entry. --> ## Summary Fixes #4643 and #4641. File refusals identify the file, and device-state refusals identify the selected serial. <!-- What user, agent, or maintainer problem does this solve? Link the issue with "Fixes #123" when applicable. Keep the prior behavior, expected contract, and new behavior understandable without private context. --> ## Problem and expected behavior `pull-adb-file probe-device /sdcard/rea-repro/sample.bin` reported the serial in `details.path` when the remote file was missing or unreadable. Push reported its destination path for offline/unauthorized failures. One shared error target could not represent both identities. <!-- For fixes, give the smallest trigger and violated invariant. For features, describe the use case and observable outcome. --> ## Change and scope Keep device, file and known host-operand context at the existing ADB command owner. Recognize device diagnostics after known ADB wrappers and modern/legacy startup notices, sharing the existing success-notice predicate with device-list parsing; filename keywords are not device verdicts. Explicit host diagnostics must match the known host operand, including the actual push/install snapshot. Update direct consumers; preserve transfer results, raw reasons and existing process/resource behavior. This is an ordinary diagnostic fix within the existing contribution scope; no advance maintainer scope decision applies. <!-- Explain the chosen approach, why it fits REA's architecture, and what is intentionally not included. --> Follow the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope). Unresolved scope, authority, side effects, or required verification block integration. Link the required maintainer scope decision for new providers or capabilities involving target execution, injection, mutation, or protection recovery; ordinary fixes within existing boundaries may state "not applicable". Draft PRs may leave the scope decision pending and the readiness and merge checklists unchecked. Maintainers can help resolve open questions. ## Contract and boundary impact <!-- Short answers are welcome. Complete applicable lines; mark unresolved facts as "unknown". Use "none" or "not applicable" only when established. --> - Semantic owner and earliest changed stage: `src/adb/AdbCommand.ts`, command-failure classification before shared CLI/MCP error projection. - Contribution scope fit and linked maintainer decision: ordinary fix; not applicable. - CLI and MCP/tool-catalog contract: unchanged schemas; corrected `details.path` and message target with the original reason retained. - Provider, bridge, target-format, or platform compatibility: known ADB diagnostic formats; Linux simulated producer evidence only. - Evidence, artifact, provenance, or reconstruction contract: success bytes/digests and raw refusal reasons retained. - Target selection, authority, upstream behavior, and cleanup details (if applicable): selected serial/operands, transfer authority and cleanup behavior unchanged. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none; no schema, package or installation edits. Expected effects of existing transfer workflows (this patch only corrects diagnostics). Unchecked items do not establish absence; leave uncertainties visible. - [x] Read existing files or captured data. - [x] Launch or attach to a process. - [x] Inject instrumentation or run scripts/code. - [x] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage <!-- State whether evidence is executed, source-derived, or proposed. For fixes, show the original failure and explain how the regression would fail on the affected base revision when practical. Include the most useful proof inline; link long logs or artifacts, or put them in optional details. Documentation-only changes can use source, link, or rendered-document checks. --> - Tests added or updated: eleven representative subprocess-backed provider cases, including legacy startup notices before offline and missing-device refusals; strengthen existing push-probe identity checks and correct the existing not-found diagnostic fixture. Existing pull/push success controls remain. - Base reproduction or other evidence: both issue-provided fake-adb CLI scripts reproduced on `150e996a86f2bec4982ba87f37bf502a8d5e8214`. The original identity regressions fail on that base. Two controlled legacy-banner refusals also reproduced on the preceding PR head; both added regression scenarios pass on this revision. - User-visible CLI/MCP output (if applicable): missing/permission => `unsupported_target`, `details.path=/sdcard/rea-repro/sample.bin`; offline/unauthorized => `details.path=probe-device`. Pull and push success retain 14 bytes and SHA-256 `eac2a5a0837a324061f4b038b4c0af8c011bf9c47b595cda9459fd9c90651623`. - Remaining proof gaps: no physical device, emulator or real adb binary; no Windows/macOS execution or complete deterministic suite. Legacy stderr notices are simulated producer evidence; historical ADB source establishes the strings but prints them to stdout. Unknown future diagnostic formats and generated bugreport file attribution are not established. For evidence-bearing changes: - [ ] Observed, derived, and inferred claims remain distinguishable. - [ ] Artifact identity, source provenance, and failed attempts remain preserved. - [ ] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed <!-- List only commands that actually ran, with observed results. --> - `npm run test:focused -- src/adb/AdbCommand.test.ts src/adb/AdbDeviceOutput.test.ts src/adb/AdbProvider.test.ts tests/boundary/cli/adbCli.test.ts tests/boundary/mcp/adbMcp.test.ts tests/boundary/providers/adb/adbCommandFinalization.test.ts` — 154/154 passed. - `npm run check` — passed (typecheck, built lint, format, knip, metadata, module boundaries and architecture guards); lint reports 0 errors and 1606 warnings. - Public CLI legacy-banner controls — 2/2 passed, retaining the selected serial and exact original reason. Production stdio MCP matrix — 9/9 passed, including successful pull/push bytes and digests, post-error pings and awaited cleanup. - Independent review — no blocking findings; 118/118 source tests and 9/9 controlled child-process boundary probes passed, including unknown/failed notices remaining protocol errors and unchanged successful output. - A temporary clean merge with main `e567033a7137d5eebf49147ed325cad141cff5c2` passed 136/136 targeted ADB source and command-finalization tests. The PR branch was not rebased or expanded with upstream changes. - Known baseline limitation: three `BinarySessionStatus.test.ts` source-test failures were reproduced on untouched base `150e996a86f2bec4982ba87f37bf502a8d5e8214`; its parent passes all three. This PR does not change that async test migration issue. The complete deterministic suite was not rerun. - Pinned toolchain: Node v24.18.0, npm 11.16.0, Linux. Every ADB result above uses simulated producer output, not a live device. ## Compatibility, safety, and release <!-- Call out breaking changes, migrations, package effects, platform/provider limits, security/privacy/containment implications, and meaningful proof gaps. --> - Breaking changes or migration steps: no schema or command migration; error identity changes intentionally correct the reported target. <!-- For ! / BREAKING CHANGE: show a previously valid call/configuration, its new behavior and migration, and why compatibility/deprecation cannot preserve it. Every release increments minor, including breaking changes; keep breaking markers and migration notes so callers can assess compatibility. See docs/releasing.md. --> - Real Hopper/Ghidra, browser, or OS coverage: unrelated providers unchanged; Linux cloud only, no real Android device or Windows/macOS run. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new commands, permissions, lifecycle paths or network effects. Tests use synthetic serials, paths and file bytes. ## Author readiness AI assistance: Codex assisted with investigation, implementation, test execution and preparation of this PR. <!-- The human owner completes these declarations before requesting review. The PR author is the owner by default. A different owner must explicitly accept ownership on this PR. AI agents must leave these declarations to a human to dictate to them or there could be catastrophic consequences for many users of REA. Draft PRs may leave them unchecked. These declarations record initial readiness when opening the PR for review; later pushes do not require a new human sign-off. Keep the description and validation evidence current as the work changes. See CONTRIBUTING.md#pull-request-ownership-and-readiness. --> Human owner: @Xinglan233 - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge <!-- Draft PRs may leave pending items unchecked. Resolve material scope and authority questions before integration. --> - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:13:46 +00:00
bsakaguchi changed title from [PR #4655] [CLOSED] fix(adb): preserve device and file error identity to [PR #4655] fix(adb): preserve device and file error identity 2026-11-03 13:32:55 +00:00
bsakaguchi changed title from [PR #4655] fix(adb): preserve device and file error identity to [PR #4655] [CLOSED] fix(adb): preserve device and file error identity 2026-11-03 14:34:39 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6349
No description provided.