Rectification answers now advance chat_sessions.updated_at (BUG-704). A ?c= id missing from the loaded page is fetched before anyone may call it deleted (BUG-705). The range card no longer has a post-card tie-break button; live questions leave the card visible with adopt locked (BUG-706/708). Spoken copy bans 相对支持度 (BUG-709). Task docs assigned 700-704; qizheng already took 700-703.
114 lines
4.1 KiB
TypeScript
114 lines
4.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
|
|
import { vargaStyleFollowupRenderable } from "../src/lib/rectification-agentic/v9/probe-question-contract.ts";
|
|
import { interviewChoiceCardUnavailable } from "../src/lib/rectification-surface-state.ts";
|
|
import { MACHINE_VOICE_LEXICON } from "../src/lib/rectification-agentic/v9/agent-voice-lexicon.ts";
|
|
import { validateAdoptNarration, type AdoptDeliveryFacts } from "../src/lib/rectification-agentic/v9/adopt-narration.ts";
|
|
import { RECTIFICATION_USER_COPY } from "../src/lib/rectification-agentic/user-copy.ts";
|
|
|
|
const chat = readFileSync(
|
|
new URL("../src/components/rectification-agentic-chat.tsx", import.meta.url),
|
|
"utf8",
|
|
);
|
|
const card = readFileSync(
|
|
new URL("../src/components/rectification-range-delivery.tsx", import.meta.url),
|
|
"utf8",
|
|
);
|
|
const css = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8");
|
|
const followup = readFileSync(
|
|
new URL("../src/lib/rectification-agentic/v9/method-followup.ts", import.meta.url),
|
|
"utf8",
|
|
);
|
|
|
|
const facts: AdoptDeliveryFacts = {
|
|
precision_stage: "ready_to_adopt",
|
|
already_accepted: false,
|
|
credible_range: ["04:48", "05:07"],
|
|
representative_minute: "04:53",
|
|
runner_up_minute: "05:00",
|
|
opening_window: ["04:45", "05:15"],
|
|
active_candidates: [
|
|
{ time: "04:53", relative_support: 16 },
|
|
{ time: "05:00", relative_support: 16 },
|
|
],
|
|
answered_rounds: 6,
|
|
stop_facts: [{ kind: "indistinguishable", label: "再问下去也分不开 04:53 和 05:00", count: 1 }],
|
|
post_adopt_verification: [],
|
|
minutes: ["04:48", "05:07", "04:53", "05:00", "04:45", "05:15"],
|
|
years: [],
|
|
};
|
|
|
|
test("the delivery card no longer renders a post-card tie-break entry", () => {
|
|
assert.doesNotMatch(card, /onTieBreak/);
|
|
assert.doesNotMatch(card, /rangeDeliveryTieBreakEntry/);
|
|
assert.doesNotMatch(chat, /onTieBreak/);
|
|
assert.doesNotMatch(chat, /requestTieBreak/);
|
|
assert.doesNotMatch(css, /rectification-range-delivery__tie-break/);
|
|
assert.match(chat, /adoptLocked=\{liveInterviewBlockingAdopt\}/);
|
|
assert.match(chat, /liveInterviewBlockingAdopt/);
|
|
assert.doesNotMatch(
|
|
chat.slice(chat.indexOf("const showSelectionCards"), chat.indexOf("const showReadonlyRange")),
|
|
/interviewQuestionBlocksAdoptOffer/,
|
|
);
|
|
});
|
|
|
|
test("tie-break availability reuses the choice-card renderability gate", () => {
|
|
assert.match(followup, /vargaStyleFollowupRenderable/);
|
|
assert.equal(
|
|
vargaStyleFollowupRenderable({
|
|
choiceKind: "varga_style",
|
|
styleOptions: [
|
|
{ label: "相处里更在意照顾对方的感受", answer_class: "yes", sign: "巨蟹座" },
|
|
{ label: "习惯带头,也不排斥站到台前", answer_class: "weak_yes", sign: "狮子座" },
|
|
],
|
|
}),
|
|
true,
|
|
);
|
|
assert.equal(
|
|
vargaStyleFollowupRenderable({
|
|
choiceKind: "varga_style",
|
|
styleOptions: [
|
|
{ label: "相处里更在意照顾对方的感受", answer_class: "yes" },
|
|
{ label: "习惯带头,也不排斥站到台前", answer_class: "weak_yes" },
|
|
],
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("a varga_style focus without a choice card is a dead question, not a spoken stem", () => {
|
|
assert.equal(
|
|
interviewChoiceCardUnavailable({
|
|
questionKind: "choice",
|
|
hasChoiceCard: false,
|
|
questionId: "varga.d9.cancer/leo",
|
|
}),
|
|
true,
|
|
);
|
|
assert.equal(
|
|
interviewChoiceCardUnavailable({
|
|
questionKind: "collect_spoken",
|
|
hasChoiceCard: false,
|
|
questionId: "varga.d9.cancer/leo",
|
|
}),
|
|
true,
|
|
);
|
|
assert.equal(
|
|
interviewChoiceCardUnavailable({
|
|
questionKind: "choice",
|
|
hasChoiceCard: true,
|
|
questionId: "varga.d9.cancer/leo",
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("adopt narration may not speak 相对支持度 even when the number is in facts", () => {
|
|
assert.ok(MACHINE_VOICE_LEXICON.includes("相对支持度"));
|
|
assert.equal(validateAdoptNarration("相对支持度都是 16。", facts).ok, false);
|
|
assert.equal(validateAdoptNarration("这两个时间按现有信息分不开。", facts).ok, true);
|
|
assert.equal(RECTIFICATION_USER_COPY.rangeDeliveryAdoptLocked, "先答完上面这道,再选时间。");
|
|
});
|