The 77-case persisted replay after the BUG-1143 fix keeps every truth segment at both 21 and 61 minutes with segment order on, so the default envelope moves from 21 to 61 minutes. Bug numbers follow staging (BUG-1142 was taken). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
44 lines
2.8 KiB
TypeScript
44 lines
2.8 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
import { sameCollectDomain } from "../src/lib/rectification-agentic/v9/domain-alias.ts";
|
|
import { focusTargetDomain } from "../src/lib/rectification-agentic/v9/server-focus.ts";
|
|
|
|
// BUG-1143: a distinguish focus wrote the planner domain verbatim. health_pressure is not in the
|
|
// focus table's target_domain check, the write failed inside a swallowed retry, and the session
|
|
// went straight to delivery although tap cards remained (BUG-672 alias family).
|
|
const migration = readFileSync(new URL("../supabase/migrations/20260814020000_rectification_v10_runtime.sql", import.meta.url), "utf8");
|
|
const allowedBlock = /target_domain is null or target_domain in \(([^)]*)\)/.exec(migration);
|
|
assert.ok(allowedBlock, "focus table target_domain check is readable");
|
|
const allowed = new Set([...allowedBlock[1]!.matchAll(/'([a-z_]+)'/g)].map((match) => match[1]!));
|
|
|
|
// Every domain the planner, engine catalog or collect pool can put on a followup.
|
|
const plannerDomains = [
|
|
"education", "relocation", "relationship", "career", "finance", "health_pressure", "family",
|
|
"appearance", "occupation", "health", "other", "horary", "unknown", "active_focus",
|
|
];
|
|
|
|
test("every followup domain maps to a value the focus table accepts, for every intent", () => {
|
|
for (const intent of ["distinguish_candidates", "collect_method_evidence", "reverse_verify", "out_of_sample_check"] as const) {
|
|
for (const domain of plannerDomains) {
|
|
const stored = focusTargetDomain({ intent, domain } as never);
|
|
assert.ok(stored === null || allowed.has(stored), `${intent}/${domain} -> ${stored}`);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("a health distinguish focus stores health and still matches health_pressure probes", () => {
|
|
assert.equal(focusTargetDomain({ intent: "distinguish_candidates", domain: "health_pressure" } as never), "health");
|
|
assert.equal(focusTargetDomain({ intent: "distinguish_candidates", domain: "occupation" } as never), "other");
|
|
assert.equal(focusTargetDomain({ intent: "distinguish_candidates", domain: "relationship" } as never), "relationship");
|
|
assert.equal(sameCollectDomain("health_pressure", "health"), true);
|
|
});
|
|
|
|
test("focus writes and focus-to-probe matching never use a raw planner domain", () => {
|
|
const serverFocus = readFileSync(new URL("../src/lib/rectification-agentic/v9/server-focus.ts", import.meta.url), "utf8");
|
|
assert.doesNotMatch(serverFocus, /:\s*followup\.domain,\s*\n/, "no raw followup.domain passed as targetDomain");
|
|
assert.match(serverFocus, /targetDomain: focusTargetDomain\(followup\)/);
|
|
const followup = readFileSync(new URL("../src/lib/rectification-agentic/v9/method-followup.ts", import.meta.url), "utf8");
|
|
assert.doesNotMatch(followup, /probe\.domain === focus\.targetDomain/);
|
|
});
|