fix(posts): finish-audit closeout for #179
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s

Reviewer fanout (ponytail/security/general) fixes: bind hoisted to the
WorkspaceView root task (stale boundHome after a Home repoint while
another pane was showing), railWriteReturningReason emits .writeFailed
(pinned, flip-verified), dead home: params deleted from the three ask
sheets, saveDraft locals inlined; AGENTS.md docs delta applied; devlog
closeout. Suite 655/655, lint parity with base.
This commit is contained in:
AlexKucera committed 2026-11-10 16:48:35 +01:00
1 parent 3bef1d12b1
commit 23b2090054
12 files changed
+58 -24

No files matched your search

+9 -11
View File
@@ -177,10 +177,10 @@ final class PostsModel {
/// each. Nil in production (no observer, no cost).
@ObservationIgnored
var onRailEvent: (@MainActor (PostsModelRailEvent) -> Void)?
/// #179: the Home the model owns — set by `bind` ALONE (app
/// construction and the Settings repoint are the only two places it is
/// set); every verb reads it, none takes it. Watcher root + rescan
/// target.
/// #179: the Home the model owns — set by `bind` ALONE (WorkspaceView's
/// root `.task(id: museionHome)`: first frame and every repoint,
/// whichever pane is showing); every verb reads it, none takes it.
/// Watcher root + rescan target.
private(set) var boundHome: URL?
private var watcher = PostsWatcher()
/// #143 (OPT-F3): scan parse memo — a rescan re-parses only changed
@@ -192,8 +192,9 @@ final class PostsModel {
/// Bind a Home: ensure both container roots exist (FSEvents on a missing
/// path is unreliable; archive/ is a watcher root now, #107), initial
/// scan + start (or restart) the watcher. Called from
/// `.task(id: home)` — re-fires on Home repoint.
/// scan + start (or restart) the watcher. Called from WorkspaceView's
/// root `.task(id: museionHome)` — first frame and every Home repoint,
/// pane-independent.
func bind(home: URL) {
startWatching(home: home)
Task { await rescan() }
@@ -274,12 +275,9 @@ final class PostsModel {
/// its window).
func saveDraft() {
guard let staged = draft, let home = boundHome else { return }
let text = staged.text
let project = staged.project
let type = staged.type
railWrite {
let post = try PostStore.writeNew(body: text, project: project, type: type, home: home)
lastDraftWasOutline = type == .outline // #109: covers the lagging rescan
let post = try PostStore.writeNew(body: staged.text, project: staged.project, type: staged.type, home: home)
lastDraftWasOutline = staged.type == .outline // #109: covers the lagging rescan
draft = nil
pendingProject = nil // #108: the explicit target landed with the draft
selectedPostID = post.id