[PR #4963] test(adb): cover push device-state refusal attribution #6697

Open
opened 2026-11-01 21:42:22 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/push-adb-device-state-serial


📝 Commits (1)

  • 3acb9d2 test(adb): cover push device-state refusal attribution

📊 Changes

2 files changed (+169 additions, -1 deletions)

View changed files

📝 src/adb/AdbCommand.test.ts (+87 -1)
📝 tests/boundary/cli/adbCli.test.ts (+82 -0)

📄 Description

Summary

Adds regression coverage for ADB push refusal attribution. The production change is already in main as 8307ea371 fix(adb): preserve command failure target identities; this PR locks the serial-vs-path behavior down with unit and CLI-boundary tests. No production code changes.

No issue is linked; the production fix is tracked by 8307ea371, and this PR covers its regression surface.

Problem and expected behavior

A push refusal can be either device-state-specific (offline, unauthorized) or path-specific. The expected attribution is:

  • device-state refusals credit the selected serial;
  • path-specific refusals keep the destination path;
  • callers that do not provide a device target keep the previous path attribution.

The production fix for that behavior is 8307ea371. These tests fail if push probe or transfer refusals regress to naming the destination instead of the serial.

Change and scope

Only tests change:

  • src/adb/AdbCommand.test.ts adds:
    • error: device offline and error: device unauthorized push cases asserting details.path is the selected serial and the message names probe-device;
    • a quoted destination /sdcard/unauthorized/payload.bin asserting a path-specific refusal still credits the destination;
    • an existence-probe device-state refusal asserting the serial is credited.
  • tests/boundary/cli/adbCli.test.ts adds an offline/unauthorized matrix at the probe and push stages, asserting exit code 1, unsupported_target, details.operation = push_adb_file, details.path = probe-device, the preserved reason, and that probe failures stop before adb push.
  • The CLI matrix is skipped on Windows because its fixture is a POSIX shell script.

Not included: production changes, new providers, MCP schema changes, or real-device testing.

Contract and boundary impact

  • Semantic owner and earliest changed stage: none; tests only.
  • Contribution scope fit and linked maintainer decision: ordinary regression coverage within existing ADB boundaries; no new scope decision required.
  • CLI and MCP/tool-catalog contract: no change. The tests assert the existing unsupported_target diagnostic shape.
  • Provider, bridge, target-format, or platform compatibility: no change. The CLI fixture is POSIX-only and skipped on Windows.
  • Evidence, artifact, provenance, or reconstruction contract: no change.
  • Target selection, authority, upstream behavior, and cleanup details: no production behavior change. Tests use a temporary stub adb executable, not a real device.
  • Generated metadata, package, or installation impact: none.

Expected effects: test-only; no production target interaction. The CLI boundary launches the local CLI with a temporary stub adb shell script. None of the target-effect boxes apply.

  • 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, tests/boundary/cli/adbCli.test.ts.
  • Base reproduction or other evidence: the regression targets the behavior fixed upstream in 8307ea371. The new tests were not run against the pre-fix revision in this branch.
  • User-visible CLI/MCP output: the CLI matrix asserts the JSON refusal fields (unsupported_target, push_adb_file, selected serial, preserved reason). No production output changed.
  • Remaining proof gaps: no real adb device or Windows CLI run; the Windows CLI case is skipped because the fixture is a shell script.

For evidence-bearing changes: not applicable; this PR does not change Evidence-producing code.

  • 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 tests/boundary/cli/adbCli.test.ts tests/boundary/process/processFilesystemCoverageAdapters.test.ts — passed.
  • npm run check:fast — passed.
  • git diff --check upstream/main...HEAD — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; tests use a stub adb executable and do not require a real device.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: test-only; no production behavior change. The CLI test creates an isolated temporary workspace and removes it on finish.

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/4963 **Author:** [@Kaushalendra-Marcus](https://github.com/Kaushalendra-Marcus) **Created:** 10/18/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/push-adb-device-state-serial` --- ### 📝 Commits (1) - [`3acb9d2`](https://github.com/morluto/rea/commit/3acb9d283110a40a68f670246b2e9ea06a0673ce) test(adb): cover push device-state refusal attribution ### 📊 Changes **2 files changed** (+169 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/adb/AdbCommand.test.ts` (+87 -1) 📝 `tests/boundary/cli/adbCli.test.ts` (+82 -0) </details> ### 📄 Description ## Summary Adds regression coverage for ADB push refusal attribution. The production change is already in `main` as `8307ea371 fix(adb): preserve command failure target identities`; this PR locks the serial-vs-path behavior down with unit and CLI-boundary tests. No production code changes. No issue is linked; the production fix is tracked by `8307ea371`, and this PR covers its regression surface. ## Problem and expected behavior A push refusal can be either device-state-specific (`offline`, `unauthorized`) or path-specific. The expected attribution is: - device-state refusals credit the selected serial; - path-specific refusals keep the destination path; - callers that do not provide a device target keep the previous path attribution. The production fix for that behavior is `8307ea371`. These tests fail if push probe or transfer refusals regress to naming the destination instead of the serial. ## Change and scope Only tests change: - `src/adb/AdbCommand.test.ts` adds: - `error: device offline` and `error: device unauthorized` push cases asserting `details.path` is the selected serial and the message names `probe-device`; - a quoted destination `/sdcard/unauthorized/payload.bin` asserting a path-specific refusal still credits the destination; - an existence-probe device-state refusal asserting the serial is credited. - `tests/boundary/cli/adbCli.test.ts` adds an offline/unauthorized matrix at the probe and push stages, asserting exit code `1`, `unsupported_target`, `details.operation = push_adb_file`, `details.path = probe-device`, the preserved reason, and that probe failures stop before `adb push`. - The CLI matrix is skipped on Windows because its fixture is a POSIX shell script. Not included: production changes, new providers, MCP schema changes, or real-device testing. ## Contract and boundary impact - Semantic owner and earliest changed stage: none; tests only. - Contribution scope fit and linked maintainer decision: ordinary regression coverage within existing ADB boundaries; no new scope decision required. - CLI and MCP/tool-catalog contract: no change. The tests assert the existing `unsupported_target` diagnostic shape. - Provider, bridge, target-format, or platform compatibility: no change. The CLI fixture is POSIX-only and skipped on Windows. - Evidence, artifact, provenance, or reconstruction contract: no change. - Target selection, authority, upstream behavior, and cleanup details: no production behavior change. Tests use a temporary stub `adb` executable, not a real device. - Generated metadata, package, or installation impact: none. Expected effects: test-only; no production target interaction. The CLI boundary launches the local CLI with a temporary stub `adb` shell script. None of the target-effect boxes apply. - [ ] 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`, `tests/boundary/cli/adbCli.test.ts`. - Base reproduction or other evidence: the regression targets the behavior fixed upstream in `8307ea371`. The new tests were not run against the pre-fix revision in this branch. - User-visible CLI/MCP output: the CLI matrix asserts the JSON refusal fields (`unsupported_target`, `push_adb_file`, selected serial, preserved reason). No production output changed. - Remaining proof gaps: no real adb device or Windows CLI run; the Windows CLI case is skipped because the fixture is a shell script. For evidence-bearing changes: not applicable; this PR does not change Evidence-producing code. - [ ] 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 tests/boundary/cli/adbCli.test.ts tests/boundary/process/processFilesystemCoverageAdapters.test.ts` — passed. - `npm run check:fast` — passed. - `git diff --check upstream/main...HEAD` — passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable; tests use a stub adb executable and do not require a real device. - Package or release metadata impact: none. - Security, privacy, process, or containment review: test-only; no production behavior change. The CLI test creates an isolated temporary workspace and removes it on finish. ## 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#6697
No description provided.