Files
museion/docs/devlog/20261030-issue122-blind-read-writer-triggered-whole-document-ab-judgment_log.md
T
AlexKucera 97e86cf62d
CI / ci (push) Canceled after 0s
feat(mentor): blind read A/B judgment (#122)
A purposeful writer action on the open post — the "Blind Read" button
beside Run Pass — triggers a whole-document advisory judgment: the
current document against the Pass-start snapshot (the newest
passes/pass-N.md on disk), decided by a FRESH session of the same
museion profile over the existing one-shot ACP rail. Both versions
travel inline in one prompt under neutral A/B position labels with
randomized order — the judge never learns which is the rewrite — and
the A/B-to-origin reveal appends only after the verdict, so the mapping
cannot leak; cancelled, refused, and spawn-failed turns reveal nothing.

Advisory-only per decision #120: no Pass State advance, no cards, no
Learnings, the roster never grows — the verdict is display-only and
dies with the transient transcript. The writer stays judge of record;
demonstrator picks and Fix Card status are untouched. Honest refusals
for the degenerate states: no snapshot yet, an unchanged document, or
a busy rail (passes and reads refuse each other; the pass bar's one
Cancel ends either).

The pass engine's spawn/session/teardown block became one shared
runOneShot rail (failure rows speak the run's own name), the pass-bar
button gates on a derived openPieceHasSnapshot flag, the fake ACP
gained a prompt-log observable, and the GLOSSARY "Blind Read" term
landed with the issue.

Finish-audit (three reviewers): a refusal still ends .ended, so the
reveal now gates on the stopReason (flip-verified pin), plus the
Cancel-rail and pass/blind-read exclusivity pins. Suite 500; swiftformat
clean; swiftlint adds no violations over the HEAD baseline.

Closes #122
2026-10-30 17:31:00 +01:00

69 lines
6.3 KiB
Markdown
Raw 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.
# Blind Read: writer-triggered whole-document A/B judgment (advisory) (#122)
> **Date:** 2026-10-30
> **Type:** issue
> **Reference:** https://git.babylondreams.de/AlexKucera/museion/issues/122 (decision #120, rides #24's pass machinery)
## Goal
Implement Gitea #122: the writer purposefully triggers a whole-document A/B judgment — current document vs the Pass-start snapshot — performed by a fresh session of the same museion profile. Advisory-only: pick + one-line reason, display-only, records nothing (Skip's doctrine); the writer stays judge of record. Glossary term lands with the issue.
## What Was Done
- `Museion/BlindRead.swift` (new) — the judge prompt (both bodies INLINE under neutral "Version A/B" position labels, order randomized per trigger, origin words never appear) + the writer-side reveal line
- `PostStore.latestPassSnapshot(id:home:)` — newest `passes/pass-N.md` by mtime, either pass kind; read-only
- `MentorSessionModel` — `runPass`'s spawn/session/new/teardown block extracted to one private `runOneShot(profile:name:prompt:pieceTitle:)` rail; `runBlindRead` rides it on the CHAT profile (`museion`) — fresh session, verdict streams into the transient unrostered transcript, reveal appends only on `.ended` with stopReason ≠ "refusal"
- `PostsModel.blindRead(home:mentor:)` — guard matrix mirrors runPass (one rail, mutual exclusion with `runningPass`); `runningBlindRead` + `openPieceHasSnapshot` state, the latter derived in `refreshCards`
- `MentorPaneView` — "Blind Read" button beside Run Pass in the pass bar; one Cancel rail ends either run
- `GLOSSARY.md` — "Blind Read" term (avoid: A/B test, vote, score)
- `BlindReadTests.swift` — 12 pins: prompt blindness + flip, reveal mapping, snapshot selection, chat-profile spawn (prompt/spawn logs), roster untouched, pass_state unchanged, no-snapshot/no-edits refusals, refusal-no-reveal (flip-verified), held-run cancel + rail exclusivity
- Fake ACP gains a `prompt-log` knob (every session/prompt wire line) — the what-the-engine-was-asked observable
- DOX: both AGENTS.md files updated; stale `CONTEXT.md` references corrected to `GLOSSARY.md` (root index + docs)
## Decisions & Rationale
| Decision | Rationale |
|----------|-----------|
| "Unlabeled" = neutral A/B position labels + `Bool.random()` order + post-verdict reveal | #120's flagged default; a pick must reference something — position labels kill origin bias, randomization kills position bias; the reveal lands after the turn so the judge never sees it |
| Newest-mtime snapshot wins when both kinds exist | "The Pass-start snapshot" in the singular = the latest pass run's start; a re-run overwrites in place, so newest file IS the latest Pass-start |
| One-shot engine on the chat profile (`museion`) | #120: context-free = fresh session, NOT a different judge; no new profile. One-shot avoids roster pollution and reuses the #137 rail — Cancel, read-only composer, and teardown all come free |
| "No edits since" refusal (beyond spec) | Judging an identical pair is vacuous; honest refusal beats a coin-flip verdict. Flagged to the user |
| No chat-provider-key pre-check | The resident chat engine proves the profile works; a fresh spawn's honest failure row owns the error path (#137's .unknown posture) |
| View-side disabled-with-help duplicating model guards | The existing Run Pass precedent — view prevents, model refuses honestly |
## Gotchas & Fixes
| Problem | Root Cause | Fix |
|---------|------------|-----|
| Reveal row landed on REFUSED turns | `turnCore` maps refusals to `.ended(stopReason: "refusal")`, so `if case .ended` wasn't enough — and a 2×-document prompt makes length refusals realistic | Gate on `stopReason != "refusal"` (runPass's advance posture); pinned + flip-verified (finish-audit, 2 reviewers converged) |
| "Pass failed" copy on Blind Read spawn failures | The shared rail's failure rows hardcoded "Pass" | `runOneShot` takes `name`, composes the label, failure rows speak `\(label) failed` — callers can't pass a title-inconsistent label |
| Snapshot-order test flaked on write order | Both snapshots written ms apart — pass-2 was already newest at the first assert (APFS ns mtimes) | Write pass-1, assert, THEN write pass-2 with a decisive +60 s mtime |
| `@Suite` attribute vanished mid-session | Lost in a patch cycle; suite-filters still ran (implicit naming) but the DOX claimed it | Restored; learning #134 says suite-name matching is exactly where vacuous passes bite |
| Stale `CONTEXT.md` in root AGENTS.md index | The a1d1cd3 rename to GLOSSARY.md never updated the index/docs | Corrected in root AGENTS.md (2 sites) + docs/AGENTS.md |
## Files Changed
| File | Change Summary |
|------|---------------|
| `Museion/BlindRead.swift` (new) | Judge prompt + reveal vocabulary |
| `Museion/PostStore.swift` | `latestPassSnapshot` reader |
| `Museion/MentorSessionModel.swift` | `runOneShot` extraction, `runBlindRead`, parameterized failure copy, refusal gate |
| `Museion/PostsModel.swift` | `blindRead`, `runningBlindRead`, `openPieceHasSnapshot`, refresh seam, guard mutual exclusion |
| `Museion/MentorPaneView.swift` | Blind Read button + shared Cancel rail |
| `MuseionTests/BlindReadTests.swift` (new) | 12 pins incl. two audit pins |
| `MuseionTests/ACPClientTests.swift` | Fake gains the prompt-log knob |
| `GLOSSARY.md` | "Blind Read" term |
| `AGENTS.md`, `docs/AGENTS.md`, `Museion/AGENTS.md`, `MuseionTests/AGENTS.md` | DOX pass + CONTEXT.md→GLOSSARY.md corrections |
## Open Items & Next Steps
- [ ] Parked (security LOW-1): no size ceiling on the 2× inline prompt — the editor is unusable long before the prompt build matters; if the app ever grows a doc-size cap it belongs at the editor/save boundary, not this rail
- [ ] Deferred read of #124 Cancel-visibility: blind read reuses the pass posture (`runningBlindRead` set before the await, sync guards) — revisit only if a spawn-window cancel escape is ever reported
- [ ] The parked stern-coach prompt stance (security reviewer's note): personas ride the profile per #120 — no action unless verdicts read too soft in dogfooding
---
**Verification (finish-up):** full xcodebuild suite **500 passed / 0 failed** (unit + UI, counted from the log per learning #134); swiftformat clean; swiftlint zero new violations vs the HEAD baseline; GitNexus re-indexed (5,338 nodes); detect-changes scoped RunPass + RunBlindRead flows only.
*Log written by write-log skill*