refactor(lint): clear the last five error spots (#147)
CI / ci (push) Canceled after 0s

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
This commit is contained in:
AlexKucera committed 2026-11-03 13:47:01 +01:00
1 parent 012f91727f
commit 4606fd4628
13 files changed
+639 -526

No files matched your search

+6 -2
View File
@@ -49,12 +49,16 @@ struct EditorSessionTests {
#expect(PostStore.readBody(id: "alpha", home: home) == "# Alpha\n\nOne. Two.")
// Sidecar: written on flush, reads back. Await the sidecar rather
// than sleeping a fixed window — same starvation rule as above.
// than sleeping a fixed window — same starvation rule as above, with
// its OWN deadline: the first loop's waits must not eat this one's
// budget (until flush #2 lands, readCursor sees flush #1's
// default-zero sidecar — a zero value, never nil).
let cursor = PostStore.CursorState(selectionLocation: 3, selectionLength: 2, scrollOffset: 128)
session.cursorUpdate(cursor)
session.edit("# Alpha\n\nOne. Two. Three.")
var restored: PostStore.CursorState?
while restored != cursor, ContinuousClock.now < deadline {
let sidecarDeadline = ContinuousClock.now.advanced(by: .seconds(5))
while restored != cursor, ContinuousClock.now < sidecarDeadline {
try await Task.sleep(for: .milliseconds(20))
restored = PostStore.readCursor(id: "alpha", home: home)
}