test(editor): pin the rescan stale-Home verdict and the draft-survives repoint (review r1)
CI / ci (push) Canceled after 0s

MF-1: the hoisted `guard watchedHome == home` in rescan was live logic
with no pin — the only new guard still observable after the gate (a
scan started under A can sit in its detached hop while the gate passes
and bind flips to B; landing after B's own scan it would hold A's list
under the B binding until the next B-side event, which with nothing
open is never). `scanLibrary` is the per-model injectable library
scanner beside `scanPieceCards` (captured before the hop); the pin
parks an A scan past the repoint, lets B's scan land, releases, and
asserts the list is still B's and `contentRevision` did not move.

Mutation check: hoist removed → rail-filtered `9 executed / 8 passed /
1 failed`, ONLY that pin, `posts.map(\.id) → ["alpha"]` and
`contentRevision → 3` vs `revision → 2`; restored byte-exact (sha256
prefix d86ce09d6b7e6bd2 before and after).

N-1: the draft-survives-repoint decision pinned — newPost targets the
selected A piece's project, the draft rides the repoint intact, and
`saveDraft()` lands under B only, in the draft's OWN project even
though B does not have it (materialize creates with intermediates).

Filtered GREEN: PostsModelRepointTests + PostsModelDepartureTests
19/19. swiftformat 0/152, swiftlint 0.
This commit is contained in:
AlexKucera committed 2026-11-23 22:34:23 +01:00
1 parent 97712fbacb
commit 92344e224c
3 files changed
+75 -1

No files matched your search

+2 -1
View File
@@ -151,8 +151,9 @@ extension PostsModel {
// the counter before the scan so the delta after it says "this
// scan saw disk change" (#144's mounted half).
let missesBefore = scanMemo.misses
let scan = scanLibrary // detached capture, not a property read
let (scanned, openDiskText) = await Task.detached(priority: .userInitiated) {
let posts = Post.scan(home: home, cache: scanMemo)
let posts = scan(home, scanMemo)
let disk = openPostID.flatMap { PostStore.readBody(id: $0, home: home) }
return (posts, disk)
}.value