Skip to content

refactor(android): console-ports.ts owns the console port reservations - #1278

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

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

Conversation

@V3RON

@V3RON V3RON commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1266

Status

Implement: done (684/684 green, 1 skipped as on base) Review: round 1 pass Hardware: n/a Gate: waiting for the stack
Review: fix-check pass (stack merge 974d78c)

  • 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. — audit ran it on the branch and the base: 684 passed, 1 skipped on both (no test added)
  • src/drivers/android/console-ports.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 searched the importers: index.ts only; 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. — spec and code review walked the F1 list; the field is #consolePorts; five seam mutations each failed a root test
  • 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 3270; hygiene test green
  • pnpm check passes. — CI green at 974d78c after refactor(android): ownership.ts, the one check before a stop, load or destroy #1277's Fallow fix reached this branch

Assumptions

  • Assumption: where portAllocatorFor is called — the root calls it and passes the allocator to ConsolePorts, as the issue says; PortAllocator stays private to the part.

Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 0 blocking, 0 fixed, 0 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 1. Tokens: 6.0M.
Runs: 6. Cost USD: 1.9857. Agent seconds: 767.
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

The Android driver now delegates console-port allocation, lookup, and release to a dedicated component. The component owns the runner-scoped allocator and uses ADB output and TCP probes when selecting a port. The device-state type now resides in the Android data module. Driver boot, readiness, save, and destroy paths use the component for port operations.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 974d7

The refactor preserves the reviewed console-port allocation and lifecycle behavior, with no established merge-blocking risk.

Security architecture risk: Minimal · up to 974d7

The extraction preserves reservation sharing, device identity and cleanup ordering. No material security risk was found to be introduced or worsened, and the new component does not create an externally exposed entrypoint.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed mutable-state scope is the existing in-process reservation pool shared by Android drivers using the same ProcessRunner. The extraction preserves that sharing boundary rather than introducing cross-service or persistent reservation authority.

Trust Boundaries and Controls

  • observed — Reserved-port mapping continues to supply the device identity used by destruction. AndroidDriver retains lifecycle control, and its shutdown path still checks that the serial belongs to the expected device before issuing an emulator kill command.

Resilience and Maintainability Implications

  • observed — A failed makeReady startup retains its reservation while clearing the process handle, and destruction can fail before reaching reservation release. These failure-containment characteristics already exist on the PR base; the extraction preserves them rather than introducing or worsening them.
Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Linked Issues check Warning #1266 requires pnpm check to pass. The current PR description reports that CI Fallow still fails on the reviewed head. The Android unit tests, console-ports.ts extraction, delegation, import bound… Resolve the reported Fallow failure in the stack, update this PR to the passing state, and rerun pnpm check.
Docstring Coverage Warning 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 Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title 'refactor(android): console-ports.ts owns the console port reservations' matches the main change. The changeset adds src/drivers/android/console-ports.ts, which owns console-port reservation…
Out of Scope Changes check Passed The changed files support #1266. They add console-ports.ts, move DeviceState to data.ts, update Android-driver delegation and documentation, and update the source-hygiene limit. No unrelated con…
Description check Passed The description is related to the changeset. It references issue #1266, the Android console-port refactor, the test and hygiene-test results, the console-ports.ts import boundary, the index.ts seam, a…
Full details: Title check

Explanation

The title 'refactor(android): console-ports.ts owns the console port reservations' matches the main change. The changeset adds src/drivers/android/console-ports.ts, which owns console-port reservation and per-runner allocation, and index.ts now delegates to it via ConsolePorts. The title is specific and concise, and it follows a conventional commit style.

Full details: Out of Scope Changes check

Explanation

The changed files support #1266. They add console-ports.ts, move DeviceState to data.ts, update Android-driver delegation and documentation, and update the source-hygiene limit. No unrelated contract, event, or non-Android-part changes are identified.

Full details: Description check

Explanation

The description is related to the changeset. It references issue #1266, the Android console-port refactor, the test and hygiene-test results, the console-ports.ts import boundary, the index.ts seam, and the source-hygiene line count. It names the code it describes, so it is not off-topic. It is also not vague or generic.

Full details: Linked Issues check

Explanation

#1266 requires pnpm check to pass. The current PR description reports that CI Fallow still fails on the reviewed head. The Android unit tests, console-ports.ts extraction, delegation, import boundary, and source-hygiene entry have supporting evidence, but the required full check does not pass.

Resolution

Resolve the reported Fallow failure in the stack, update this PR to the passing state, and rerun pnpm check.

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 4 files.

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: 58115523-6351-4e40-8d04-9029d3799d7c
Commits

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

Files selected for processing: 2
  • src/drivers/android/index.ts
  • src/source-hygiene.test.ts
Files with no reviewable changes: 1
  • src/drivers/android/index.ts

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

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

V3RON commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: 866e2f2
Round fix-check: 974d78c

Runs: 8. Cost USD: 2.2642. Agent seconds: 887.
Tokens input 216, output 43234, cache read 4980341, cache write 412067.
- build implementer: claude-sonnet-5-5 199 s $0.4317
- audit implementer: claude-sonnet-5-5 86 s $0.21
- review 1 reviewer: claude-sonnet-5-5 299 s $0.418
- review 1 spec: claude-sonnet-5-5 23 s $0.1683
- review 1 code both: claude-opus-5-5 122 s $0.6066
- review 1 claims: claude-sonnet-5-5 38 s $0.1511
- fix fix-check implementer: claude-sonnet-5-5 60 s $0.1325
- review fix-check reviewer: claude-sonnet-5-5 60 s $0.146
Finding outcomes: {}. Classes: {}.
{"findings":[]}

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review November 4, 2026 19:28
@V3RON
V3RON merged commit 0fdd03e into main Nov 4, 2026
71 of 73 checks passed
@V3RON
V3RON deleted the task/1266 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: console-ports.ts owns the console port reservations

1 participant