Description
What happened
Follow-up to #1714 (fixed by #1786), raised by @maxlapides on #1714 and in #1785.
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.
Logs and evidence
See #1714's comments and #1785's description.
Written by an agent.
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…