Files
Jyotisha/frontend/tests/rectification-segment-oracle.test.ts
T
66f087b588 feat(rectification): submit varga-resolution implementation for review
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>
2026-10-01 08:04:04 +08:00

34 lines
2.1 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { segmentReplayOracleAnswer } from "../scripts/rectification-segment-oracle.ts";
import type { ConflictProbe } from "../src/lib/rectification-agentic/core/types.ts";
// Fictional inheritance/style controls, never engine calibration goldens.
const probe: ConflictProbe = { id: "offline-probe", semantic_key: "career.2018.dasha_activation",
candidate_split_hash: "offline-split", domain: "career", year: 2018, question: "2018 年换工作了吗?",
candidate_ids: ["09:00", "09:04", "09:08"], source: "dasha_activation", information_gain: 0.3,
expected_outcomes: [
{ answer_class: "yes", supports: ["09:00", "09:04"], conflicts: ["09:08"] },
{ answer_class: "weak_yes", supports: ["09:00", "09:04"], conflicts: ["09:08"] },
{ answer_class: "no", supports: ["09:08"], conflicts: ["09:00", "09:04"] }] };
test("offline oracle inherits truth inside a same-side multi-member interval", () => {
assert.equal(segmentReplayOracleAnswer(probe, "09:02"), "yes");
assert.equal(segmentReplayOracleAnswer(probe, "09:08"), "no");
assert.equal(segmentReplayOracleAnswer(probe, "09:06"), "unsure");
assert.equal(segmentReplayOracleAnswer(probe, "08:59"), "unsure");
});
test("offline oracle keeps varga style answer classes and transition-based inheritance", () => {
const style: ConflictProbe = { ...probe, semantic_key: "varga.d9.synthetic", choice_kind: "varga_style", source: "varga_contrast",
style_options: [{ sign: "金牛座", label: "虚构类型甲", answer_class: "yes" },
{ sign: "双子座", label: "虚构类型乙", answer_class: "weak_yes" }],
expected_outcomes: [{ answer_class: "yes", supports: ["09:00"], conflicts: ["09:08"] },
{ answer_class: "weak_yes", supports: ["09:08"], conflicts: ["09:00"] }] };
assert.equal(segmentReplayOracleAnswer(style, "09:08"), "weak_yes");
assert.equal(segmentReplayOracleAnswer(style, "09:06", [
{ layer: "d9", at: "09:04", from_sign: "金牛座", to_sign: "双子座" }]), "weak_yes");
assert.equal(style.choice_kind, "varga_style");
assert.equal(style.source, "varga_contrast");
});