Close the lint arc #194-#197: deliberate-style rule disables with rationales (#194), filter-safe test renames + --test-case-name-format preserve (#195), every surviving warning fixed through the sanctioned lint-stable shapes (#196), and the docs now state the true contract (#197): bare swiftlint . reports zero violations and swiftformat . reformats nothing, while push gates stay scoped to the push's own files (settled #190 design) — the pre-push hook's stale 'pre-existing violations' rationale blocks refreshed, gate logic untouched. Also in the sweep: quiesce the FSEvent-burst watcher race in LibrarySearchTests (two rescans double-count one shared PostScanCache miss; benign revision over-bump), pin the learnings scan's symlink-skip contract (flip-verified — defended in depth by the lstat guard AND contentsOfDirectory's own symlink refusal), reorder that scan's guard so cheap rejections precede the directory listing, and park the roster chmod window with a ceiling comment. Finish-audit: 3 reviewers, 0 blocking; the one code finding was disproved by probe (&& out-binds ?? — the guard was correct). Suite 693/693 via scripts/full-test.sh; swiftlint 0 violations; swiftformat 0/141; hook rig 23/23. Closes #197
7.7 KiB
Close out: repo-wide swiftlint green becomes the documented lint contract (#197)
Date: 2026-11-17 Type: issue Reference: AlexKucera/Museion#197
Goal
With #195 and #196 done, make the docs and code comments honest about repo-wide lint being green: refresh the pre-push hook's stale "pre-existing violations" rationale (gate semantics unchanged), prune/replace the stale #190 learning in AGENTS.md, confirm the root lint line is literally true — and land a green full unit suite.
Tree composition note: the working tree also carries the uncommitted #194/#195/#196 batches (lint policy, test renames + .swiftformat name-format pin, warning-fix sweep) from earlier sessions today; this session implemented #197 on top, then ran a three-reviewer finish-audit over the whole 27-file diff.
What Was Done
scripts/hooks/pre-push— all three stale rationale blocks refreshed (header "pre-existing findings", gate block "a bareswiftlint .gate can never pass", NEW-ref note "pre-existing violations could never clear it") to the settled #190 design wording. Comment-only; gate logic byte-identical (reviewer grep-verified).AGENTS.md— the Tooling & gates learning rewritten to the true contract: repo-wide lint green (#194 policy, #195/#196 cleared every finding,spike/excluded as unbuilt), bareswiftlint .= 0 violations +swiftformat .reformats nothing, gates stay push-scoped. Root lint line confirmed literally true by execution.MuseionTests/LibrarySearchTests.swift— hardenedan unchanged rescan keeps the revisionagainst a pre-existing watcher-race flake: two FSEvent-burst rescans can snapshot the sharedPostScanCachemiss count before either stamps it, double-counting one first read →contentRevisiondouble-bump (benign over-invalidation). The test now quiesces the burst (bounded 20 × 0.5 s stability loop, own deadline, post-loop#expect) before snapshotting. Suite scenario header names the fourth pin.- Finish-audit (3 parallel reviewers: ponytail / security / general over the full uncommitted diff):
- Reviewer's "dead symlink clause" bug in
LearningsIndex.isPlainDirectorydisproved by scratch probes —&&out-binds??(a ?? false && bparses as(a ?? false) && b; second??/&&precedence claim probe-settled in this repo, see #26) andURL.resourceValuesis lstat-style (symlink-to-dir →isDirectory=false). Kept parens + doc as readability hygiene; the expression had fooled a capable reviewer. Museion/LearningsPaneView.swift— guard reordered so the cheap rejections (isPlainDirectory, dot-prefix) short-circuit before the directory listing.MuseionTests/LearningsPaneTests.swift— new pina symlinked type dir never surfaces(the documented "same skip posture as Post.scan" contract was unpinned). Flip-verified: the contract is defended in depth (lstat guard ANDcontentsOfDirectory's own refusal of a symlinked entry URL) — the pin fails only when both go traversal-shaped (fileExists guard + resolved-URL listing failed the pin + a sibling pin; restored green).Museion/MentorSessionModel.swift— pre-existingsessions.jsonworld-readable sub-second window (atomic write → 0o600 chmod) parked with aponytail:ceiling comment naming the upgrade path (createFile-0600 + rename).
- Reviewer's "dead symlink clause" bug in
Decisions & Rationale
| Decision | Rationale |
|---|---|
| Fix the LibrarySearchTests race in the TEST, not the model | The model's revision over-bump only over-invalidates a search snapshot (conservative-safe); serializing rescans or making the miss counter race-free is real machinery for a signal that tolerates false positives. The test's timing assumption was the bug (#147 family). |
Keep parens in isPlainDirectory despite the finding being disproved |
Behavior-identical, two characters, and the bare form demonstrably costs reviewer time — this audit burned a slot misreading it. |
| Symlink pin added although no behavior changed | The documented contract was unpinned; the flip cycle showed it is held up by two accidental mechanisms, exactly the kind of seam a future "simplification" breaks silently. |
| Chmod window parked, not fixed | Pre-existing, local-only, single-user workstation threat model; from-creation 0600 changes a pinned write path — ceiling comment names the trigger (hostile local account). |
Gotchas & Fixes
| Problem | Root Cause | Fix |
|---|---|---|
Full suite failed 1/692 on first run (an unchanged rescan keeps the revision, contentRevision 2 ≠ 1) |
Two FSEvent-burst rescans double-count one shared PostScanCache miss; the test snapshotted mid-burst |
Quiesce loop before snapshotting; verified in isolation (7/7), full (693/693) |
| Flip cycle "passed" with the guard flipped — twice | xcodebuild served stale binaries: a source edit made seconds before invocation was not compiled (zero SwiftCompile lines, suite start 3 s after invocation) |
touch the file and verify SwiftCompile lines in the run log before trusting any green; with that, guard-flip green → both-belts flip red → restored green |
| Reviewer precedence claim contradicted the code's comment | a ?? b && c precedence is genuinely easy to misread (this repo's second such dispute) |
Scratch probes settle it empirically — never rewrite comments on a reviewer's word |
swiftlint line_length (187 chars) after the guard reorder |
swiftformat merges adjacent guards into one long condition list | Wrap the call arguments inside the condition (the shape the same function already uses for its root listing); format-stable on re-run |
| Rail scoped reruns looked green during the flip | Stale-build hazard above | Always confirm compile lines in the run log for rapid edit→test cycles |
Files Changed
| File | Change Summary |
|---|---|
scripts/hooks/pre-push |
Three stale rationale comment blocks refreshed; logic untouched |
AGENTS.md |
Tooling & gates learning rewritten to the true lint contract |
MuseionTests/LibrarySearchTests.swift |
Quiesce loop hardening + scenario header names the settled-state pin |
Museion/LearningsPaneView.swift |
Guard reorder, parens + doc on isPlainDirectory |
MuseionTests/LearningsPaneTests.swift |
New symlink-skip pin with flip-verified doc |
Museion/MentorSessionModel.swift |
Ceiling comment on the roster chmod window |
(The commit also carries the #194/#195/#196 batches from earlier sessions: .swiftlint.yml, .swiftformat, MuseionTests/AGENTS.md, PolishSeamTests.swift, and the #196 warning-fix sweep across 11 app files + test files + prototypes/GateUIPrototype.swift.)
Open Items & Next Steps
- User: commit + push (carries
Closes #197; #194–#196 already closed on the tracker), verify auto-close - Candidate project learning: xcodebuild can skip recompiling a source edited seconds before invocation — flip/edit-test cycles must
touchand verifySwiftCompilelines in the run log - Parked: roster 0600-from-creation if a hostile local account ever matters (
Museion/MentorSessionModel.swiftceiling comment)
Verification
swiftlint .— 0 violations / 130 files, exit 0swiftformat .— 0/141 formatted, tree unchanged./scripts/test-full-test.sh— 23/23 hook acceptance checks./scripts/full-test.sh— 693 executed / 693 passed / 0 failed (run20261117T151013Z-Museion; no source file newer than the run — the green attaches to the committed bytes)- GitNexus:
detect-changesrisk critical (breadth: 100+ symbols across the four-ticket mechanical batch — affected-scope checked by the 3-reviewer fanout, probes, and the suite);analyzereindexed (7,035 nodes / 34,056 edges)
Log written by write-log skill