make validate passed on e6d15f72 with every stage, Mac UI tests included, so #767 has its green Validate (local) check. It's waiting for Bradley's "merge". Then #766 (VAULT-158) gets a rebase and a full validation.
Store differential tests fail on macOS 27.2: SwiftData drops an item's tag after a merge import (seed 5)
Description
Found while validating VAULT-158 (#766) on 2026-11-09. It blocks every vault-app PR's make validate: "Tests (macOS)" fails.
What fails
VaultStoreDifferentialTests on macOS, always, with seed 5 only:
storesAgreeOnRandomOperations(reference:seed:), for both SwiftData and SwiftData on SQLite;encryptedStoreAgreesOnRandomOperations(seed:).
The message is seed 5, step 27, after merge import of 3 items (2 new), 0 tags (0 new): retrieve text nil, tags [], matcher: false: items differ. After the merge import, the SwiftData store's item has tags: Set([]), and the reference model's item still has one tag. Everything else about the item is the same.
The run also logs CoreData's annotation: repairing missing delete propagation for to-many relationship tags on object … with bad fault … just after.
Not caused by a PR
- It fails the same way on
mainat af8ea2c3, built and run on its own: 3 of 3 runs. - The iOS suite passes the same test on the iOS 27.0 simulator.
- The last green macOS runs were on 2026-10-20 and 2026-10-25. macOS 27.2 was installed on this Mac on 2026-10-26, so a SwiftData change in 27.2 is the likely cause.
To do
- Replay seed 5 up to step 27 and find which operation leaves the item pointing at the tag: probably a tag deleted earlier while the item kept a reference to it.
- Decide which side is right. If SwiftData 27.2 now removes a relationship to a deleted tag, the reference model may need the same rule. If the store really loses a live tag on merge, that's a store bug, and it could lose a user's tags on restore.
- Fix it in its own PR, then rebase and revalidate #766.
Done when
VaultStoreDifferentialTests passes on macOS 27.2 and on the iOS simulator, with the reason recorded, and make validate passes on main again.
Sub-issues
0Linked issues
0GitHub
0No branches or pull requests linked.
Comments
2PR: https://github.com/badbundle/vault-app/pull/767
Cause. I replayed seed 5 and skipped each step in turn, keeping its random draws. Only two earlier steps matter:
- Step 17 updates item R in the store's long-lived
modelContext. - Step 19, an Import & Override staged in its own context, gives R the tag T.
Then the step 27 merge, in modelContext, gives another item E the same tag. Saving it takes T off R: T's items go from [R, N] to [N, E], and a fresh context reads the same, so the link is gone from the store. This is real data loss (tags only), not a stale read.
Not only the Mac. Unfixed main also fails seed 5 on the iOS 27.2 simulator. Validation runs iOS 27.0, which is why only the Mac stage caught it. User impact: a vault without an App Lock Password, on iOS 27.2, after that exact sequence.
Fix. importAndMergeVault now stages its writes in a fresh ModelContext, as the override already did. The store suites pass with it on macOS 27.2 (twice), iOS 27.0 and iOS 27.2.
Didn't help: setting tags as a diff instead of replacing the array, and running the override in modelContext. I couldn't build a minimal repro outside the differential harness, so seed 5 is the regression test.