[PR #6089] fix(adb): preserve filesystem meaning of host paths #7146

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6089
Author: @x1mm4nu3l
Created: 10/21/2026
Status: 🔄 Open

Base: main ← Head: fix/adb-host-path-selection


📝 Commits (1)

  • 5555c47 fix(adb): preserve filesystem meaning of host paths

📊 Changes

5 files changed (+178 additions, -22 deletions)

View changed files

📝 docs/adb-device-analysis.md (+4 -0)
📝 src/adb/AdbProvider.test.ts (+4 -12)
📝 src/adb/AdbProvider.ts (+9 -6)
➕ tests/boundary/cli/adbHostPaths.test.ts (+142 -0)
📝 tests/boundary/providers/adb/adbScreenPublicationCancellation.test.ts (+19 -4)

📄 Description

Summary

path.resolve() can make ADB push/install consume a sibling file and pull into a sibling directory. Follow-up to #4067 and #3864.

Problem and expected behavior

On POSIX, with an owned test device (replace SERIAL):

mkdir -p target/child
ln -s target/child link
printf 'intended payload\n' > target/payload
printf 'wrong sibling\n' > payload
rea push-adb-file SERIAL "$PWD/link/../payload" /data/local/tmp/rea-path-probe.txt
adb -s SERIAL exec-out cat /data/local/tmp/rea-path-probe.txt

Before: successful push with a matching checksum, 14 bytes, wrong sibling. Fixed: 17 bytes, intended payload.

Change and scope

Reuse absoluteCallerPath for push/install inputs. Canonicalize output directories after filesystem lookup, before joining child paths. Canonical temp fixtures keep path assertions portable.

Contract and boundary impact

  • Owner: host-path handling in AdbProvider.
  • Scope decision: not applicable; existing ADB operations.
  • CLI/MCP: schemas unchanged; output locations use canonical directories.
  • Compatibility: POSIX file selection corrected.
  • Evidence: original selections remain in parameters; digests identify consumed bytes.
  • Authority and cleanup: unchanged.
  • Generated files and package/setup metadata: unchanged.

Existing effects:

  • Read existing files.
  • Launch a process.
  • Inject instrumentation or run target code.
  • Write files.
  • Contact the selected ADB server/device.
  • Recover protected code.
  • Documentation only.
  • Unknown effects.

Evidence and regression coverage

Three regressions fail before and pass after: CLI/MCP push and install, plus CLI pull. Real ADB 37.0.1 on an owned Android 34 emulator confirmed corrected bytes and output directory.

  • Facts and limitations remain distinct.
  • Source identity and provenance remain available.
  • Unavailable coverage stays explicit.

Validation performed

154 focused tests across eight files passed. npm run check, npm run docs:check and npm run verify:test-discovery passed. The built scripts/verify-adb.mjs verifier passed against the owned emulator.

Compatibility, safety, and release

Native macOS/Windows and actual APK installation untested; install snapshot selection uses simulated ADB.

Author readiness

Human owner: @x1mm4nu3l

  • 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

  • Concrete problem confirmed.
  • Scope and authority resolved.
  • Focused outcome and conventional title.
  • Related issue linked.
  • Regression coverage checked.
  • Relevant documentation updated.
  • Observable output included above.
  • Final diff reviewed.

🔄 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/6089 **Author:** [@x1mm4nu3l](https://github.com/x1mm4nu3l) **Created:** 10/21/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/adb-host-path-selection` --- ### 📝 Commits (1) - [`5555c47`](https://github.com/morluto/rea/commit/5555c4740f4a721839eea4d44bd5004c2af8662c) fix(adb): preserve filesystem meaning of host paths ### 📊 Changes **5 files changed** (+178 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `docs/adb-device-analysis.md` (+4 -0) 📝 `src/adb/AdbProvider.test.ts` (+4 -12) 📝 `src/adb/AdbProvider.ts` (+9 -6) ➕ `tests/boundary/cli/adbHostPaths.test.ts` (+142 -0) 📝 `tests/boundary/providers/adb/adbScreenPublicationCancellation.test.ts` (+19 -4) </details> ### 📄 Description ## Summary `path.resolve()` can make ADB push/install consume a sibling file and pull into a sibling directory. Follow-up to #4067 and #3864. ## Problem and expected behavior On POSIX, with an owned test device (replace SERIAL): ```sh mkdir -p target/child ln -s target/child link printf 'intended payload\n' > target/payload printf 'wrong sibling\n' > payload rea push-adb-file SERIAL "$PWD/link/../payload" /data/local/tmp/rea-path-probe.txt adb -s SERIAL exec-out cat /data/local/tmp/rea-path-probe.txt ``` Before: successful push with a matching checksum, 14 bytes, `wrong sibling`. Fixed: 17 bytes, `intended payload`. ## Change and scope Reuse `absoluteCallerPath` for push/install inputs. Canonicalize output directories after filesystem lookup, before joining child paths. Canonical temp fixtures keep path assertions portable. ## Contract and boundary impact - Owner: host-path handling in `AdbProvider`. - Scope decision: not applicable; existing ADB operations. - CLI/MCP: schemas unchanged; output locations use canonical directories. - Compatibility: POSIX file selection corrected. - Evidence: original selections remain in parameters; digests identify consumed bytes. - Authority and cleanup: unchanged. - Generated files and package/setup metadata: unchanged. Existing effects: - [x] Read existing files. - [x] Launch a process. - [ ] Inject instrumentation or run target code. - [x] Write files. - [x] Contact the selected ADB server/device. - [ ] Recover protected code. - [ ] Documentation only. - [ ] Unknown effects. ## Evidence and regression coverage Three regressions fail before and pass after: CLI/MCP push and install, plus CLI pull. Real ADB 37.0.1 on an owned Android 34 emulator confirmed corrected bytes and output directory. - [x] Facts and limitations remain distinct. - [x] Source identity and provenance remain available. - [x] Unavailable coverage stays explicit. ## Validation performed 154 focused tests across eight files passed. `npm run check`, `npm run docs:check` and `npm run verify:test-discovery` passed. The built `scripts/verify-adb.mjs` verifier passed against the owned emulator. ## Compatibility, safety, and release Native macOS/Windows and actual APK installation untested; install snapshot selection uses simulated ADB. ## Author readiness Human owner: @x1mm4nu3l - [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 - [x] Concrete problem confirmed. - [x] Scope and authority resolved. - [x] Focused outcome and conventional title. - [x] Related issue linked. - [x] Regression coverage checked. - [x] Relevant documentation updated. - [x] Observable output included above. - [x] Final diff reviewed. --- <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#7146
No description provided.