[PR #4720] fix(adb): attribute pull file refusals to the device path #6370

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4720
Author: @Kaushalendra-Marcus
Created: 10/17/2026
Status: 🔄 Open

Base: main ← Head: fix/pull-adb-file-path-attribution


📝 Commits (1)

  • 832e57f fix(adb): attribute pull file refusals to the device path

📊 Changes

3 files changed (+392 additions, -5 deletions)

View changed files

📝 src/adb/AdbCommand.test.ts (+139 -0)
📝 src/adb/AdbCommand.ts (+57 -5)
📝 tests/boundary/cli/adbCli.test.ts (+196 -0)

📄 Description

Summary

Path-specific adb pull refusals (missing or protected remote files) now report the remote device file identity through details and the message, while device-state refusals (offline, unauthorized, closed) keep the serial. No provider output shape changes; push and the multi-APK pull flow are untouched.

Problem and expected behavior

adb pull <serial>:<remote> <local> failures for a named remote file were attributed to the host path because the diagnostic parser preferred any file-looking operand. The violated invariant is that the reported file identity must be the operand named by adb's own diagnostic, and device state must remain attached to the serial.

Smallest trigger: pull a missing remote path whose host path differs; the refusal previously reported the host path as the file identity.

Change and scope

  • src/adb/AdbCommand.ts: attribution follows the operand named by adb's message. A known local-file form or an exact quoted/delimited host token names the destination; an exact remote token or "remote object" names the source; when the diagnostic names both distinct operands, the command owner keeps the device identity rather than guessing; equal remote and host paths remain one file identity; generic file failures keep the addressed-path fallback.
  • runAdbCapture gains an optional per-call target, used only when the provider knows the failing operand; the pull flow passes the requested device path.
  • Tests: unit regressions in src/adb/AdbCommand.test.ts and CLI end-to-end regressions in tests/boundary/cli/adbCli.test.ts, including equal-path and both refusal classes.

Intentionally not included: push attribution coverage (#4963) and the multi-APK pull flow.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/adb/AdbCommand.ts attribution of the pull refusal; earliest changed stage is provider diagnostic parsing.
  • Contribution scope fit and linked maintainer decision: ordinary fix within the existing ADB provider boundary; not applicable.
  • CLI and MCP/tool-catalog contract: path-specific pull refusals now name the remote file identity in details and the message; no shape or catalog changes.
  • Provider, bridge, target-format, or platform compatibility: no provider output shape changes; ADB wire behavior unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: read-only adb pull attribution; no target mutation; process cleanup unchanged.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • 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: src/adb/AdbCommand.test.ts (unit attribution matrix) and tests/boundary/cli/adbCli.test.ts (public CLI refusals, equal-path case, both refusal classes).
  • Base reproduction or other evidence: the CLI regressions exercise the addressed-path fallback, the named remote operand, the both-distinct-operands case, and equal paths; each fails on an implementation that collapses those identities.
  • User-visible CLI/MCP output (if applicable): refusal JSON naming the remote file in details and the serial for device-state refusals.
  • Remaining proof gaps: no physical device attached; adb interactions are simulated fixtures.

Validation performed

  • npm run test:focused -- src/adb/AdbCommand.test.ts tests/boundary/cli/adbCli.test.ts — 43 passed on 832e57faf, base 1c2c2f1e7.
  • npm run check:fast — typecheck and lint pass for the rebased revision.
  • Broader focused coverage on the prior revision (same diff): AdbProvider, adbErrorIdentity, and the MCP/process/provider ADB boundary files — 188 tests passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; simulated adb only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner: @Kaushalendra-Marcus

  • 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/4720 **Author:** [@Kaushalendra-Marcus](https://github.com/Kaushalendra-Marcus) **Created:** 10/17/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/pull-adb-file-path-attribution` --- ### 📝 Commits (1) - [`832e57f`](https://github.com/morluto/rea/commit/832e57faf2bddae61b67f77dad55745566bf74d6) fix(adb): attribute pull file refusals to the device path ### 📊 Changes **3 files changed** (+392 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/adb/AdbCommand.test.ts` (+139 -0) 📝 `src/adb/AdbCommand.ts` (+57 -5) 📝 `tests/boundary/cli/adbCli.test.ts` (+196 -0) </details> ### 📄 Description ## Summary Path-specific `adb pull` refusals (missing or protected remote files) now report the remote device file identity through `details` and the message, while device-state refusals (offline, unauthorized, closed) keep the serial. No provider output shape changes; push and the multi-APK pull flow are untouched. ## Problem and expected behavior `adb pull <serial>:<remote> <local>` failures for a named remote file were attributed to the host path because the diagnostic parser preferred any file-looking operand. The violated invariant is that the reported file identity must be the operand named by adb's own diagnostic, and device state must remain attached to the serial. Smallest trigger: pull a missing remote path whose host path differs; the refusal previously reported the host path as the file identity. ## Change and scope - `src/adb/AdbCommand.ts`: attribution follows the operand named by adb's message. A known local-file form or an exact quoted/delimited host token names the destination; an exact remote token or "remote object" names the source; when the diagnostic names both distinct operands, the command owner keeps the device identity rather than guessing; equal remote and host paths remain one file identity; generic file failures keep the addressed-path fallback. - `runAdbCapture` gains an optional per-call target, used only when the provider knows the failing operand; the pull flow passes the requested device path. - Tests: unit regressions in `src/adb/AdbCommand.test.ts` and CLI end-to-end regressions in `tests/boundary/cli/adbCli.test.ts`, including equal-path and both refusal classes. Intentionally not included: push attribution coverage (#4963) and the multi-APK pull flow. ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/adb/AdbCommand.ts` attribution of the pull refusal; earliest changed stage is provider diagnostic parsing. - Contribution scope fit and linked maintainer decision: ordinary fix within the existing ADB provider boundary; not applicable. - CLI and MCP/tool-catalog contract: path-specific pull refusals now name the remote file identity in `details` and the message; no shape or catalog changes. - Provider, bridge, target-format, or platform compatibility: no provider output shape changes; ADB wire behavior unchanged. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details: read-only adb pull attribution; no target mutation; process cleanup unchanged. - Generated metadata, package, or installation impact: none. Expected effects: - [x] Read existing files or captured data. - [x] 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: `src/adb/AdbCommand.test.ts` (unit attribution matrix) and `tests/boundary/cli/adbCli.test.ts` (public CLI refusals, equal-path case, both refusal classes). - Base reproduction or other evidence: the CLI regressions exercise the addressed-path fallback, the named remote operand, the both-distinct-operands case, and equal paths; each fails on an implementation that collapses those identities. - User-visible CLI/MCP output (if applicable): refusal JSON naming the remote file in `details` and the serial for device-state refusals. - Remaining proof gaps: no physical device attached; adb interactions are simulated fixtures. ## Validation performed - `npm run test:focused -- src/adb/AdbCommand.test.ts tests/boundary/cli/adbCli.test.ts` — 43 passed on `832e57faf`, base `1c2c2f1e7`. - `npm run check:fast` — typecheck and lint pass for the rebased revision. - Broader focused coverage on the prior revision (same diff): `AdbProvider`, `adbErrorIdentity`, and the MCP/process/provider ADB boundary files — 188 tests passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable; simulated adb only. - Package or release metadata impact: none. - Security, privacy, process, or containment review: none. ## Author readiness Human owner: @Kaushalendra-Marcus - [ ] 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#6370
No description provided.