Files
museion/docs/devlog/20261103-issue147-app-target-lint-clean-five-error-spots_log.md
T
AlexKucera 4606fd4628
CI / ci (push) Canceled after 0s
refactor(lint): clear the last five error spots (#147)
The repo contract "SwiftFormat + SwiftLint must both stay clean" had
five error spots left beyond #146's PostsModel split, all mechanical.

PostStore's enum body spanned 354 against 350 — the cursor-sidecar
group (#66: CursorState + stateURL/readCursor/writeCursor, already its
own MARK section) moves verbatim into a same-file nonisolated
extension slotted chronologically before the #141 ingest MARK; the
enum body lands at 334 and PostStore.CursorState keeps its qualified
name, so no caller changes. Six single-char locals in
ProseListTextView's dropIndex/rectY/isGap get real names (plus lo/hi
in the same function — same violation class), one in ImageIngestTests'
bandedRectY. The 194-char guard in ProseList.indent and the 221-char
guard in OutlineEditorView.endDrag wrap in the house
else-carries-the-brace form (#142 landmine avoided).

PostStoreTests crossed its 1000-line ceiling at 1061 — split at the
Pass substrate MARK per the MicropubModelTests precedent: the
pass-adjacent write sides (#24/#29/#31) move byte-identical into
PostStorePassTests.swift, shared helpers storeHome/readPost/readPiece
stay internal in the original, and the #29 scenario header travels
with its tests. 63 tests in, 63 out.

The split's new parallel schedule exposed two latent test races,
reproduced idle (~50% for the first) and fixed at the root:
EditorSessionTests' sidecar poll inherited loop 1's deadline and timed
out holding flush 1's default-zero sidecar (zeros, never nil — the
telltale) — each loop now arms its own. SessionLifecycleTests' three
stderrTail asserts raced the client's main-queue stderr drain (the #30
class) — a drainStderr bounded poll now precedes each.

swiftlint reports zero errors on both targets; residual warning-tier
notices match the standing #146 posture (the error tier is the bar;
the one new notice is PostStorePassTests at 473/400 — a 1070-line
suite cannot split into two files both under 400). swiftformat clean.

Full suite 574/574 by xcresult executed count (573 unit + 1 UI smoke),
twice consecutively plus the finish-up rerun.

Closes #147
2026-11-03 13:47:01 +01:00

7.1 KiB
Raw Blame History

#147 App-target lint clean: the remaining five error spots

Date: 2026-11-03 Type: issue Reference: #147

Goal

Clear the last five swiftlint error spots beyond #146 so swiftlint lint Museion MuseionTests reports zero errors repo-wide — all mechanical, zero production behavior change: PostStore enum body 354>350, six single-char locals in ProseListTextView, one in ImageIngestTests, two long lines (ProseList 194, OutlineEditorView 221), and PostStoreTests 1061>1000 split at a natural suite boundary.

