Skip to content

Commit 2257679

Browse files
author
JSONbored
committed
test(orb): update decision-record schema assertions for the v5 agreement field (#8834)
The DECISION_RECORD_SCHEMA_VERSION bump to v5 moves the pinned version assertions in the backfill bundle and queue decision-record suites. The #9124 record test additionally carries the agreement on its cached finding and asserts it threads through to the record, mirroring exactly how that test already proves modelIds/promptDigest pass through rather than being re-derived.
1 parent 79d6e4f commit 2257679

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

test/unit/backfill-decision-labels-core.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ describe("buildBundle", () => {
115115
expect(await contentDigest(record)).toBe(row.record_digest);
116116
expect(canonicalJson(record)).toBe(row.record_json);
117117
expect(record.configDigest).toBe("backfill:unavailable");
118-
expect(record.schemaVersion).toBe("4"); // v4 (#9124/#9135) — bumped past the v3 salvageability shape this test targets
118+
expect(record.schemaVersion).toBe("5"); // v5 (#8834) — bumped past the v3 salvageability shape this test targets
119119
}
120120
expect(records[0]).toMatchObject({ id: "record:o/r#1@sha1", action: "close", created_at: "2026-07-01T00:00:00.000Z" });
121121
expect(records[1]).toMatchObject({ action: "hold" });

test/unit/queue-2.test.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ describe("queue processors", () => {
369369
// The decision record carries the boundary evidence.
370370
const record = await env.DB.prepare("select record_json from decision_records where repo_full_name = ? and pull_number = ?").bind("owner/agent-repo", 18).first<{ record_json: string }>();
371371
const parsedRecord = JSON.parse(record!.record_json) as { schemaVersion: string; salvageability: { score: number; factors: string[] } | null };
372-
expect(parsedRecord.schemaVersion).toBe("4"); // v4 (#9124/#9135) — bumped past the v3 salvageability shape this test targets
372+
expect(parsedRecord.schemaVersion).toBe("5"); // v5 (#8834) — bumped past the v3 salvageability shape this test targets
373373
expect(parsedRecord.salvageability?.score).toBe(70);
374374
expect(parsedRecord.salvageability?.factors.join(" ")).toContain("mechanical defect class");
375375
// #8838: the replay input persisted beside the record, and the decision re-derives bit-exactly from it.
@@ -404,7 +404,7 @@ describe("queue processors", () => {
404404
notes: "cached review",
405405
reviewerCount: 2,
406406
// 0.95 sits ABOVE the default 0.93 floor: no salvageability hold, so this one-shot-closes cleanly.
407-
findings: [{ code: "ai_consensus_defect", severity: "critical", title: "Unused import", detail: "unused import join from node:path is dead code.", confidence: 0.95, modelIds: ["claude-code", "codex"], promptDigest: "p".repeat(64) }],
407+
findings: [{ code: "ai_consensus_defect", severity: "critical", title: "Unused import", detail: "unused import join from node:path is dead code.", confidence: 0.95, modelIds: ["claude-code", "codex"], promptDigest: "p".repeat(64), agreement: { agreement: 1, confidence: 0.95, sampleCount: 2, uncorroborated: false } }],
408408
metadata: { inputFingerprint },
409409
});
410410
vi.stubGlobal("fetch", async (input: RequestInfo | URL, init?: RequestInit) => {
@@ -436,7 +436,7 @@ describe("queue processors", () => {
436436
settingsDigest: string | null;
437437
divertedByHoldout: boolean;
438438
};
439-
expect(parsed.schemaVersion).toBe("4");
439+
expect(parsed.schemaVersion).toBe("5");
440440
expect(parsed.action).toBe("close"); // above-floor confidence, no salvageability config -> a one-shot close DECISION
441441
// The exact requirement: modelId is non-null whenever an AI judgment shaped the decision.
442442
expect(parsed.modelIds).toEqual(["claude-code", "codex"]);
@@ -451,6 +451,11 @@ describe("queue processors", () => {
451451
expect(parsed.settingsDigest).toMatch(/^[0-9a-f]{64}$/);
452452
// No closeAuditHoldoutPct configured -> the holdout never draws -> never diverted.
453453
expect(parsed.divertedByHoldout).toBe(false);
454+
// #8834: the per-decision confidence signal threads through to the record exactly like modelIds/
455+
// promptDigest above — read straight off the finding, never re-derived or dropped, so every AI-judgment
456+
// decision joins the calibration set with its reproducibility attached.
457+
const withAgreement = parsed as unknown as { aiAgreement: { agreement: number; confidence: number; sampleCount: number; uncorroborated: boolean } | null };
458+
expect(withAgreement.aiAgreement).toEqual({ agreement: 1, confidence: 0.95, sampleCount: 2, uncorroborated: false });
454459
});
455460

456461
it("#9135: with gate.closeAuditHoldoutPct set, a would-close is diverted to a hold and the decision record + replay input both say so", async () => {
@@ -768,7 +773,7 @@ describe("queue processors", () => {
768773
// decision record — the row every future calibration read keys on.
769774
const record = await env.DB.prepare("select record_json from decision_records where repo_full_name = 'owner/agent-repo' and pull_number = 9 order by created_at desc limit 1").first<{ record_json: string }>();
770775
const parsedRecord = JSON.parse(record!.record_json) as { aiConfidence: number | null; promptDigest: string | null; modelIds: string[] | null; schemaVersion: string };
771-
expect(parsedRecord.schemaVersion).toBe("4"); // v4 (#9124/#9135): configDigest/promptDigest/modelIds/ciState + divertedByHoldout
776+
expect(parsedRecord.schemaVersion).toBe("5"); // v4 (#9124/#9135): configDigest/promptDigest/modelIds/ciState + divertedByHoldout
772777
expect(parsedRecord.aiConfidence).toBe(0.3); // the cached sub-floor defect's calibrated confidence
773778
expect(parsedRecord.promptDigest).toBe("f".repeat(64));
774779
expect(parsedRecord.modelIds).toEqual(["claude-code"]);

0 commit comments

Comments
 (0)