refactor(posts): route every library write through one rail
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
#179: every library-reflecting store write (draft save, session-born post, rename, move to project, archive/restore, trash, convert, project creation, import batch, pass advance) now rides one internal seam — performWrite pairs the write with exactly one rescan and owns the error strip (cleared BEFORE the write so importFiles' per-file failure messages survive the success tail; a nil-Home refusal writes nothing). The model owns the Home: watchedHome is private(set), set only by bind (construction + the Settings repoint); no public method takes a Home parameter — 14 view call sites and ~115 test call sites swept, dead home plumbing cut. The editor's debounced flush, the card closes, the pass substrate and the micropub publish stay off the rail by design (own error semantics, no library regroup). A converged review finding is closed with a guard: the pass advance re-resolves watchedHome after the engine's minutes-long turn, so a mid-pass Settings repoint now refuses the advance with an honest strip message instead of silently stamping pass state into the repointed library (wrong-piece write on a slug collision). createProject failures now surface in the sheet AND the strip — the rail-owns-the- strip posture supersedes the #108 sheet-only rule. Five rail pins (PostsModelWriteRailTests, suite members): write → one library refresh + strip cleared, failed write owns the strip, nil-Home refusal, import batch keeps per-file messages, mid-pass repoint refuses the advance — the last two flip-verified against their guards. ScriptedEngine gains endHeldPrompt (release a held turn as ended). Verification: suite 657/657 the evening this landed; the next-morning re-run could not start — both test runners hung before establishing connection (#134 testmanagerd wedge; an untouched control suite hangs identically — machine state, not this diff; reboot pending). Rail pins 5/5 isolated after the last test-only edit; swiftlint at baseline parity; swiftformat clean. Closes #179 [Generated by AI]
This commit is contained in:
1 parent
627ecf515e
commit
5bf09552f6
27 files changed
+572
-345
No files matched your search
@@ -31,12 +31,12 @@ struct SessionLifecycleTests {
|
||||
let defaultSession = try #require(mentor.activeEntry)
|
||||
let rosterBefore = mentor.roster.count
|
||||
let post = try PostStore.writeNew(body: "# Pass Piece\n\nThe body under pass.", home: home)
|
||||
model.select(post.id, home: home)
|
||||
model.select(post.id)
|
||||
for _ in 0 ..< 250 where !model.posts.contains(where: { $0.id == post.id }) {
|
||||
try await Task.sleep(nanoseconds: 20_000_000)
|
||||
}
|
||||
|
||||
await model.runPass(.pass1, home: home, mentor: mentor)
|
||||
await model.runPass(.pass1, mentor: mentor)
|
||||
|
||||
// The roster never grew — the pass entry is transient.
|
||||
#expect(mentor.roster.count == rosterBefore)
|
||||
@@ -69,7 +69,7 @@ struct SessionLifecycleTests {
|
||||
/// newest-first, active; a non-nil pieceTitle rides the entry —
|
||||
/// association by convention only.
|
||||
@Test @MainActor func `freeform new session is rostered newest-first and active`() async throws {
|
||||
let (model, home, mentor) = try makePassRig()
|
||||
let (_, _, mentor) = try makePassRig()
|
||||
defer { mentor.shutdown() }
|
||||
#expect(!mentor.canStartSession) // never opened — nothing may start
|
||||
await mentor.openSession()
|
||||
@@ -200,7 +200,7 @@ struct SessionLifecycleTests {
|
||||
/// renders, the raw slash command never does, the summary streams into
|
||||
/// the transcript — and is refused while a turn streams.
|
||||
@Test @MainActor func `compact sends the labeled command and is refused while streaming`() async throws {
|
||||
let (model, home, mentor) = try makePassRig()
|
||||
let (_, _, mentor) = try makePassRig()
|
||||
defer { mentor.shutdown() }
|
||||
await mentor.openSession()
|
||||
|
||||
@@ -330,7 +330,7 @@ struct SessionLifecycleTests {
|
||||
#expect(SessionsPaneView.openPiece(in: nil) == nil) // no Posts at all
|
||||
|
||||
let post = try PostStore.writeNew(body: "# Open Piece\n", home: home)
|
||||
model.select(post.id, home: home)
|
||||
model.select(post.id)
|
||||
for _ in 0 ..< 250 where !model.posts.contains(where: { $0.id == post.id }) {
|
||||
try await Task.sleep(nanoseconds: 20_000_000)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user