Skip to content

fix(ios): a seed simctl no longer knows counts as deleted (#1296) - #1303

Merged
V3RON merged 4 commits into
mainfrom
bug/1296
Nov 5, 2026
Merged

V3RON merged 4 commits into
mainfrom
bug/1296

Conversation

@V3RON

@V3RON V3RON commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1296

Status

Implement: done (audited) Review: passed round 2, R1 fixed Hardware: n/a Gate: not run
Next: gate

Done when

  • A seed already gone from simctl (Invalid device, exit 148) counts as deleted: destroySource drops its row, so nuke clears it and iOS leases work again (#deleteSeedSimulator, test destroySource drops the row of a seed simctl no longer knows).
  • The refusal texts tell users to run nuke after a hand delete — sources-set refusal only (device-set-leftovers.ts:45, index.test.ts refusal case); the lease-device refusals keep only their own advice, since nuke cannot drop a hand-deleted lease device (review R1).

Assumptions

  • Assumption: refusal wording — appended one sentence telling users to run simlock nuke --delete-devices again after a hand delete, keeping the existing hand-delete advice.

Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 1 blocking, 1 fixed, 0 notes. Claims review: 1 blocking, 1 fixed, 1 notes.
Rounds: 2. Tokens: 1.4M.
Runs: 8. Cost USD: 1.9395. Agent seconds: 936.
Assessment: complete

Written by an agent.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The iOS driver now treats a finished simctl delete result whose stderr starts with Invalid device: as successful seed deletion. Tests cover this response and verify that the seed row is removed. The leftover refusal message and its test now instruct users to rerun simlock nuke --delete-devices after deleting the remaining simulators. The seed lifecycle documentation reflects the updated behavior.

Suggested reviewers: leonardoxr

Severity of issue fixed: Medium

Merge Risk: Minimal · up to d6472

No actionable merge-blocking risk was established.

Security architecture risk: Low · up to d6472

Cleanup normally becomes recoverable when a seed was already deleted. However, after changing the configured iOS device root, cleanup can discard a simulator’s tracking record while its contents remain in the previous root. This requires configuration changes and does not grant new access or deletion privileges, but weakens cleanup and recovery.

Retained concerns

  • Medium · reliability · inferred: Changing drivers.ios.deviceRoot from custom root A to custom root B while retaining the database can make cleanup forget a source that still exists under A. destroySource retrieves the source’s UDID but not its persisted set_path, then deletes in B/sources. An Invalid device result there now permits removal of the row, whereas the base retained it on deletion failure. This weakens resource ownership and data-cleanup guarantees: current-root discovery cannot find the old simulator, and ordinary nuke does not purge orphans.
Security review details

Security Blast Radius

  • inferred — The identified cleanup failure concerns simulator sources belonging to an instance whose configured root changes while its database is retained. It does not establish cross-user access or privilege escalation; existing directory ownership and permission checks remain relevant containment.

Security Findings and Attack Paths

  • inferred — The supported failure sequence is configuration-driven: create a source under root A, restart with root B and the same database, then destroy the recorded source. Absence in B can authorize metadata deletion without deleting the source in A. No attacker-controlled stderr injection or unauthorized access path was established.

Trust Boundaries and Controls

  • observed — Startup validates the active owned root and refuses known leftovers during default-set switching. These controls validate the selected path, but do not bind existing source rows to their persisted paths when replacing one custom root with another. Deletion still invokes xcrun with an explicit argument array and sources-set scope.

Resilience and Maintainability Implications

  • inferred — Recovery remains possible if the old root is known and available: restore that root and use doctor’s orphan purge. Current-root discovery scans only the current sources directory, while nuke deliberately skips orphans, so repeating nuke under the new root does not recover the stranded source.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly identifies the iOS fix: a seed that simctl no longer knows is treated as deleted. It is concise and related to the main change.
Description check Passed The description accurately explains the Invalid device handling, row removal, recovery instructions, and tests. It is directly related to the changeset.
Linked Issues check Passed Issue #1296 has one directly linked issue and its coding requirements apply. Requirement 1: a seed already gone from simctl must count as deleted, so nuke drops its record. The diff at src/drivers/ios…
Out of Scope Changes check Passed The changed files are src/drivers/ios/index.ts (#deleteSeedSimulator unknown-device handling and the unknownDevice helper), src/drivers/ios/device-set-leftovers.ts (one sentence added to the sources-s…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

Issue #1296 has one directly linked issue and its coding requirements apply. Requirement 1: a seed already gone from simctl must count as deleted, so nuke drops its record. The diff at src/drivers/ios/index.ts changes #deleteSeedSimulator. It runs simctl delete through #invokeSimctl. When the command finishes and stderr matches /^Invalid device:/m (new helper unknownDevice), the method returns without throwing. Other outcomes still go through #checked. The issue states that a throw skips deleteRow in destroySource, so a normal return lets the row drop. Requirement 2: the refusal must give steps that work after a hand delete. The diff at src/drivers/ios/device-set-leftovers.ts appends to the sources-set refusal: run simlock nuke --delete-devices again afterwards so Simlock drops its record. The existing set-back, nuke, purge, and switch steps remain. The current PR description states that the lease-device refusals keep only their own advice, which matches the issue scope. Test coverage is stated as a destroySource case for an unknown seed and a refusal case in index.test.ts. Limitation: I did not read the destroySource body directly because the file read was truncated. The row-drop conclusion relies on the diff and the issue's code reading. The reverse simlock-to-default direction needs no change, as the issue states.

Full details: Out of Scope Changes check

Explanation

The changed files are src/drivers/ios/index.ts (#deleteSeedSimulator unknown-device handling and the unknownDevice helper), src/drivers/ios/device-set-leftovers.ts (one sentence added to the sources-set refusal), src/drivers/ios/index.test.ts (tests for the unknown-seed case and the refusal text), and src/drivers/ios/AGENTS.md (documents the destroySource behavior for an Invalid device seed). Each change supports issue #1296: the code change implements the seed-already-deleted requirement, the message change implements the workable-recovery requirement, and the tests and documentation cover those two changes. No unrelated behavior change appears in the reviewed diff. The raw summary's claim that the own-set and Xcode-set refusals were changed is not present at the reviewed head, which is consistent with the current PR description. No out-of-scope change was found.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. 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.)

  • 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: 79a65cab-d30e-44c4-890f-8c4939dd5c85
Commits

Reviewing files that changed from the base of the PR and between 5069c24 and d6472d2.

Files selected for processing: 4

  • src/drivers/ios/AGENTS.md
  • src/drivers/ios/device-set-leftovers.ts
  • src/drivers/ios/index.test.ts
  • src/drivers/ios/index.ts

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

@V3RON

V3RON commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: 06164ef
Round 2: d6472d2

Runs: 8. Cost USD: 1.9395. Agent seconds: 936.
Tokens input 151, output 40389, cache read 3005702, cache write 350151.
- build implementer: claude-sonnet-5-5 189 s $0.2637
- audit implementer: claude-sonnet-5-5 110 s $0.1864
- review 1 reviewer: claude-sonnet-5-5 280 s $0.2451
- review 1 spec: claude-sonnet-5-5 14 s $0.0927
- review 1 code both: claude-opus-5-5 177 s $0.7187
- review 1 claims: claude-sonnet-5-5 60 s $0.2071
- fix 1 implementer: claude-sonnet-5-5 59 s $0.1131
- review 2 reviewer: claude-sonnet-5-5 47 s $0.1127
Finding outcomes: {"duplicate":1,"fixed":1}. Classes: {"false statement in error message":2}.
{"findings":[{"id":"R1","role":"code+claims","class":"false statement in error message","outcome":"fixed","path":"src/drivers/ios/device-set-leftovers.ts","round":"1","fix":"d6472d2180444392466e8ef432b2f4b72d7a28cc"},{"id":"R2","role":"claims","class":"false statement in error message","outcome":"duplicate","canonicalId":"R1","path":"src/drivers/ios/device-set-leftovers.ts","round":"1"}]}

Written by an agent.

@V3RON

V3RON commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Review notes

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

  • claims: src/drivers/ios/device-set-leftovers.ts:45 the sources-set refusal still says to run simlock nuke --delete-devices again afterwards; kept on purpose, since that set holds only seeds, which nuke now drops.

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review November 5, 2026 11:05
@V3RON
V3RON merged commit 8106e07 into main Nov 5, 2026
69 of 72 checks passed
@V3RON
V3RON deleted the bug/1296 branch November 5, 2026 11:19
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.

Switching drivers.ios.deviceSet back gets stuck on a leftover seed, and the refusal's advice breaks iOS

1 participant