feat(mentor): blind read A/B judgment (#122)
CI / ci (push) Canceled after 0s

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
This commit is contained in:
AlexKucera committed 2026-10-30 17:31:00 +01:00
1 parent 4724e00b73
commit 97e86cf62d
15 files changed
+627 -32

No files matched your search

+38 -10
View File
@@ -288,26 +288,54 @@ private struct PassBarView: View {
return posts.posts.first(where: { $0.id == posts.selectedPostID })?.passState.rawValue ?? "—"
}
/// Cancel while a pass runs; Run otherwise — disabled with no open
/// piece, while the engine can't take the turn, or (#137) while the
/// pass profile's provider has no key (the help names it).
/// Cancel while a pass or Blind Read runs; Run otherwise — disabled
/// with no open piece, while the engine can't take the turn, or (#137)
/// while the pass profile's provider has no key (the help names it).
/// #122: the Blind Read trigger sits beside Run — advisory-only.
@ViewBuilder
private var actions: some View {
if posts?.runningPass != nil {
if posts?.runningPass != nil || posts?.runningBlindRead == true {
Button("Cancel") {
posts?.cancelPass(mentor: model)
}
.buttonStyle(.bordered)
} else if let label = missingKeyLabel {
runPassButton
.disabled(true)
.help("\(kind.rawValue) needs a \(label) API key — add it in Settings → Provider Keys.")
} else {
runPassButton
.disabled(posts?.session?.postID == nil || !model.phase.isReady || model.isStreaming)
blindReadButton
if let label = missingKeyLabel {
runPassButton
.disabled(true)
.help("\(kind.rawValue) needs a \(label) API key — add it in Settings → Provider Keys.")
} else {
runPassButton
.disabled(posts?.session?.postID == nil || !model.phase.isReady || model.isStreaming)
}
}
}
/// #122: the Blind Read — one purposeful click judges the current
/// document against the Pass-start snapshot, blind. Disabled with the
/// blocking reason in help (no snapshot yet is the fresh-piece norm).
private var blindReadButton: some View {
Button("Blind Read") {
guard let posts, let home else { return }
Task { await posts.blindRead(home: home, mentor: model) }
}
.buttonStyle(.bordered)
.disabled(blindReadBlocked != nil)
.help(
blindReadBlocked
?? "Judge the current document against the Pass-start snapshot — advisory only, nothing is recorded.",
)
}
/// #122: why the Blind Read can't fire right now (nil = it can).
private var blindReadBlocked: String? {
guard let posts, posts.session?.postID != nil else { return "Open a post to run a Blind Read." }
guard posts.openPieceHasSnapshot else { return "No Pass snapshot yet — run a Pass first." }
guard model.phase.isReady, !model.isStreaming else { return "The mentor engine can't take the turn right now." }
return nil
}
/// The Run button core — shared by the ready and missing-key branches.
private var runPassButton: some View {
Button("Run \(kind.rawValue)") {