What Was Done

  • Museion/PostStore.swift — the cursor-sidecar group (#66: CursorState + stateURL/readCursor/writeCursor, already its own MARK section) moved verbatim into a new same-file nonisolated extension PostStore slotted between the #33 micropub extension and the #141 ingest MARK (chronological order). Enum body 354 → 334 (≤350). PostStore.CursorState keeps its qualified name — extension nesting, zero caller changes; private unchanged (same file).
  • Museion/ProseListTextView.swift — dropIndex locals s/i/y → sample/index/sampleY; lo/hi → lowerBound/upperBound (same violation class, same function); rectY(_ i:) param and the Self.dropIndex closure param → charIndex; isGap(_ c:) → char.
  • MuseionTests/ImageIngestTests.swift — bandedRectY(_ i:) → charIndex.
  • Museion/ProseList.swift — the 194-char indent guard wrapped house-style (guard …,\n\t …\n\telse { return nil } — else carries the brace, the #142 landmine avoided).
  • Museion/OutlineEditorView.swift — the 221-char endDrag guard wrapped the same way.
  • MuseionTests/PostStoreTests.swift 1061 → 606 lines; new MuseionTests/PostStorePassTests.swift (464) — cut at the // MARK: Pass substrate (#24) line, everything from there to EOF moved byte-identical (#24 pass substrate, #29 research notes, #31 stats capture — the pass-adjacent write sides; the #29 scenario header moved with its tests). Shared helpers storeHome/readPost/readPiece stay in the original, private→internal; researchDay/threeDecimals moved with their only consumers.
  • Test-robustness fixes from review (test-only, both the repo's bounded-poll idiom): EditorSessionTests sidecar poll arms its own sidecarDeadline (was inheriting loop 1's spent budget); SessionLifecycleTests gains drainStderr(_:containing:) awaited before the three stderrTail asserts.
  • DOX: MuseionTests/AGENTS.md — PostStoreTests bullet loses the #24/#29/#31 tail, new PostStorePassTests bullet carries it; internal-helpers note added.

Decisions & Rationale

Decision Rationale
AC "zero warnings on every touched file" read as the ERROR tier + no new warnings, residual warning-tier notices flagged Same spec-internal conflict #146 hit and its three audit reviewers ruled on: default warning tiers (400 file / 250 body) are unreachable at these sizes and predate the change; 14+ repo files carry them. Only genuinely new warning: PostStorePassTests 473/400 — a 1070-line suite can't split into two files both <400
Cursor-sidecar group chosen for the PostStore extension move Already a cohesive MARKed unit (struct + three functions, ~30 body lines); grew the file's documented same-file-extension pattern instead of inventing a new one
Split cut at the Pass substrate MARK (contiguous tail) One clean cut at a suite boundary; cohesive theme (pass-adjacent write sides); MicropubTests → MicropubModelTests precedent; pure move = 63 tests in = 63 out
lo/hi renamed beyond the ticket's named six Same violation class in the same function being edited; 2 pre-existing warnings gone for a trivial diff — flagged as one inch beyond spec
No .serialized/restructure for the flaky test Root cause was the shared deadline (test bug), not parallelism per se; one-line deadline fix at the real seam

Gotchas & Fixes

Problem Root Cause Fix
Full suite 573/574 with the diff (~50% on idle machine) — EditorSessionTests debounce test Splitting a test file changes Swift Testing's parallel schedule → loop 1 of the poll test ate the shared 5s deadline, loop 2 timed out holding flush #1's default-zero sidecar (restored = zeros, never nil — the tell) Second loop arms its own sidecarDeadline after loop 1 completes
Full suite 573/574 once more — fork stderr assertion The three stderrTail asserts read immediately after the awaited wire response; stderr drains via client.onStderrLine → DispatchQueue.main.async — a race the new schedule exposed (#30 class) drainStderr bounded poll before each assert
First review round produced contradictory evidence (their 2/2 red vs my green) Both review sub-agents ran CONCURRENTLY in the same worktree — one's stash/unstash cycles and lint load collided with the other's xcodebuild runs Reproduced idle per the #30 protocol before acting; reviewers now dispatched with git-write ops forbidden
574 executed vs "573 at filing" in the AC A commit landed between filing and the run; the split itself is count-neutral (63 = 36 + 27) Verified structurally, reported the delta
grep -c on git diff output under-reported deletions (461 → 1) via the session reviewer The rtk shell wrapper mangles piped diff output Reviewer routed around with git diff --output=<file>; known trap for future diff-review through this harness

Files Changed

File Change Summary
Museion/PostStore.swift Cursor-sidecar group → same-file extension (enum body 334)
Museion/ProseListTextView.swift Nine identifier renames in dropIndex/rectY/isGap/closure
Museion/ProseList.swift Guard wrap (194→3 lines, house style)
Museion/OutlineEditorView.swift Guard wrap (221→4 lines, house style)
MuseionTests/ImageIngestTests.swift bandedRectY param rename
MuseionTests/PostStoreTests.swift Tail 448 lines moved out; helpers internal; header updated (606 lines)
MuseionTests/PostStorePassTests.swift NEW — pass-adjacent suites #24/#29/#31 (464 lines)
MuseionTests/EditorSessionTests.swift Sidecar poll gets its own deadline
MuseionTests/SessionLifecycleTests.swift drainStderr helper + three awaited asserts
MuseionTests/AGENTS.md Split documented, helpers-internal note
AGENTS.md GitNexus counter block auto-update only

Open Items & Next Steps

  • Deferred LOW (finish-audit): collapse the duplicated drainStderr/assert literal pairs in SessionLifecycleTests when those lines are next touched.
  • With #146 + this, the repo-wide lint-clean claim holds at the ERROR tier; literal warning-zero would need either further file splits (three more files) or .swiftlint.yml tier configuration — a deliberate owner call, not assumed.

Log written by write-log skill. Verification at commit time: swiftformat --lint 0/114, swiftlint 0 errors, xcodebuild test rc=0 with 574/574 by xcresult count (plus one earlier ×2 consecutive green pair on the identical tree).