Skip to content

refactor(android): passthrough-rules.ts holds the adb refusal rules - #1279

Merged
V3RON merged 4 commits into
task/1266from
task/1267
Nov 4, 2026
Merged

V3RON merged 4 commits into
task/1266from
task/1267

Conversation

@V3RON

@V3RON V3RON commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1267

Status

Implement: done (727/727 green, 1 skipped) Review: fix-check pass Hardware: n/a Gate: waiting for the stack

  • pnpm exec vitest run --project unit src/drivers/android passes, and its number of tests is the base's plus the tests this task adds. — build moved 12 tests to passthrough-rules.test.ts; audit added one case and ran the folder green
  • src/drivers/android/passthrough-rules.ts exists, and only files in src/drivers/android/ import it: dependency-cruiser's past-index rule (.dependency-cruiser.mjs:36-37), run by pnpm check, fails any import of it from outside the folder. — audit checked importers; the push hook ran dependency-cruiser
  • src/drivers/android/index.ts defines none of the F1 names, except each Driver method (and other AndroidDriver member the core or the daemon calls), which stays and delegates; the root's field that holds the part takes a name that is not an F1 name; an F1 constant the root still uses is imported from the part. — code review mapped the removed code line by line onto the part; the field is #passthroughRules
  • In src/source-hygiene.test.ts, each Android entry equals its file's new line count, or is gone when the file is within its limit. — checked at e5c3ca7: index.ts 2943, index.test.ts 8060, both equal wc -l
  • pnpm check passes. — push hooks including Fallow passed on the head; CI runs it before the gate

Assumptions

  • Assumption: how the part reaches the phone's handler — it takes physical.passthrough and physical.runAdb callbacks plus platform, and the root passes lazy arrows, because the phone's handler is itself built with the part's isBareShell (a part never calls the root, ADR 0063 section 1).

Review

Spec review: 0 blocking, 0 fixed, 1 notes. Code review: 1 blocking, 1 fixed, 0 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 1. Tokens: 9.4M.
Runs: 9. Cost USD: 3.1741. Agent seconds: 1164.
Assessment: complete

Written by an agent.

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Android adb passthrough rules and execution move from AndroidDriver into PassthroughRules. The driver delegates passthrough and device TCP adb execution to the new module. The module validates adb arguments, device selection, platform and terminal context, and routes commands through the configured adb server or physical-device callbacks. New tests cover the extracted rules and execution. The Android module re-exports the passthrough tool list and refusal constants.

Suggested reviewers: leonardoxr

Merge Risk: Minimal · up to e5c3c

This is a behavior-preserving extraction of Android adb passthrough logic into its own module. No actionable merge-blocking risk was found. The remaining gap is a missing test for the bare-shell check on the physical-device path, which the base also lacked, so it can be handled as a follow-up.

Security architecture risk: Minimal · up to e5c3c

The extraction preserves the existing command restrictions, device selection, server routing, and physical-device checks. No material security risk was found to be introduced or worsened by this PR.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The extraction preserves the existing exposure scope rather than creating a new isolation boundary. Commands without a selected device retain configured-server scope; addressed device commands retain serial-scoping checks; physical commands retain their existing device-ID routing. No additional execution authority or downstream caller was identified.

Trust Boundaries and Controls

  • observed — Caller-controlled virtual adb arguments still pass through the existing global-flag allowlist and destructive-command refusals before command construction. Addressed device operations still reject conflicting selectors. These controls predate the PR and remain on the delegated path.

Resilience and Maintainability Implications

  • observed — The unchanged device-TCP consumer retains its cleanup ownership across the new delegation: reverse-creation failure closes the listener, removal disables new connections first, and failed removal retains the tracked port for recovery. The extracted runAdbOn preserves routing, timeouts, and error propagation supporting those transitions.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names the main change: the adb refusal rules now live in passthrough-rules.ts as part of an android refactor. The changeset matches this. A new file passthrough-rules.ts holds the rules and …
Description check Passed The description is related to the changeset. It cites issue #1267, reports test results for src/drivers/android, and lists checks on passthrough-rules.ts, index.ts, and the source-hygiene line counts.…
Linked Issues check Passed Issue #1267 is directly linked and has coding requirements. The PR adds state-free PassthroughRules in src/drivers/android/passthrough-rules.ts with options and callbacks. AndroidDriver delegate…
Out of Scope Changes check Passed The changed files support issue #1267. The new implementation, moved and added tests, Android module documentation, and source-hygiene updates all support the extraction and its required constraints. …
Full details: Title check

Explanation

The title names the main change: the adb refusal rules now live in passthrough-rules.ts as part of an android refactor. The changeset matches this. A new file passthrough-rules.ts holds the rules and the constants, and index.ts delegates to it.

Full details: Description check

Explanation

The description is related to the changeset. It cites issue #1267, reports test results for src/drivers/android, and lists checks on passthrough-rules.ts, index.ts, and the source-hygiene line counts. Those items match the files in the summary.

Full details: Linked Issues check

Explanation

Issue #1267 is directly linked and has coding requirements. The PR adds state-free PassthroughRules in src/drivers/android/passthrough-rules.ts with options and callbacks. AndroidDriver delegates passthrough and device execution through this part. The part does not import index.ts. The extracted tests cover the refusal rules, serial fill-in, platform checks, and execution behavior. The root driver test remains for driver-level passthrough behavior. The PR updates the Android module manual and source-hygiene limits, preserves exports and the passthrough entry point, and reports passing Android unit tests and pnpm check.

Full details: Out of Scope Changes check

Explanation

The changed files support issue #1267. The new implementation, moved and added tests, Android module documentation, and source-hygiene updates all support the extraction and its required constraints. The reviewed changes do not demonstrate unrelated user-visible behavior, contract, or event changes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 9 functions across 4 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: c1fe0ef1-21b3-424b-ad1c-46361a706db5
Commits

Reviewing files that changed from the base of the PR and between 974d78c and e5c3ca7.

Files selected for processing: 6
  • src/drivers/android/AGENTS.md
  • src/drivers/android/index.test.ts
  • src/drivers/android/index.ts
  • src/drivers/android/passthrough-rules.test.ts
  • src/drivers/android/passthrough-rules.ts
  • src/source-hygiene.test.ts
Files with no reviewable changes: 1
  • src/drivers/android/index.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@V3RON
V3RON added this pull request to stack #1275 November 4, 2026 19:33
@V3RON

V3RON commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: 1d879ba
Round fix-check: e5c3ca7

Runs: 9. Cost USD: 3.1741. Agent seconds: 1164.
Tokens input 236, output 62266, cache read 6533069, cache write 538523.
- build implementer: claude-sonnet-5-5 253 s $0.6466
- audit implementer: claude-sonnet-5-5 129 s $0.2577
- fix implementer: claude-sonnet-5-5 55 s $0.1409
- review 1 reviewer: claude-sonnet-5-5 355 s $0.3698
- review 1 spec: claude-sonnet-5-5 32 s $0.2289
- review 1 code both: claude-opus-5-5 218 s $1.1027
- review 1 claims: claude-sonnet-5-5 37 s $0.1485
- fix 1 implementer: claude-sonnet-5-5 37 s $0.1394
- review fix-check reviewer: claude-sonnet-5-5 48 s $0.1396
Finding outcomes: {"fixed":1,"nonblocking":1}. Classes: {"architecture 17":1,"weak test assertions":1}.
{"findings":[{"id":"R1","role":"code","class":"architecture 17","outcome":"fixed","path":"src/drivers/android/passthrough-rules.test.ts","round":"1","fix":"e5c3ca790f34404de12a305ece5f727955455d66"},{"id":"R2","role":"spec","class":"weak test assertions","outcome":"nonblocking","path":"src/drivers/android/passthrough-rules.test.ts","round":"1"}]}

Written by an agent.

@V3RON

V3RON commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Review notes

Not blocking, not verified. Each is one reviewer's claim.

  • spec: src/drivers/android/passthrough-rules.test.ts two cases differ from the issue's "keeping its claim and cases": the fill-in test gained forward tcp:8080 tcp:8080, and the kill-server case now uses -s emulator-5554 so the scope-flag rule cannot refuse it first. Both strengthen the tests and change no behaviour.
  • code: src/drivers/android/index.ts the isBareShell callback wired to the phone's handler is untested: replacing it with () => false keeps every root test green. The base had no such test either.

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review November 4, 2026 20:00
@V3RON
V3RON merged commit 8562cb2 into main Nov 4, 2026
57 checks passed
@V3RON
V3RON deleted the task/1267 branch November 4, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android driver: passthrough-rules.ts holds the adb refusal rules

1 participant