You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(android): adb-tools.ts, the leaf part for env, commands and device folders - #1276
Implement: done (716/716 green, 1 skipped as on base) Review: round 2 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 and audit ran it: 716 passed, 1 skipped, the base's count (no test added)
src/drivers/android/adb-tools.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 the 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. — audit and code review walked the F1 list; the field is #adbTools
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. — audit fixed the index.ts entry to 3489 and ran the hygiene test green
pnpm check passes. — commit and push hooks passed on the head; CI runs it before the gate
No actionable comments were generated in the recent review.
Walkthrough
The change adds AdbTools for Android command execution, environment setup, device-data validation, AVD path resolution, serial scanning, emulator version lookup, and delays. AndroidDriver initializes the helper and delegates its source, provisioning, lifecycle, discovery, and readiness operations to it. The source-hygiene limit for src/drivers/android/index.ts is reduced.
Suggested reviewers:leonardoxr
Merge Risk: Minimal · up to 84b16
The extraction preserves the inspected physical-device behavior, with no identified issue blocking merge.
Security architecture risk: Minimal · up to 84b16
The refactor preserves existing command isolation, device validation, and deletion safeguards. No new caller, privilege, or security exposure was identified.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — Effective authority remains local Android tool execution and AVD deletion under the existing process identity. The helper receives the same configured execution dependencies, and current callers do not expand its authority to another service or environment.
Trust Boundaries and Controls
observed — Scoped commands retain the configured adb server port and AVD root, with explicit environment overrides preserved for existing special-purpose calls. Moving execution into AdbTools does not introduce an additional reachable command caller.
Resilience and Maintainability Implications
observed — The unchanged destruction-boundary test exercises successful deletion, avoidance of killing a neighboring emulator, refusal on unreadable ownership, deletion failure, and rejection of outside-root or malformed data. This supplies counterevidence to a newly weakened destruction boundary, but does not establish external legacy-tool idempotency.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% 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. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title names the change: an Android refactor that moves env handling, command execution, and device-folder utilities into a new adb-tools.ts module. The raw summary confirms adb-tools.ts adds AdbTo…
Description check
The description links issue #1264 and reports the test, dependency-cruiser, source-hygiene, and check status for the refactor. It also covers the root field naming and review rounds. It relates direct…
Linked Issues check
Directly linked issue #1264 requires an Android part, adb-tools.ts, that owns no state, is built by AndroidDriver with an options object, and takes over the scoped environment, command execution, devi…
Out of Scope Changes check
Every changed file maps to #1264: - src/drivers/android/adb-tools.ts: the moved code that #1264 requires. - src/drivers/android/index.ts: the constructor wiring, the call-site delegation, the imports,…
Full details: Title check
Explanation
The title names the change: an Android refactor that moves env handling, command execution, and device-folder utilities into a new adb-tools.ts module. The raw summary confirms adb-tools.ts adds AdbTools for scoped environment setup, command execution, AVD folder and data checks, and device scanning, and index.ts delegates to it. The title is specific and accurate, though it uses a conventional-commit prefix and a long phrase.
Full details: Description check
Explanation
The description links issue #1264 and reports the test, dependency-cruiser, source-hygiene, and check status for the refactor. It also covers the root field naming and review rounds. It relates directly to the changeset, so the lenient check passes. It contains agent-process details such as cost and run counts that do not describe the code change, but these do not make the description off-topic.
Full details: Linked Issues check
Explanation
Directly linked issue #1264 requires an Android part, adb-tools.ts, that owns no state, is built by AndroidDriver with an options object, and takes over the scoped environment, command execution, device-folder and driver-data checks, adb-device scanning, bounded adb-shell reads, emulator-version lookup, and the wait.
src/drivers/android/adb-tools.ts exists. It exports AdbToolsOptions and class AdbTools. Its only field is the injected readonly #options. It has no mutable state.
The root builds the part in its constructor: this.#adbTools = new AdbTools({ adb, adbServerPort, baseEnv: options.env, clock, deviceRoot, emulator, processRunner }).
Each required capability exists in the part: env() (scoped ANDROID_ADB_SERVER_PORT and ANDROID_AVD_HOME), runOrThrow() (throws DriverCrashError on nonzero exit), dataFor(), avdFolder(), scanSerials(), shellOrUndefined(), emulatorVersion(), delay(). Also deviceIdOf(), serialFor(), ADB_DEVICES_TIMEOUT_MS and SEED_AVD_NAME.
The root delegates. The diff replaces each former #env() call with this.#adbTools.env(), and each #runOrThrow, #dataFor, #avdFolder, #emulatorVersion and #delay call with the matching part call. The root imports ADB_DEVICES_TIMEOUT_MS, SEED_AVD_NAME, deviceIdOf and serialFor from the part. The local definitions of the #env body and the timeout and seed constants are removed.
Env scope is kept. destroyLegacy still uses { ...this.#baseEnv, ANDROID_AVD_HOME: this.#legacyAvdHome }, which is unchanged in the diff. The physical-handler construction is not in the visible hunks, so it keeps baseEnv.
Behavior is unchanged in the visible hunks. Command arguments, timeouts and messages match the removed root code. Only call sites were rewritten.
Unresolved uncertainty: the index.ts diff is truncated at 16000 bytes after the hunk near line 1798. I could not view the removal of the remaining root definitions (#runOrThrow, #dataFor, #avdFolder, #scanAdbSerials, #adbShellOrUndefined, #emulatorVersion, #delay, deviceIdOf, serialFor) or the sdkmanager call site in that part. The PR summary states that these local implementations were removed. The root also imports deviceIdOf and serialFor, so a retained duplicate definition would be a compile error. The author reports pnpm check passed. I did not verify these points directly.
Full details: Out of Scope Changes check
Explanation
Every changed file maps to #1264:
src/drivers/android/adb-tools.ts: the moved code that #1264 requires.
src/drivers/android/index.ts: the constructor wiring, the call-site delegation, the imports, and the removal of the moved definitions. Multi-line reformatting of runOrThrow calls follows from the renamed call target.
src/drivers/android/AGENTS.md: one Files row for adb-tools.ts. The issue requires this documentation row (manual limit of 150 lines, F7).
src/source-hygiene.test.ts: the shrink-only Android baseline changes from 3573 to 3489. The issue requires this update.
No change adds behavior, alters a message or timeout, changes files on disk, or touches the other #1259 parts. The new part does not import index.ts. No test file was added, which matches the issue. Residual uncertainty is the same truncated index.ts diff noted in the linked-issue assessment. It does not show an unrelated change in the visible hunks.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% 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 1 functions across 3 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: 94f5bbe6-c4be-4ac6-946c-1bad8641da30
Commits
Reviewing files that changed from the base of the PR and between 66fd734 and 84b16b2.
Files selected for processing: 4
src/drivers/android/AGENTS.md
src/drivers/android/adb-tools.ts
src/drivers/android/index.ts
src/source-hygiene.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Runs: 9. Cost USD: 2.5442. Agent seconds: 930.
Tokens input 194, output 55068, cache read 4033535, cache write 456034.
- build implementer: claude-sonnet-5-5 187 s $0.42
- audit implementer: claude-sonnet-5-5 80 s $0.2264
- review 1 reviewer: claude-sonnet-5-5 278 s $0.2875
- review 1 spec: claude-sonnet-5-5 27 s $0.1862
- review 1 code both: claude-opus-5-5 178 s $0.8994
- review 1 claims: claude-sonnet-5-5 42 s $0.151
- fix 1 implementer: claude-sonnet-5-5 43 s $0.1297
- review 2 reviewer: claude-sonnet-5-5 76 s $0.1477
- review 2 claims: claude-sonnet-5-5 19 s $0.0963
Finding outcomes: {"fixed":1}. Classes: {"architecture 17 moved why: false":1}.
{"findings":[{"id":"R1","role":"claims","class":"architecture 17 moved why: false","outcome":"fixed","path":"src/drivers/android/adb-tools.ts","round":"1","fix":"84b16b2a2f8b82c4fb820c810714eed4998a9ccd"}]}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1264
Status
Implement: done (716/716 green, 1 skipped as on base) Review: round 2 pass Hardware: n/a Gate: waiting for the stack
pnpm exec vitest run --project unit src/drivers/androidpasses, and its number of tests is the base's plus the tests this task adds. — build and audit ran it: 716 passed, 1 skipped, the base's count (no test added)src/drivers/android/adb-tools.tsexists, and only files insrc/drivers/android/import it: dependency-cruiser'spast-indexrule (.dependency-cruiser.mjs:36-37), run bypnpm check, fails any import of it from outside the folder. — audit checked the importers; the push hook ran dependency-cruisersrc/drivers/android/index.tsdefines none of the F1 names, except eachDrivermethod (and otherAndroidDrivermember 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. — audit and code review walked the F1 list; the field is#adbToolssrc/source-hygiene.test.ts, each Android entry equals its file's new line count, or is gone when the file is within its limit. — audit fixed the index.ts entry to 3489 and ran the hygiene test greenpnpm checkpasses. — commit and push hooks passed on the head; CI runs it before the gateAssumptions
none
Review
Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 0 blocking, 0 fixed, 0 notes. Claims review: 1 blocking, 1 fixed, 0 notes.
Rounds: 2. Tokens: 3.7M.
Runs: 9. Cost USD: 2.5442. Agent seconds: 930.
Assessment: complete
Written by an agent.