Split PostsModel/WorkspaceView/PostsPaneView into 8 domain-extension files (move-only, three audits concur; 693/693 via the verify rail). One commit per source file precedes this log. Closes #193
7.4 KiB
Split the fat files along the PostsModel pattern (#193)
Date: 2026-11-17 Type: issue Reference: AlexKucera/Museion#193
Goal
Split the 2026-11-16 retro's three most-re-read files — PostsModel.swift, WorkspaceView.swift, PostsPaneView.swift — into cohesive extension files the way PostsModelPasses / PostsModelCards already split PostsModel. Mechanical, module-internal moves: symbols keep names and module, zero call-site edits, zero behavior change, one commit per source file, Museion/AGENTS.md map gains the new entries.
What Was Done
PostsModel.swift775 → 325 lines; split intoPostsModelWatcher.swift(151 —PostsWatcher,bind,startWatching,rescan),PostsModelWrites.swift(233 —performWriterail,flushOrAbort, rename/trash, #108 project ops),PostsModelImports.swift(104 — external guest, import batch). Commit902e860.WorkspaceView.swift852 → 426; split intoArchivePaneView.swift(176),WorkspaceViewSheets.swift(189 — the four house ask sheets),WorkspaceChrome.swift(96 —SelectedRowStrip/BorderedSecondaryButtonStyle/PaneHeader).RailButtonstayed in-core (its only caller is the rail; keepsprivate). Commit70cd1c2.PostsPaneView.swift776 → 186; split intoPostsLibraryColumn.swift(521 — column + rename/move sheets + file-scopelibrarySearch+LaunchFocusReset) andLibraryPostRow.swift(94 — reused by the Archive pane). Commit2a02b95(amended with the audit fix).- Moves executed by a boundary-asserted Python range script: 68 exact line-content checks on PostsModel (plus equivalents on the views) before any write; every new file verified byte-identical to its extracted ranges; each boundary assert names the line it expected so a miss fails loudly.
- 15 access widenings
private→internal, each structurally required (Swift admitsprivatemembers only to same-file extensions): 10 PostsModel members (6 carrying/// #193: setter internal — <owner>lines in the #146 convention),ArchivePaneView, and the 4 sheet structs (disclosed in their file headers). - Import hygiene:
import CoreServicesdropped from PostsModel core (FSEvents moved);import AppKitdropped from PostsPaneView after the audit (LaunchFocusReset was its last AppKit user). - DOX pass: Museion/AGENTS.md map — 8 new file bullets, the 3 parent bullets rewritten, moved-detail sentences relocated to the owning bullets, one stale
private(set)doc claim corrected. - finish-audit (3 fresh-context reviewers): move-only confirmed by a third independent method (per-line counters / normalized line-multiset); security PASS with all trust-boundary guards verified byte-identical and the write-rail call graph intact; one LOW fixed (the AppKit import), one LOW deferred.
Decisions & Rationale
| Decision | Rationale |
|---|---|
| Widen privates (option A) over keeping private-touching methods in-core (option B) | Option B left the core at ~520 lines with incohesive domains; option A lands 325 and matches the repo's #146 precedent exactly ("setter internal — the split-out domain extensions set it"). The widenings are module-internal only. |
| One commit per source file, with each commit's slice of the AGENTS.md map | The AC's revert-independence. The map's first hunk interleaved two splits' adjacent bullet lines, so plain git add -p couldn't separate them — solved by staging asserted intermediate versions of AGENTS.md (HEAD+split1 edits, +split2 edits, final), verified equal to a from-HEAD reconstruction. |
| PostsLibraryColumn keeps its sheets, search mount, and focus rider at 521 lines | They travel with the post rows by the file's own documented contract; cohesive and far under the 800 ceiling. Splitting them out would scatter one surface across files. |
| RailButton stays in WorkspaceView.swift | Only the nav rail instantiates it; moving it would force a widening for zero cohesion gain. |
| No new tests | Zero behavior change by construction; the existing 693-test suite is the pin (AC forbids behavior change). |
Gotchas & Fixes
| Problem | Root Cause | Fix |
|---|---|---|
GitNexus impact/detect-changes abort with "Multiple repositories indexed. Specify repo" but reject the very label format they print |
CLI registry disambiguation quirk | --repo /absolute/path/to/repo works; used for all subsequent calls |
Root AGENTS.md showed an unrequested diff hunk (GitNexus counters 7044→7072) after analyze |
The index run rewrites the auto-managed gitnexus: block |
Reverted the hunk (auto-managed, re-bumps on the next index); reviewers confirmed no other scope creep |
An over-broad guard ("FSEvent" not in core_text) false-tripped on prose |
Doc comments mention "the FSEvents window" — substring guards match prose | Tightened guards to the exact import line / API symbol (import CoreServices, FSEventStream) |
import AppKit left behind in PostsPaneView.swift |
I deliberately didn't touch imports at split time ("code unchanged" posture); the compiler has no unused-import warning | Caught by the finish-audit general reviewer; dropped and amended into the split commit |
detect-changes reports "No changes detected" at wrap-up |
The session's own mid-flight analyze already synced the index to the tree — clean by construction |
Reported as index-relative; the real affected-scope check is the pre-analyze run (163 symbols / 73 flows, all relocations) plus the diff-scope reviews |
Files Changed
| File | Change Summary |
|---|---|
Museion/PostsModel.swift |
775→325; core keeps properties, draft lifecycle, select, Cold Turkey mirrors; 10 widenings |
Museion/PostsModelWatcher.swift |
new — PostsWatcher + bind + startWatching + rescan |
Museion/PostsModelWrites.swift |
new — #179 write rail + structural ops |
Museion/PostsModelImports.swift |
new — external guest + import batch |
Museion/WorkspaceView.swift |
852→426; keeps WorkspaceView + RailButton |
Museion/ArchivePaneView.swift |
new — #108 Archive pane (private→internal) |
Museion/WorkspaceViewSheets.swift |
new — 4 house ask sheets (private→internal) |
Museion/WorkspaceChrome.swift |
new — shared chrome (SelectedRowStrip, BorderedSecondaryButtonStyle, PaneHeader) |
Museion/PostsPaneView.swift |
776→186; keeps the pane layout only |
Museion/PostsLibraryColumn.swift |
new — library column + sheets + search mount + LaunchFocusReset |
Museion/LibraryPostRow.swift |
new — shared post row |
Museion/AGENTS.md |
map: 8 new bullets, 3 parents rewritten, detail relocated to owners |
Open Items & Next Steps
- Close #193 (rides the docs commit:
Closes #193) - Known limitation, documented in code + map:
watchedHome's single-writer invariant is doc-convention now, not compiler-enforced (security reviewer: Low, no reachable exploit, discipline verified holding) — revisit only if PostsModel ever gains a second Home writer
Verification: xcodebuild build SUCCEEDED (SwiftCompile lines confirmed for every split file — no stale-binary serve); ./scripts/full-test.sh run 20261117T165454Z: 693 executed / 693 passed / 0 failed / 0 skipped, exit 0, on the exact final bytes (audit fix included; the subsequent amend changed no file bytes); swiftlint . 0 violations; swiftformat . 0/149. GitNexus re-indexed (7,072 nodes / 36,395 edges).
Log written by write-log skill