Skip to content

iOS: a failed saveSource drops the error of deleting its half-made baseline clone #1804

Open

Description

@V3RON

src/drivers/ios/seeds.ts:183:

await this.#deleteSeedSimulator(cloneUdid).catch(() => undefined);

#deleteSeedSimulator throws on a non-zero or timed-out simctl delete, and this .catch drops it unlogged. The row is then deleted (seeds.ts:185), so the clone stays in the sources set as an orphan source with no line naming its UDID. doctor still reports it.

Found while triaging #1802.

Written by an agent.

Activity

  1. added
    bug:newReported. An agent may triage it (rule 8); the fast track may set it ready (rule 17).
    on Nov 22, 2026
  2. self-assigned this
    on Nov 22, 2026
  3. V3RON commented on Nov 22, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Confirmed. src/drivers/ios/index-save-source-lifecycle.test.ts, "a failed save whose clone's delete then exits non-zero or times out logs the clone's UDID" (branch bug/1804-repro). The save fails after the clone is made (the row update is refused). Three cases: a delete that works (no warning), one that exits 1, one that times out.

    pnpm exec vitest run --project unit src/drivers/ios/index-save-source-lifecycle.test.ts -t "logs the clone's UDID"
    
    AssertionError: a delete that exits non-zero: expected [] to deeply equal [ Array(1) ]
    - "could not delete baseline clone 00000000-0000-0000-0000-0000000000bb after a failed save: simctl delete 00000000-0000-0000-0000-0000000000bb exited with code 1: Unable to delete"
    + []
    

    Root cause

    Defect. src/drivers/ios/seeds.ts:183 runs this.#deleteSeedSimulator(cloneUdid).catch(() => undefined). #deleteSeedSimulator goes through #deleteIn (seeds.ts:489), which throws on a non-zero exit or a time-out. The .catch drops that error, and seeds.ts:185 then deletes the row. The clone stays in the sources set as an orphan source, and nothing logs its UDID. The symptom only shows later, when doctor lists an orphan nobody can explain.

    Simplest fix

    Log the delete error in the .catch and keep rethrowing the save's own error:

    await this.#deleteSeedSimulator(cloneUdid).catch((deleteError: unknown) => {
      this.#logger?.warn(
        `could not delete baseline clone ${cloneUdid} after a failed save: ${errorMessage(deleteError)}`,
      );
    });
    pnpm exec vitest run --project unit src/drivers/ios   # with the fix
    Test Files  34 passed (34)
         Tests  766 passed | 1 skipped (767)
    

    Alternatives rejected

    • Keep the making row while the clone is undeletable, so another process's sweep deletes it: that changes what doctor shows, and the sweep runs only after a restart.
    • Retry the delete: a timed-out simctl delete may still be running.

    Risk

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: yes
    • No ADR or rule changed: no — the regression test asserts an undocumented log line (testing rule 8)
    • One fix: no — keeping the row for a sweep would change what doctor shows

    Side findings

    Written by an agent.

  4. removed their assignment
    on Nov 22, 2026
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

    bug:newReported. An agent may triage it (rule 8); the fast track may set it ready (rule 17).

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions