Skip to content

iOS: a quick seed is replaced by its settled copy, and each plain lease counts against its seed #1747

Done

Description

@V3RON

Part of #1732.

Scope

An iOS worker settles its quick seeds in the background: after a kind's first lease, once the worker is quiet, the seed is replaced by a settled copy, and later iOS leases boot about a third quieter. doctor --json shows each iOS seed's settled and leases.

If this goes wrong, a user would notice an iOS lease handed a device that still names another simulator's folders, a seed missing after a restart mid-settle, or an orphan simulator left in the sources set.

Technical spec

Commit fb42676.

Rows

  • Behaviours: B14, B15, B16, B17
  • Stored state: S1, S2
  • Interfaces: I1, I2, I3, I10, I11 (implements or uses)
  • Existing code: X1, X2, X3, X4, X5, X6, X7

Facts

# Fact Source
F1 ios_source_data's state CHECK allows making and ready only, and the schema owner is at version 4 src/drivers/ios/source-data.ts:17, :45
F2 One ready seed per spec_key is a partial unique index src/drivers/ios/source-data.ts:30-31
F3 #swapLineage reads filesOf(seed.sourceId) after the clone's turn src/drivers/ios/seeds.ts:508-516; fixed by #1731
F4 A boot is simctl boot, bootstatus -b, then listapps polled every 1 s on one deadline src/drivers/ios/simulator-boot.ts:33-45, :88-90

Modules touched

Searches: ios_source_data, findReadySeed, makingRowsOfKindBefore, makingRowsNotMadeBy, #swapLineage, destroySeedsOf, listSources, bootAndWait. Files: src/drivers/ios/seeds.ts, source-data.ts, index.ts, the driver's AGENTS.md, and the iOS create options in src/daemon/driver-discovery.ts (the processTable #1746 adds to the context).

Rules in play

  • ios manual "Seeds (ADR 0061)": the settle copy goes through the same mark, LaunchServices drop and lineage swap as a provision; the new seed is recorded after flushing its WALs.
  • ADR 0076 §1: no source boots; the copy boots. §2: the new seed's lineage is [copy UDID, ...seed lineage].
  • ADR 0090 §3: the swap is one transaction; the old seed is deleted in its turn.
  • ADR 0048: under deviceSet: default the copy is marked and its clipboard sync turned off, as a throwaway is.
  • drivers manual "A driver imports only core and ports": readings go through the ProcessTable port.

Tests

Driven through IosSimctlDriver with the fake simctl harness, modelled on src/drivers/ios/index-seed-provision.test.ts and index-save-source-lifecycle.test.ts.

  • B14: a plain lease adds one to its seed's lease count: plain provision; a baseline copy; a clone that fails; a seed from before this feature; a first lease of a new kind
  • B15: settleSeed replaces a quick seed with its settled copy: idle at 181 s; idle only at 900 s; busy at 900 s; boot times out; aborted mid-reading; not a ready quick seed; a clone of the old seed in flight; deviceSet: default; a process-table read that fails is skipped and the 900 s cap still ends the wait (decided in delivery, pending the maintainer); the quick seed's delete fails after the swap committed: settleSeed answers the new seed, logs the failure, and the retired row and its simulator stay for the next start's sweep (decided in delivery, pending the maintainer)
  • B16: a restart's leftovers of a settle are swept: another process's settle row; a retired quick seed's row; a make of the kind during this process's settle; removeComponent of a runtime ends its settle row and its retired quick seed's row (X5; decided in delivery, pending the maintainer)
  • B17: ensureSeed: fresh; stale; none; two calls at once

Done when

  • pnpm test:changed passes, with the B14 to B17 cases above.
  • pnpm typecheck passes.
  • The iOS driver manual's Seeds rules say what a settle does.
  • On a Mac, scripts/slow-e2e.sh e2e/slow-ios-source-isolation.test.ts passes (copies still name only their own folders).

Out of scope

Depends on

Written by an agent.

Activity

  1. added
    task:draft
    on Nov 19, 2026
  2. added
    task:ready
    and removed
    task:draft
    on Nov 19, 2026
  3. self-assigned this
    on Nov 19, 2026
  4. 8 remaining items

  5. github-actions commented on Nov 23, 2026

    @github-actions
    Contributor

    Claim released: no activity for 3 days. The label is unchanged; the next agent starts from the branch and the last handoff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    task:ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions