0eb740a6b8
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>
27 lines
1.3 KiB
TypeScript
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"]);
|
|
});
|