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
@@ -92,7 +92,7 @@ struct PostsPaneView: View {
|
||||
// #33 (S6.1): the publish ask rides the pane (not the library
|
||||
// column) — it targets the open piece.
|
||||
.sheet(isPresented: $showingPublish) {
|
||||
MicropubPublishSheet(posts: model, home: home)
|
||||
MicropubPublishSheet(posts: model)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ struct PostsPaneView: View {
|
||||
draftText: draft.text,
|
||||
draftEdited: { model.updateDraft($0) },
|
||||
draftSave: {
|
||||
model.saveDraft(home: home)
|
||||
model.saveDraft()
|
||||
},
|
||||
outline: draft.type == .outline,
|
||||
)
|
||||
@@ -317,7 +317,7 @@ struct PostsLibraryColumn: View {
|
||||
.background(LaunchFocusReset())
|
||||
.sheet(item: $renamingPost) { post in
|
||||
RenamePostSheet(post: post) { title in
|
||||
model.rename(post, to: title, home: home)
|
||||
model.rename(post, to: title)
|
||||
}
|
||||
}
|
||||
.sheet(item: $movingPost) { post in
|
||||
@@ -325,8 +325,8 @@ struct PostsLibraryColumn: View {
|
||||
// the library renders (Unicode-scalar sort split them), and it
|
||||
// includes empty projects (a fresh New Project has no pieces yet —
|
||||
// it must already be a move target).
|
||||
MoveToProjectSheet(post: post, projects: model.moveTargets(home: home)) { project in
|
||||
model.moveToProject(post, project: project, home: home)
|
||||
MoveToProjectSheet(post: post, projects: model.moveTargets()) { project in
|
||||
model.moveToProject(post, project: project)
|
||||
}
|
||||
}
|
||||
// #144: keystroke-debounced (250 ms), structured body scan —
|
||||
@@ -355,7 +355,7 @@ struct PostsLibraryColumn: View {
|
||||
/// render the same row (#144: results carry the full menu too).
|
||||
private func postRow(_ post: Post) -> some View {
|
||||
LibraryPostRow(post: post, selected: post.id == model.selectedPostID) {
|
||||
model.select(post.id, home: home)
|
||||
model.select(post.id)
|
||||
}
|
||||
.contextMenu {
|
||||
Button("Rename…") { renamingPost = post }
|
||||
@@ -363,15 +363,15 @@ struct PostsLibraryColumn: View {
|
||||
// body transform, then the piece becomes a prose post.
|
||||
if post.type == .outline {
|
||||
Button("Convert to Post…") {
|
||||
model.stageConversion(post, home: home)
|
||||
model.stageConversion(post)
|
||||
}
|
||||
}
|
||||
Button("Move to Project…") { movingPost = post }
|
||||
Button("Move to Archive") {
|
||||
model.archivePost(post, home: home)
|
||||
model.archivePost(post)
|
||||
}
|
||||
Button("Move to Trash", role: .destructive) {
|
||||
model.trash(post, home: home)
|
||||
model.trash(post)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user