You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
iOS lease fails when a file its baseline recorded is missing from the copy #1790
An iOS source (seed or baseline) records, in ios_source_files, the files and links that name its lineage. If a recorded entry is missing from a later copy, swapCopyFiles (src/drivers/ios/lineage-files.ts:24) throws ENOENT from stat/openFile/readlink, the copy is deleted, and the provision fails. Because the row stays, every lease of that source fails the same way until it is saved again.
A recorded path can go stale when a file the save walk found is renamed away afterwards, as CoreSimulator does with its atomic *.sb-* writes after simctl clone (#1714). A file that vanishes between the walk's lstat and its read is also recorded unreadable with a warning (classify, same file).
What you expected
A recorded file or link missing from a copy has nothing left to swap: the swap skips it and the lease goes on. A file that vanished before it was read is not recorded. Other errors still fail the copy (ADR 0076 §3).
How to reproduce
Unit level: seed ios_source_files with a file row whose path is absent in the copy, then provision — it fails with ENOENT and deletes the copy (today pinned by the "a recorded file gone" case in src/drivers/ios/index-seed-swap.test.ts).
Environment
main at 825608e. Measured on Xcode 27.2 / iOS 27.2: the real device.plist.sb-* holds only the clone's own UDID, so this path is not known to fire in practice today; the blast radius (every lease of a baseline) is the reason to fix it.
Confirmed at 5b688e1ce: a recorded entry missing from a copy fails the provision and deletes the copy, and a file that vanishes after lstat is recorded unreadable with a warning. Branch bug/1790-repro has two tests. It also drops the "a recorded file gone" case, which pinned the old behaviour, and adds "a recorded link that cannot be read" (EACCES still fails, passes today).
pnpm exec vitest run --project unit src/drivers/ios/index-seed-swap.test.ts src/drivers/ios/index-seed-record.test.ts
× a copy whose source recorded a file and a link the copy does not have is kept, the provision succeeds and the entries still there are swapped
index-seed-swap.test.ts:160 expect(outcome).toMatchObject({ lineage: [...] })
+ Error { "message": "ENOENT: no such file or directory, open '/Devices/CCCC…/data/GoneLogs'", "code": "ENOENT" }
× a baseline is saved when a file in its clone is renamed away after the walk reaches it and before it is read, and that file is neither recorded nor warned about
index-seed-record.test.ts:376 expect(recorded(saved.database)).toEqual([{ kind: "file", relative_path: "device.plist" }])
+ { "kind": "unreadable", "relative_path": "device.plist.sb-55c05b11-ISuHtw" }
Root cause
This is a defect. swapCopyFiles (src/drivers/ios/lineage-files.ts:31-52) calls readlink (:37) and eachWindow → stat (:176) / openFile (:190) on every recorded path and catches nothing. The ENOENT then reaches the catch in Seeds (src/drivers/ios/seeds.ts:246-250), which deletes the copy and fails the provision. The row stays, so every later copy of that source fails the same way. Separately, classify (:162-167) turns every read error into unreadable, ENOENT included, so a file renamed away after the walk's lstat leaves a stale row and a warning. The code already skips missing entries in two places: seeds.ts:520 for the dropped LaunchServices database, and visitFolder (:98-102, #1786) for a file gone before lstat.
Simplest fix
In swapCopyFiles, wrap each file or link swap in a try that skips isMissingPathError (ENOENT only) and counts it as missing. Add , N missing to the debug line at seeds.ts:525 and update the first test's expected log line. In classify, return undefined on ENOENT. Update the seeds line in src/drivers/ios/AGENTS.md.
pnpm exec vitest run --project unit src/drivers/ios → 34 files, 765 passed | 1 skipped
pnpm typecheck → clean
Alternatives rejected
Skip without a counter: the debug log would no longer show that the record is stale.
Delete stale rows from ios_source_files on a miss: writes to the source from the copy path while other copies run at the same time.
Risk
A copy that is really broken (its clone is incomplete) is now handed out, and only the debug count shows it.
Only ENOENT is skipped. ENOTDIR, EACCES and length changes still delete the copy.
Activity
test: reproduce #1790 — a copy missing a file or link its source reco…
V3RON commentedon Nov 20, 2026
Reproduction
Confirmed at
5b688e1ce: a recorded entry missing from a copy fails the provision and deletes the copy, and a file that vanishes afterlstatis recordedunreadablewith a warning. Branchbug/1790-reprohas two tests. It also drops the"a recorded file gone"case, which pinned the old behaviour, and adds"a recorded link that cannot be read"(EACCES still fails, passes today).Root cause
This is a defect.
swapCopyFiles(src/drivers/ios/lineage-files.ts:31-52) callsreadlink(:37) andeachWindow→stat(:176) /openFile(:190) on every recorded path and catches nothing. The ENOENT then reaches thecatchinSeeds(src/drivers/ios/seeds.ts:246-250), which deletes the copy and fails the provision. The row stays, so every later copy of that source fails the same way. Separately,classify(:162-167) turns every read error intounreadable, ENOENT included, so a file renamed away after the walk'slstatleaves a stale row and a warning. The code already skips missing entries in two places:seeds.ts:520for the dropped LaunchServices database, andvisitFolder(:98-102, #1786) for a file gone beforelstat.Simplest fix
In
swapCopyFiles, wrap each file or link swap in atrythat skipsisMissingPathError(ENOENT only) and counts it asmissing. Add, N missingto the debug line atseeds.ts:525and update the first test's expected log line. Inclassify, returnundefinedon ENOENT. Update the seeds line insrc/drivers/ios/AGENTS.md.Alternatives rejected
ios_source_fileson a miss: writes to the source from the copy path while other copies run at the same time.Risk
Fast track
Written by an agent.
docs(ios): the manual says a missing recorded entry is skipped (#1790)
docs(ios): trim the iOS manual under its cap (#1790)
docs(ios): trim the iOS manual under its cap (#1790)
Revert "test: reproduce #1790" pushed to main by mistake (#1791)
V3RON commentedon Nov 20, 2026
Delivery run
Merged: #1793 (#1790), #1791 (revert of d7bd191, the #1790 reproduction pushed to
mainby mistake)Parked: none
Waiting: none
Decided: none
Written by an agent.
fix(ios): a copy skips recorded files its source no longer has (calls…