refactor(lint): clear the last five error spots (#147)
CI / ci (push) Canceled after 0s
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:
1 parent
012f91727f
commit
4606fd4628
13 files changed
+639
-526
No files matched your search
@@ -141,7 +141,9 @@ struct SessionLifecycleTests {
|
||||
})
|
||||
#expect(texts(in: replayed).contains("Mentor: earlier verdict"))
|
||||
// The wire calls went out over session/load.
|
||||
await drainStderr(mentor, containing: "load ghost")
|
||||
#expect(mentor.stderrTail.contains { $0.contains("load ghost") })
|
||||
await drainStderr(mentor, containing: "load sess-1")
|
||||
#expect(mentor.stderrTail.contains { $0.contains("load sess-1") })
|
||||
}
|
||||
|
||||
@@ -167,6 +169,7 @@ struct SessionLifecycleTests {
|
||||
#expect(mentor.activeEntry == fork)
|
||||
#expect(try mentor.transcriptRows(of: #require(fork)).isEmpty) // FRESH transcript
|
||||
#expect(!mentor.transcriptRows(of: source).isEmpty) // original untouched
|
||||
await drainStderr(mentor, containing: "fork sess-1")
|
||||
#expect(mentor.stderrTail.contains { $0.contains("fork sess-1") })
|
||||
|
||||
// Refusal rig: a session the engine does not know forks into "".
|
||||
@@ -516,3 +519,14 @@ private func texts(in rows: [SessionRow]) -> [String] {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Stderr lines drain through the client's async reader — the awaited wire
|
||||
/// response can land before the line reaches `stderrTail`. Bounded poll
|
||||
/// (the hold-load shape above), never a fixed sleep.
|
||||
@MainActor
|
||||
private func drainStderr(_ mentor: MentorSessionModel, containing text: String) async {
|
||||
let deadline = ContinuousClock.now.advanced(by: .seconds(5))
|
||||
while !mentor.stderrTail.contains(where: { $0.contains(text) }), ContinuousClock.now < deadline {
|
||||
try? await Task.sleep(for: .milliseconds(20))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user