Skip to content

refactor(android): ownership.ts, the one check before a stop, load or destroy - #1277

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

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

Conversation

@V3RON

@V3RON V3RON commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1265

Status

Implement: done (705/705 green, 1 skipped) Review: fix-check pass (CI Fallow CRAP fixed in f51a3aa, hygiene entry in d35be76) 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: the base's count, no test added
  • src/drivers/android/ownership.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; 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 spec review walked the F1 list; the field is #ownership
  • 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. — fix-check: index.ts entry 3389 equals wc -l at d35be76
  • pnpm check passes. — push hooks including Fallow passed on the head; CI runs it before the gate

Assumptions

  • Assumption: one query for all callers — avdPathOf uses runOrThrow with the 5 s timeout (both old constants were 5 s); serialIsOwn and the stop-unowned caller catch its throw, so their handling is unchanged.

Review

Spec review: 1 blocking, 1 fixed, 0 notes. Code review: 0 blocking, 0 fixed, 0 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 2. Tokens: 7.4M.
Runs: 10. Cost USD: 2.0275. Agent seconds: 712.
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 emulator ownership probes and path comparisons move from AndroidDriver into a new Ownership helper. The driver constructs the helper and delegates device, serial, AVD-path, cleanup, shutdown, and readiness checks to it. The helper uses timed ADB queries and compares reported and expected paths. The Android driver file map and its source-hygiene line limit are also updated.

Suggested reviewers: leonardoxr

Merge Risk: Minimal · up to d35be

The checked ownership safeguards remain intact; no merge-blocking risk was identified.

Security architecture risk: Low · up to d35be

Ownership checks retain their existing fail-closed behavior, and destructive cleanup retains its ordering safeguards. No expanded access or destructive authority was identified. Remaining coverage uncertainty limits confidence in a minimal-risk assessment.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The assessed security exposure is selection of the intended emulator and its AVD data before readiness, shutdown, or deletion. No broader caller authority was identified through the extracted helper; enforcement remains within the Android driver.

Trust Boundaries and Controls

  • observed — ADB responses cross the emulator identity boundary before lifecycle authority is exercised. Ownership does not cache those decisions: mutation gates query the current serial again, while readiness rejects a mismatched AVD path. These controls preserve the previous protection against a serial being reassigned to another emulator.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
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: 4 passed
Check name Status Explanation
Title check Passed The title names the refactor of Android emulator ownership checks into ownership.ts, which matches the changeset: a new Ownership class in src/drivers/android/ownership.ts, with index.ts delegating to…
Description check Passed The description is related to the changeset. It links issue #1265, reports test and check results, names the new ownership.ts file and the #ownership field, and describes the source-hygiene line-count…
Linked Issues check Passed [#1265] The PR adds src/drivers/android/ownership.ts and moves the ownership probe, AVD path query, path comparison, and confirmation logic into Ownership. AndroidDriver constructs the part and …
Out of Scope Changes check Passed The changed files support [#1265]. ownership.ts implements the requested part, index.ts delegates to it, AGENTS.md documents the file map, and src/source-hygiene.test.ts updates the required l…
Full details: Title check

Explanation

The title names the refactor of Android emulator ownership checks into ownership.ts, which matches the changeset: a new Ownership class in src/drivers/android/ownership.ts, with index.ts delegating to it. The title is long and uses the issue's wording ("the one check before a stop, load or destroy"), but the main change is clearly stated.

Full details: Description check

Explanation

The description is related to the changeset. It links issue #1265, reports test and check results, names the new ownership.ts file and the #ownership field, and describes the source-hygiene line-count update. It is mostly process status and checklist text, but it describes parts of the change.

Full details: Linked Issues check

Explanation

[#1265] The PR adds src/drivers/android/ownership.ts and moves the ownership probe, AVD path query, path comparison, and confirmation logic into Ownership. AndroidDriver constructs the part and delegates ownership checks to it. The summary reports the 5-second timeout, fail-closed handling, path parsing, exact and realpath comparisons, and unchanged caller behavior. The driver keeps the #ownership field and required delegation members. The source-hygiene limit is updated to 3389 lines. The PR reports passing Android unit tests and pnpm check.

Full details: Out of Scope Changes check

Explanation

The changed files support [#1265]. ownership.ts implements the requested part, index.ts delegates to it, AGENTS.md documents the file map, and src/source-hygiene.test.ts updates the required line limit. The available summary shows no contract, event, unrelated task, or behavior changes.

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.

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: 435dabf9-bac2-449c-91a2-9b6e6e5fbe0b
Commits

Reviewing files that changed from the base of the PR and between 46779b2 and d35be76.

Files selected for processing: 3
  • src/drivers/android/index.ts
  • src/drivers/android/ownership.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; 4 remain after this review.

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

V3RON commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: 46779b2
Round 2: f51a3aa
Round fix-check: d35be76

Runs: 10. Cost USD: 2.0275. Agent seconds: 712.
Tokens input 153, output 41523, cache read 2816217, cache write 455067.
- build implementer: claude-sonnet-5-5 140 s $0.2929
- audit implementer: claude-sonnet-5-5 48 s $0.1637
- review 1 reviewer: claude-sonnet-5-5 161 s $0.299
- review 1 spec: claude-sonnet-5-5 31 s $0.1645
- review 1 code behaviour: claude-opus-5-5 66 s $0.3857
- review 1 claims: claude-sonnet-5-5 20 s $0.1163
- fix fix-check implementer: claude-sonnet-5-5 105 s $0.2281
- review 2 reviewer: claude-sonnet-5-5 79 s $0.1929
- fix 2 implementer: claude-sonnet-5-5 33 s $0.0757
- review fix-check reviewer: claude-sonnet-5-5 29 s $0.1087
Finding outcomes: {"fixed":1}. Classes: {"Done when 4: hygiene entry not equal to line count":1}.
{"findings":[{"id":"R1","role":"spec","class":"Done when 4: hygiene entry not equal to line count","outcome":"fixed","path":"src/source-hygiene.test.ts","round":"2","fix":"d35be7641712f4dad2d9c210d2bde23fdfbf2ee5"}]}

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review November 4, 2026 19:14
@V3RON
V3RON merged commit a29e3dc into main Nov 4, 2026
57 checks passed
@V3RON
V3RON deleted the task/1265 branch November 4, 2026 23:28
V3RON added a commit that referenced this pull request Nov 4, 2026
#1278)

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)

- [x] `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)
- [x] `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
- [x] `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
- [x] 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
- [x] `pnpm check` passes. — CI green at 974d78c after #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.*
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: ownership.ts, the one check before a stop, load or destroy

1 participant