fix(web): restore rectification discriminator cards and stop-offer path

Coverage-complete ties never persisted A/B/C/D because contrast probes were stamped with an answered education quality probe, remaining minutes were asked as window D10 signs, and 「没有了」 missed the stop pattern.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-08-25 14:41:48 +08:00
co-authored by Cursor
parent 20ede7cadf
commit d7afe5b50d
19 changed files with 924 additions and 48 deletions
@@ -322,6 +322,15 @@ test("holdout events stay out of training and a winner must stay stable for two
[{ id: "job", domain: "career", year: 2019, precision: "year" }],
);
assert.equal(matching[0]?.classified_from, "evidence");
const quality = {
...probe({ id: "p-quality", domain: "education", year: 2016, gain: 0, yesSupports: ["05:00"], yesConflicts: ["05:10"] }),
source: "known_event_quality",
};
const skippedQuality = answersFromEvidence(
[quality],
[{ id: "enroll", domain: "education", year: 2016, precision: "year" }],
);
assert.equal(skippedQuality.length, 0);
});
test("C without new evidence updates the posterior immediately and D only marks the split asked", () => {
@@ -385,6 +394,50 @@ test("C without new evidence updates the posterior immediately and D only marks
})], unsure.state.answered_probes)?.id, "p-other");
});
test("A/B/C/D on a remaining-minute contrast probe moves the posterior", () => {
const contrast: ConflictProbe = {
id: "contrast:varga.d24.05:00/05:06|05:07",
semantic_key: "varga.d24.05:00/05:06|05:07",
candidate_split_hash: "varga.d24.05:00/05:06|05:07",
domain: "education",
year: 0,
question: "学业盘还分得开",
candidate_ids: ["05:00", "05:06", "05:07"],
expected_outcomes: [
{ answer_class: "yes", supports: ["05:00"], conflicts: ["05:06", "05:07"] },
{ answer_class: "no", supports: ["05:06", "05:07"], conflicts: ["05:00"] },
{ answer_class: "unsure", supports: [], conflicts: [] },
],
information_gain: 0.16,
source: "varga_contrast",
};
const state = buildInferenceState({
range_start: "04:45",
range_end: "05:15",
candidates: [
{ id: "05:00", time: "05:00", relative_support: 34 },
{ id: "05:06", time: "05:06", relative_support: 33 },
{ id: "05:07", time: "05:07", relative_support: 33 },
],
events: [{ id: "e1", domain: "education", year: 2016, precision: "year" }],
probes: [contrast],
});
const before = posteriorMap(state.candidates);
const applied = applyChoiceWithoutEvidence(state, {
choiceKey: "C",
schema: {
choice: { prompt: "那次考试有没有发挥失常?" },
probe_id: contrast.id,
semantic_key: contrast.semantic_key,
},
});
assert.equal(applied.applied, true);
assert.equal(applied.answerClass, "no");
assert.notDeepEqual(posteriorMap(applied.state.candidates), before);
assert.ok((applied.state.candidates.find((item) => item.time === "05:06")?.posterior_score ?? 0)
> (applied.state.candidates.find((item) => item.time === "05:00")?.posterior_score ?? 0));
});
test("holdout and collection declines do not write a probe answer", () => {
const conflict = probe({
id: "p-holdout",