Review-only snapshot for BUG-1115 through BUG-1117; not merge-ready. New opening and append-turn PostgreSQL permission failures remain blocked. Persisted joint replay has zero completed questions; segment ordering remains off by default. The existing offline replay JSON is retained stale and unchanged after a denied overwrite, including its CRLF line endings. Browser/provider validation and final serial gates remain pending. No deployment, role permission changes, or staging/main push. Co-Authored-By: Claude Code <noreply@anthropic.com>
26 lines
1.5 KiB
TypeScript
26 lines
1.5 KiB
TypeScript
/** Offline public-benchmark oracle; never passed to production question selection. */
|
|
import { directionFor, type ProbeDirectionContext } from "../src/lib/rectification-agentic/core/apply-probe-outcome.ts";
|
|
import type { AnswerClass, ConflictProbe } from "../src/lib/rectification-agentic/core/types.ts";
|
|
|
|
export function segmentReplayOracleAnswer(
|
|
probe: ConflictProbe,
|
|
truthMinute: string,
|
|
transitions?: ProbeDirectionContext["transitions"],
|
|
): AnswerClass {
|
|
if (probe.choice_kind === "varga_style" || probe.source === "nakshatra_boundary") {
|
|
// Style choices retain their real answer class and reference-only scoring.
|
|
return probe.expected_outcomes.find(outcome => outcome.answer_class !== "unsure"
|
|
&& directionFor(truthMinute, outcome, probe.choice_kind, { probe, transitions }) === "support")?.answer_class ?? "unsure";
|
|
}
|
|
// Same yes/weak union and continuous-minute inheritance as research
|
|
// optimal_answer -> true_side. A missing representative is not itself unsure.
|
|
const yes = [...new Set(probe.expected_outcomes
|
|
.filter(outcome => outcome.answer_class === "yes" || outcome.answer_class === "weak_yes")
|
|
.flatMap(outcome => outcome.supports))];
|
|
const no = [...new Set(probe.expected_outcomes.filter(outcome => outcome.answer_class === "no")
|
|
.flatMap(outcome => outcome.supports))];
|
|
const direction = directionFor(truthMinute, { answer_class: "yes", supports: yes, conflicts: no },
|
|
probe.choice_kind, { probe, transitions });
|
|
return direction === "support" ? "yes" : direction === "conflict" ? "no" : "unsure";
|
|
}
|