feat(mentor): native deslop lint as fix cards (#6)
CI / ci (push) Canceled after 0s

PRD S3.4: the deslop doctrine's deterministic findings — banned-vocab
tiers and em-dash density — are now computed in Swift at pass
invocation, one line after the #31 stats capture, with no engine
round-trip. Findings land as real fix cards (emitter lint) through
FixCardStore, so they render in the existing palette with ask-before
Apply on mechanical mapping cards; mapped phrases (the skill's verb
swaps + #31, e.g. utilize→use) case-match their anchor per ADR-0006,
everything else closes Done/Skip. One card per phrase over its tier
allowance, whole-word case-insensitive matching (delved never fires
delve), em-dash density card first when over budget; emit dedups
against OPEN cards so re-runs make progress and the engine never
re-cards a live lint finding.

The tiers ship as data (Resources/deslop-lint.json mirroring the
deslop skill verbatim — key/landscape/highlight/bare-underscore
omitted as POS-ambiguous) with a <home>/deslop-lint.json override
that wins whenever it exists and decodes: trivially editable without
a recompile.

Finish-audit fixes folded in: whitespace-only override phrases can
no longer silently kill a whole submit (the guard mirrors the
store's trimmed validation), and submit now refuses a symlinked
cards/ dir (promote's posture — the lint auto-fires it every Run
Pass). Suite 489; one EditorSession load-flake cleared in isolation
and on the idle re-run.

Closes #6
This commit is contained in:
AlexKucera committed 2026-10-30 12:05:30 +01:00
1 parent 22bca36857
commit 4724e00b73
13 files changed
+687 -7

No files matched your search

+32
View File
@@ -312,3 +312,35 @@ func textRows(of model: MentorSessionModel) -> [String] {
#expect(matter["stats_captured"] == nil)
#expect(matter["stats_burstiness"] == nil)
}
// MARK: Native deslop lint (#6, S3.4)
@Suite("DeslopLintWiringTests")
struct DeslopLintWiringTests {
/// #6 (S3.4): the lint fires AT the invocation — stats capture and lint
/// cards both land before the engine turn, no engine round-trip.
@Test @MainActor func `a pass invocation seeds lint cards`() async throws {
let (model, home, mentor) = try makePassRig()
defer { mentor.shutdown() }
await mentor.openSession()
let body = "# Lint Piece\n\nUtilize the index — and delve twice — notably once, and again — "
+ "and again — and once more — to clear the dash budget. Utilize it twice."
let post = try PostStore.writeNew(body: body, home: home)
model.select(post.id, home: home)
for _ in 0 ..< 250 where !model.posts.contains(where: { $0.id == post.id }) {
try await Task.sleep(nanoseconds: 20_000_000)
}
await model.runPass(.pass1, home: home, mentor: mentor)
let piece = home.appendingPathComponent("projects/posts/\(post.id)")
let cards = FixCardStore.scan(pieceURL: piece.appendingPathComponent("post.md"))
#expect(cards.contains { $0.emitter == .lint && $0.status == .open })
#expect(cards.contains { $0.pattern == "utilize" && $0.lane == .mechanical })
// Stats capture fired at the same invocation — both hooks, one seam.
let onDisk = try String(contentsOf: piece.appendingPathComponent("post.md"), encoding: .utf8)
let matter = Post.frontmatter(of: onDisk)
#expect(matter["stats_captured"] != nil)
#expect(onDisk.contains("pass_state: Pass-1 Done"))
}
}