refactor(posts): route every library write through the write rail (#179)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
One internal seam (PostsModelRail.swift) now pairs every library verb store write with exactly one library rescan and owns the error strip: saveDraft, newPostFromSession, rename, trash, createProject, moveToProject, archivePost, restorePost, unarchiveProject, importFiles, convertToPost, and runPass pass-state advance (12 sites on this base; the pass snapshot/stats writes, the publish stamp, and the editor flush stay outside by design). The model owns the Home: boundHome is set by bind() alone (app construction + Settings repoint); every public verb lost its home: parameter (create post/outline/session-born, rename, move, archive, restore, trash, convert, project creation, import, select, cards, passes, blind read, publish). The three rail entries are railWrite/railWriteReturningReason/ railWriteKeepingStrip — deliberately NOT overloads: a shared base name let unlabeled trailing-closure calls resolve into the labeled non-generic entry (Swift binds trailing closures to labeled first parameters), silently bypassing the strip and the pairing. Views + 11 test files swept to the homeless signatures (160 sites). RED suite green: 3/3. Full unit suite: 654/654. Fixes #179
This commit is contained in:
1 parent
8c5ceffa3c
commit
06283b6287
23 files changed
+364
-363
No files matched your search
@@ -172,13 +172,13 @@ struct WritingLockTests {
|
||||
// the outline routing reads the real type, not the lagging list).
|
||||
let post = try PostStore.writeNew(body: "# Prose piece\n\nBody words.\n", home: home)
|
||||
try await Self.waitForScan(model, id: post.id)
|
||||
model.select(post.id, home: home)
|
||||
model.select(post.id)
|
||||
#expect(model.canArmWritingLock)
|
||||
#expect(model.editorBodyText == "# Prose piece\n\nBody words.\n")
|
||||
|
||||
let outline = try PostStore.writeNew(body: "- an outline\n", project: "posts", type: .outline, home: home)
|
||||
try await Self.waitForScan(model, id: outline.id)
|
||||
model.select(outline.id, home: home)
|
||||
model.select(outline.id)
|
||||
#expect(!model.canArmWritingLock)
|
||||
|
||||
// A MIXED outline fires the #111 guard ask instead — the held
|
||||
@@ -186,7 +186,7 @@ struct WritingLockTests {
|
||||
// branch's fourth path, pinned so the mirror can't drift.
|
||||
let mixed = try PostStore.writeNew(body: "- bullet\nprose between bullets\n", project: "posts", type: .outline, home: home)
|
||||
try await Self.waitForScan(model, id: mixed.id)
|
||||
model.select(mixed.id, home: home)
|
||||
model.select(mixed.id)
|
||||
#expect(model.outlineGuardPieceID == mixed.id)
|
||||
#expect(!model.canArmWritingLock)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user