Files
Jyotisha/frontend/tests/rectification-split-holdout.test.ts
T
Jesse_Chen 0eb740a6b8
Independent Staging Quality Gate / validate (push) Successful in 10m33s
Independent Staging Quality Gate / publish (push) Successful in 16m24s
fix(rectification): keep holdout, D9 probes, and asked keys on the decision boundary
Reserve a month-or-better holdout, degrade unsigned D9/D10 to existence, and treat ledger keywords as mention-only so remaining discriminators stay in the pool.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-28 18:04:34 +08:00

27 lines
1.3 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { holdoutEventIds, splitHoldoutEvents } from "../src/lib/rectification-agentic/core/split-holdout.ts";
test("holdout fallback reserves a month-or-better event, not a trailing year event", () => {
const events = splitHoldoutEvents([
{ id: "job-a", domain: "career", year: 2018, precision: "month" },
{ id: "job-b", domain: "career", year: 2020, precision: "day" },
{ id: "love-a", domain: "relationship", year: 2016, precision: "year" },
{ id: "love-b", domain: "relationship", year: 2022, precision: "year" },
]);
assert.deepEqual([...holdoutEventIds(events)], ["job-b"]);
assert.equal(events.find((item) => item.id === "love-b")?.usage, "training");
assert.equal(events.filter((item) => item.usage === "training").length, 3);
});
test("singleton-domain holdout still prefers that domain when training would stay at three", () => {
const events = splitHoldoutEvents([
{ id: "edu", domain: "education", year: 2016, precision: "year" },
{ id: "job-a", domain: "career", year: 2018, precision: "month" },
{ id: "job-b", domain: "career", year: 2020, precision: "month" },
{ id: "love", domain: "relationship", year: 2021, precision: "year" },
]);
assert.deepEqual([...holdoutEventIds(events)], ["edu"]);
});