Files
museion/docs/devlog/20261020-issue24-pass-guard-matrix_log.md
AlexKucera 78f6bb2dba
CI / ci (push) Canceled after 0s
test(mentor): pin runPass guard matrix (#24)
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
2026-10-20 12:44:56 +02:00

72 lines
4.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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*