test(mentor): pin runPass guard matrix (#24)
CI / ci (push) Canceled after 0s

The pass rails landed in 683ddf8 left guards #1-3 and the pass bar's
Cancel rail without direct coverage. Three new tests over the fake ACP
path: a second runPass while one streams refuses "already running" and
cancelPass ends the held turn (state stays First Draft), a pass
mid-mentor-reply refuses before the snapshot lands, and a pass against
a never-opened engine refuses "isn't ready". Every guard in
PostsModel.runPass now has a flip-verified pin (299 tests green).

Finish-audit fanout over the delta: the three whole-tree enumerator
walks became fileExists one-liners at the deterministic path (same
discrimination, suite convention); two Info findings deferred with
landing spots in the session log.

Closes #24
This commit is contained in:
AlexKucera committed 2026-10-20 12:44:56 +02:00
1 parent 683ddf8426
commit 78f6bb2dba
5 files changed
+138 -6

No files matched your search

@@ -0,0 +1,71 @@
# Issue #24 close-out: pass guard matrix + finish audit
> **Date:** 2026-10-20
> **Type:** issue
> **Reference:** AlexKucera/Museion#24
## Goal
Verify #24 (Run a Pass) against the now-landed #23 (museion-tools MCP server,
commit 683ddf8), close the test debt another session flagged ("runPass
guard/cancel tests still owed"), and run the finish-audit reviewer fanout over
the delta.
## What Was Done
- Verified all five #24 ACs against the merged tree (not docs): pass bar +
streamed critique, `snapshotPass` latest-per-type, advancement only on
`.ended(stopReason) ≠ "refusal"` (`PostsModel.swift:828`), cancel rail,
pre-run token estimate. Everything previously flagged for adaptation was
already handled inside 683ddf8 (stub flip-back to the `submit_fix_cards`
contract, nested tool-args parser, 1800 s `promptTimeout`).
- Confirmed the other session's IOU was half-true: engine-side
cancel/refusal, open-piece guard, flush-before-snapshot, and order-free
were already pinned; guards #1–#3 and the pass bar's `cancelPass` were not.
- Added three guard tests to `MuseionTests/PassRunTests.swift` (296 → 299):
`second pass while one runs refuses and cancel ends it` (hangOnPrompt holds
a real turn; second `runPass` refuses "already running"; `cancelPass` +
teardown; state stays First Draft), `pass refuses while the mentor is
mid-reply` (guard fires before the snapshot — nothing on disk), `pass
refuses when the engine is not ready` (never-opened engine).
- finish-audit: three parallel reviewers (ponytail / security / general) over
the unstaged delta — 0 critical/high/medium. Accepted the ponytail deletion
(three whole-tree `FileManager.enumerator` walks → `fileExists` one-liners,
draft test now pins "no folder ever materialized"); deferred two Info
findings (see Open Items).
## Decisions & Rationale
| Decision | Rationale |
|----------|-----------|
| Reviewer fanout scoped to the unstaged fix-delta only | 683ddf8 already went through its own three-reviewer audit round; a second full fanout re-litigates settled decisions at full cost |
| `Task.sleep(nanoseconds:)` kept over `Task.sleep(for:)` | SwiftFairy CONSIDER finding; nanoseconds poll loops are the suite-wide house pattern (PostsModelTests, existing PassRunTests) — consistency wins at CONSIDER level |
| Enumerator walks cut for `fileExists` at the deterministic path | Same observable, −7 lines, suite convention (PostStoreTests/MCPToolsTests); discrimination unchanged — guard deleted → snapshot lands → path exists → assert fails |
| `cancelPass` covered end-to-end, not with a cancel-answering fake | 3-line delegate over the already-pinned `stopStreaming` rail; a new fake mode is YAGNI until the next harness touch |
## Gotchas & Fixes
| Problem | Root Cause | Fix |
|---------|------------|-----|
| `grep -c "Test case .* passed"` reported 298 after adding 3 tests | xcodebuild debug stdout interleaved mid-line into one test's result line — the test passed; the count was wrong | Verify per-test (`grep "any order"` → passed) before trusting aggregate counts |
| `patch replace_all` fixed only one of two intended sites | The two enumerator blocks weren't identical — one carried the "guard fired before the snapshot" comment, one didn't | Re-patched the third site by its unique preceding assertion |
| Reviewer claimed AGENTS.md delta was the preference bullet | The bullet already rode in 683ddf8; the unstaged change is only the generated GitNexus counter bump | Reviewer's scope note accepted — nothing owed |
## Files Changed
| File | Change Summary |
|------|---------------|
| `MuseionTests/PassRunTests.swift` | +3 guard tests (second-pass + cancelPass teardown, mid-reply, not-ready); 3 enumerator walks → `fileExists` one-liners |
| `MuseionTests/AGENTS.md` | PassRunTests bullet extended with the guard-matrix coverage |
| `AGENTS.md` | Generated GitNexus counter bump (3794→3804 symbols) |
## Open Items & Next Steps
- [ ] `Closes #24` rides this commit — verify the tracker auto-close after push (webhook races a fast read; re-check once).
- [ ] Deferred (security Info): suite-wide `defer { mentor.shutdown() }` teardown so mid-poll cancellation can't leak the 30 s hangOnPrompt fake — lands with the next harness-touching slice.
- [ ] Deferred (review Info): a cancel-answering fake mode (`cancelAck`) to individually discriminate `cancelPass`'s wire effect — lands with #25 apply-path work.
- [ ] #25 (Fix Card apply) is the next domino in the mentor loop.
---
*Log written by write-log skill*
+1
View File
@@ -5,6 +5,7 @@ Complete history of session logs in this directory, newest first. One-line summa
<!-- write-log: full-index -->
| Date | Type | File | Summary |
|------|------|------|---------|
| 2026-10-20 | issue | [20261020-issue24-pass-guard-matrix_log.md](20261020-issue24-pass-guard-matrix_log.md) | #24 close-out: verified against landed #23, pinned the full runPass guard matrix + cancelPass, finish-audit fanout — 299 tests green |
| 2026-10-20 | issue | [20261020-issue23-museion-tools-mcp-server-dogfood-hardening_log.md](20261020-issue23-museion-tools-mcp-server-dogfood-hardening_log.md) | #23 museion-tools MCP server + fix-card store, Fix Cards palette, dogfood fixes (prompt timeout, persona, debug filter), 3-reviewer audit round — 296 tests green |
| 2026-10-19 | issue | [20261019-issue123-ptacek-fold-text-landings_log.md](20261019-issue123-ptacek-fold-text-landings_log.md) | #123 card-emitting doctrine, lane/emitter terms, FC-10 mechanical exemplar landed across skills, CONTEXT, ADR-0006; deslop gap fixed at source |
| 2026-10-19 | issue | [20261019-issue115-prose-list-shortcuts_log.md](20261019-issue115-prose-list-shortcuts_log.md) | #115 prose list Tab/⇧Tab/⌥-moves + layer-contents fold chrome (draw(_:) never fires under SwiftUI hosting); 3-reviewer audit round, 239 tests green |