fix(rectification): keep compare requests valid after style cards (BUG-577–580)
Engine asked_probe_keys no longer include varga split hashes that 400 the scorer, failed compares become visible and retry, user stop can still deliver a range on a stale snapshot, and holdout no longer reasks domains already in the ledger. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,13 +3,16 @@ import test from "node:test";
|
||||
|
||||
import {
|
||||
RectificationEngineError,
|
||||
engineRequestBody,
|
||||
mergeVedastroValidateIntoReceipt,
|
||||
runV9CandidateScore,
|
||||
runV9Diagnostics,
|
||||
runV9VedastroValidate,
|
||||
sanitizeAskedProbeKeysForEngine,
|
||||
toEngineEvents,
|
||||
type V9EngineScoreResult,
|
||||
} from "../src/lib/rectification-agentic/v9/engine-client.ts";
|
||||
import { askedSemanticKeysForEngine } from "../src/lib/rectification-agentic/v9/inference-adapter.ts";
|
||||
|
||||
const RANGE = { start_time: "04:50", end_time: "05:10" };
|
||||
const CANDIDATE_ID = "88888888-8888-4888-8888-888888888881";
|
||||
@@ -476,3 +479,35 @@ test("vedastro-validate keeps safe timeout, HTTP, and invalid-response failure c
|
||||
globalThis.fetch = previous;
|
||||
}
|
||||
});
|
||||
|
||||
const VARGA_SPLIT_HASH = "04:45-05:15:04:47,04:51,04:53,04:59,05:00,05:06,05:08,05:13,05:15:varga.d9.04:47|04:51/05:00|05:06|04:59|04:53/05:08|05:13|05:15";
|
||||
|
||||
test("engineRequestBody drops varga split hashes and keeps short semantic keys", () => {
|
||||
assert.equal(VARGA_SPLIT_HASH.length, 128);
|
||||
const receipt = {
|
||||
inference_state: {
|
||||
answered_probes: [{
|
||||
probe_id: "contrast:varga.d9.style",
|
||||
semantic_key: "varga.d9.style",
|
||||
candidate_split_hash: VARGA_SPLIT_HASH,
|
||||
answer_class: "yes",
|
||||
classified_from: "choice",
|
||||
}],
|
||||
},
|
||||
};
|
||||
const semantic = askedSemanticKeysForEngine(receipt, []);
|
||||
assert.deepEqual(semantic, ["varga.d9.style"]);
|
||||
assert.equal(semantic.includes(VARGA_SPLIT_HASH), false);
|
||||
const body = engineRequestBody({
|
||||
baselineBirthSnapshot: SNAPSHOT,
|
||||
candidateRange: RANGE,
|
||||
events: toEngineEvents(EVIDENCE),
|
||||
askedProbeKeys: [VARGA_SPLIT_HASH, "varga.d9.style", "k".repeat(201)],
|
||||
});
|
||||
const keys = body.asked_probe_keys as string[];
|
||||
assert.ok(Array.isArray(keys));
|
||||
assert.equal(keys.includes(VARGA_SPLIT_HASH), false);
|
||||
assert.equal(keys.some((key) => key.includes(":varga.")), false);
|
||||
assert.ok(keys.every((key) => key.length <= 120));
|
||||
assert.deepEqual(sanitizeAskedProbeKeysForEngine([VARGA_SPLIT_HASH, "varga.d9.style"]), ["varga.d9.style"]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user