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
@@ -234,6 +234,23 @@ final class ScriptedEngine: EngineTransport, @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
/// Test hook (#179 audit): release a held prompt as a NORMALLY ended
|
||||
/// turn — session/cancel answers "cancelled"; the mid-pass repoint pin
|
||||
/// needs the turn to end .ended after the hold. Returns false (and
|
||||
/// no-ops) when nothing is held — e.g. the parked request already hit
|
||||
/// its deadline under machine load — so the caller can fail loudly
|
||||
/// instead of reading a confusing nil strip.
|
||||
@discardableResult
|
||||
func endHeldPrompt() -> Bool {
|
||||
queue.sync {
|
||||
guard let id = self.heldPromptID,
|
||||
let continuation = self.parked.removeValue(forKey: id) else { return false }
|
||||
self.heldPromptID = nil
|
||||
continuation.resume(returning: .object(["stopReason": .string("end_turn")]))
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
/// Test hook: the kill(pid, SIGKILL) rail's in-process twin (#178 B2) —
|
||||
/// the engine dies unexpectedly: onCrash fires, every pending request
|
||||
/// fails. The crash-restart pins drive real crashes through this.
|
||||
|
||||
Reference in new issue
Block a user