Skip to content

iOS destroySource leaves a baseline's launchd overrides folder behind #1780

Done

Description

@V3RON

Found by reading the code while triaging #1731; not seen on a device.

saveSource copies the saved-from lease's launchd overrides to the baseline's UDID (src/drivers/ios/seeds.ts:172, slimBoot.copyOverrides). The folder lives under the overrides root, outside the device set (iOS manual: "the overrides folder lives outside the device set, so destroy removes it itself").

destroySource (seeds.ts:197-212) deletes the simulator (#deleteSeedSimulator, :463-466: shutdown, simctl delete) and the row, but never calls slimBoot.removeOverrides. Only lease destroy and destroyLegacy do (src/drivers/ios/index.ts:425, :460). So each destroyed slim-saved baseline leaves one <overridesRoot>/<udid> folder that nothing lists or deletes. The same holds for #removeLeftover and a failed save's cleanup (seeds.ts:182).

Expected: deleting a source removes its overrides folder too, as deleting a lease does.

Written by an agent.

Activity

  1. added
    bug:new
    on Nov 19, 2026
  2. self-assigned this
    on Nov 20, 2026
  3. V3RON commented on Nov 20, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Confirmed: a defect. Every path that deletes a baseline's simulator leaves <overridesRoot>/com.apple.CoreSimulator.SimDevice.<udid> behind. Branch bug/1780-repro, src/drivers/ios/index-seed-sources.test.ts, "deleting a baseline's simulator removes its launchd overrides folder, through destroySource, the leftover sweep and a failed save, and a failed delete keeps it".

    pnpm exec vitest run --project unit src/drivers/ios/index-seed-sources.test.ts -t "launchd overrides folder"
    
        "a save that fails after the clone":            { deleted: true, folderKept: true  (expected false) }
        "destroySource":                                { deleted: true, folderKept: true  (expected false) }
        "destroySource whose delete fails":             { deleted: true, folderKept: true }
        "the sweep of another process's making row":    { deleted: true, folderKept: true  (expected false) }
    

    Root cause

    src/drivers/ios/seeds.ts:466 #deleteSeedSimulator runs simctl shutdown and simctl delete in the sources set and stops there. saveSource copies the lease's overrides to the clone (seeds.ts:173), and that folder is outside the device set, so simctl delete leaves it. Lease destroy and destroyLegacy call slimBoot.removeOverrides (index.ts:455, :490). No seed-side deletion does: destroySource (:198), #removeLeftover (:444) and the failed save's cleanup (:183) all go through #deleteSeedSimulator.

    Simplest fix

    Remove the folder in the one shared delete, after #deleteIn succeeds. An Invalid device answer counts as success there, so the folder also goes when the simulator was deleted by hand.

    // seeds.ts:466
    async #deleteSeedSimulator(udid: string): Promise<void> {
      await this.#simctl.bestEffortShutdown(udid, this.#sourcesSet);
      await this.#deleteIn(udid, this.#sourcesSet);
      await this.#slimBoot.removeOverrides(udid);
    }
    pnpm exec vitest run --project unit src/drivers/ios/
     Test Files  34 passed (34)
          Tests  766 passed | 1 skipped (767)
    

    Alternatives rejected

    • One removeOverrides call in each of the three callers: three places to forget, and the next caller would forget again.
    • Remove the folder before simctl delete: a failed delete would keep a baseline that boots without its slim overrides.

    Risk

    • Seeds have no overrides folder. removeOverrides uses a forced rm, so a missing folder is no warning (ports/filesystem.ts:356).
    • A removeOverrides failure is logged and never thrown (slim-boot.ts:351), so a delete that worked still drops the row.

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: yes

    Written by an agent.

  4. removed their assignment
    on Nov 20, 2026
  5. added
    bug:ready
    and removed
    bug:new
    on Nov 24, 2026
  6. self-assigned this
    on Nov 24, 2026
  7. V3RON commented on Nov 24, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1813 (#1780)
    Parked: none
    Waiting: none
    Decided: none

    Written by an agent.

  8. added 3 commits that reference this issue on Nov 24, 2026
    3e46439
    6a0320a
    49570dd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions