From bb4bfa2675c3fd2776bd0235c01010baec2290df Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Tue, 17 Nov 2026 18:00:10 +0100 Subject: [PATCH] docs: #193 session log + distilled learnings 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 --- AGENTS.md | 6 +- ...-fat-files-along-postsmodel-pattern_log.md | 68 +++++++++++++++++++ docs/devlog/INDEX.md | 1 + 3 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 docs/devlog/20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md diff --git a/AGENTS.md b/AGENTS.md index 88e8894..404faf7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -135,7 +135,7 @@ Single-context: `GLOSSARY.md` + `docs/adr/` at the repo root. See `docs/agents/d # GitNexus — Code Intelligence -This project is indexed by GitNexus as **museion** (7044 symbols, 34067 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. +This project is indexed by GitNexus as **museion** (7072 symbols, 36395 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. > Index stale? Run `node .gitnexus/run.cjs analyze` from the project root — it auto-selects an available runner. No `.gitnexus/run.cjs` yet? `npx gitnexus analyze` (npm 11 crash → `npm i -g gitnexus`; #1939). @@ -186,6 +186,8 @@ This project is indexed by GitNexus as **museion** (7044 symbols, 34067 relation - SwiftFormat's default `swiftTestingTestCaseNames` rewrites camelCase `@Test` names back into backticked sentence style — renaming a test to a filter-safe plain identifier (#195, #31/#134) needs `--test-case-name-format preserve` in `.swiftformat`; `standard-identifiers` would dirty all ~496 backticked test names repo-wide - git resolves short refs through `refs/tags/` before `refs/remotes/` — hooks and scripts spell `refs/remotes//` in full or a fetched tag named `origin/main` shadows the ref (#190) - A bash function invoked before its definition no-ops (`command not found`) under `set -uo` without `-e` — hoist definitions above first use and guard rig verdicts by executed-check count, never the banner (#190) +- GitNexus `detect-changes` in this machine's multi-repo registry needs `--repo /absolute/path` — it aborts on ambiguity but rejects the `name (path)` label form it prints (#193) +- When splitting a file, re-derive each side's imports from symbol usage, never copy the old import block — Swift has no unused-import warning, so a stranded import (PostsPaneView's AppKit) survives lint and only a diff review catches it (#193) ### Testing - Gate-running rules are encoded in `scripts/full-test.sh` (#190) — run `./scripts/full-test.sh start` + `status` polling (`summary` for the finished counts), never hand-rolled xcodebuild/xcresult incantations. The rest of this section is authoring rules the script cannot encode. @@ -215,6 +217,7 @@ Session logs live in `docs/devlog/` (one per completed task/issue/milestone). Fu | Date | Log | | --- | --- | +| 2026-11-17 | [20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md](docs/devlog/20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md) | | 2026-11-17 | [20261117-issue192-collapse-gate-running-learnings-into-verify-rail-pointer_log.md](docs/devlog/20261117-issue192-collapse-gate-running-learnings-into-verify-rail-pointer_log.md) | | 2026-11-17 | [20261117-issue197-repo-wide-swiftlint-green-documented-lint-contract_log.md](docs/devlog/20261117-issue197-repo-wide-swiftlint-green-documented-lint-contract_log.md) | | 2026-11-17 | [20261117-issue190-full-test-verify-rail-pre-push-hook_log.md](docs/devlog/20261117-issue190-full-test-verify-rail-pre-push-hook_log.md) | @@ -224,5 +227,4 @@ Session logs live in `docs/devlog/` (one per completed task/issue/milestone). Fu | 2026-11-10 | [20261110-pr184-deferred-empty-piece-scope-lost-audit_log.md](docs/devlog/20261110-pr184-deferred-empty-piece-scope-lost-audit_log.md) | | 2026-11-10 | [20261110-issue182-profilelayout-config-set-rail_log.md](docs/devlog/20261110-issue182-profilelayout-config-set-rail_log.md) | | 2026-11-10 | [20261110-issue181-provider-descriptor-pass-readiness_log.md](docs/devlog/20261110-issue181-provider-descriptor-pass-readiness_log.md) | -| 2026-11-10 | [20261110-issue180-postfrontmatter-codec-one-readwrite-engine_log.md](docs/devlog/20261110-issue180-postfrontmatter-codec-one-readwrite-engine_log.md) | diff --git a/docs/devlog/20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md b/docs/devlog/20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md new file mode 100644 index 0000000..ea358f0 --- /dev/null +++ b/docs/devlog/20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md @@ -0,0 +1,68 @@ +# Split the fat files along the PostsModel pattern (#193) + +> **Date:** 2026-11-17 +> **Type:** issue +> **Reference:** https://git.babylondreams.de/AlexKucera/Museion/issues/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.swift` 775 → 325 lines; split into `PostsModelWatcher.swift` (151 — `PostsWatcher`, `bind`, `startWatching`, `rescan`), `PostsModelWrites.swift` (233 — `performWrite` rail, `flushOrAbort`, rename/trash, #108 project ops), `PostsModelImports.swift` (104 — external guest, import batch). Commit `902e860`. +- `WorkspaceView.swift` 852 → 426; split into `ArchivePaneView.swift` (176), `WorkspaceViewSheets.swift` (189 — the four house ask sheets), `WorkspaceChrome.swift` (96 — `SelectedRowStrip`/`BorderedSecondaryButtonStyle`/`PaneHeader`). `RailButton` stayed in-core (its only caller is the rail; keeps `private`). Commit `70cd1c2`. +- `PostsPaneView.swift` 776 → 186; split into `PostsLibraryColumn.swift` (521 — column + rename/move sheets + file-scope `librarySearch` + `LaunchFocusReset`) and `LibraryPostRow.swift` (94 — reused by the Archive pane). Commit `2a02b95` (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 admits `private` members only to same-file extensions): 10 PostsModel members (6 carrying `/// #193: setter internal — ` lines in the #146 convention), `ArchivePaneView`, and the 4 sheet structs (disclosed in their file headers). +- Import hygiene: `import CoreServices` dropped from PostsModel core (FSEvents moved); `import AppKit` dropped 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 + +- [x] 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* diff --git a/docs/devlog/INDEX.md b/docs/devlog/INDEX.md index de9bd90..c07699d 100644 --- a/docs/devlog/INDEX.md +++ b/docs/devlog/INDEX.md @@ -5,6 +5,7 @@ Complete history of session logs in this directory, newest first. One-line summa | Date | Type | File | Summary | |------|------|------|---------| +| 2026-11-17 | issue | [20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md](20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md) | Three most-re-read files split into 8 domain-extension files, move-only (three audits concur); 693/693 | | 2026-11-17 | issue | [20261117-issue192-collapse-gate-running-learnings-into-verify-rail-pointer_log.md](20261117-issue192-collapse-gate-running-learnings-into-verify-rail-pointer_log.md) | Root gate-running learnings collapse into the full-test.sh pointer; 8 deletions mapped to script/hook behavior; authoring rules retained; 693/693 | | 2026-11-17 | issue | [20261117-issue197-repo-wide-swiftlint-green-documented-lint-contract_log.md](20261117-issue197-repo-wide-swiftlint-green-documented-lint-contract_log.md) | Lint-green doc truth (#197) + finish-audit; watcher-race test quiesced, symlink pin flip-verified, stale-xcodebuild hazard found; 693/693 | | 2026-11-17 | feat | [20261117-issue190-full-test-verify-rail-pre-push-hook_log.md](20261117-issue190-full-test-verify-rail-pre-push-hook_log.md) | Classis full-test.sh ported as the verify rail + pre-push hook; 4-round finish-audit; suite 692/692 via the rail, hook rig 23/23 |