Auditor: PR-claim hard-block reviewer (scaffold) #1
@ -28,6 +28,13 @@ const BRIDGE = process.env.CONTEXT7_BRIDGE_URL ?? "http://localhost:3900";
|
|||||||
const FIXTURE_ID = "auditor:hybrid_38_40_45:v1";
|
const FIXTURE_ID = "auditor:hybrid_38_40_45:v1";
|
||||||
const TEST_WORKER_NAME = "__auditor_test_worker__";
|
const TEST_WORKER_NAME = "__auditor_test_worker__";
|
||||||
const STALE_HASH = "stale-hash-for-drift-proof";
|
const STALE_HASH = "stale-hash-for-drift-proof";
|
||||||
|
// Unique-per-run identifiers so each fixture invocation hits the ADD
|
||||||
|
// path in upsert_entry (not UPDATE/NOOP on a leftover from a prior
|
||||||
|
// run). Catches state pollution + avoids interaction with task #12
|
||||||
|
// (UPDATE branch silently drops doc_refs).
|
||||||
|
const RUN_NONCE = Date.now().toString(36);
|
||||||
|
const TEST_WORKER_NAME_VERSIONED = `__auditor_test_worker_${RUN_NONCE}__`;
|
||||||
|
const TEST_OPERATION_VERSIONED = `TEST: fill: __auditor_${RUN_NONCE}__ x1 in TestCity, TC`;
|
||||||
|
|
||||||
export interface LayerResult {
|
export interface LayerResult {
|
||||||
layer: string;
|
layer: string;
|
||||||
@ -190,10 +197,10 @@ export async function runHybridFixture(): Promise<FixtureResult> {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "content-type": "application/json" },
|
headers: { "content-type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
operation: `TEST: fill: __auditor__ x1 in TestCity, TC`,
|
operation: TEST_OPERATION_VERSIONED,
|
||||||
approach: "auditor hybrid fixture run",
|
approach: "auditor hybrid fixture run",
|
||||||
context: "doc_refs integration test — retire after audit",
|
context: "doc_refs integration test — retire after audit",
|
||||||
endorsed_names: [TEST_WORKER_NAME],
|
endorsed_names: [TEST_WORKER_NAME_VERSIONED],
|
||||||
append: true,
|
append: true,
|
||||||
doc_refs: [
|
doc_refs: [
|
||||||
{
|
{
|
||||||
@ -215,8 +222,8 @@ export async function runHybridFixture(): Promise<FixtureResult> {
|
|||||||
const state_raw = await readFile("/home/profit/lakehouse/data/_playbook_memory/state.json", "utf8");
|
const state_raw = await readFile("/home/profit/lakehouse/data/_playbook_memory/state.json", "utf8");
|
||||||
const state = JSON.parse(state_raw);
|
const state = JSON.parse(state_raw);
|
||||||
const entries = state.entries ?? [];
|
const entries = state.entries ?? [];
|
||||||
const ours = entries.find((e: any) => (e.endorsed_names ?? []).includes(TEST_WORKER_NAME));
|
const ours = entries.find((e: any) => (e.endorsed_names ?? []).includes(TEST_WORKER_NAME_VERSIONED));
|
||||||
if (!ours) throw new Error(`seeded entry not found in state.json (worker ${TEST_WORKER_NAME} not present)`);
|
if (!ours) throw new Error(`seeded entry not found in state.json (worker ${TEST_WORKER_NAME_VERSIONED} not present)`);
|
||||||
const docRefs = ours.doc_refs ?? [];
|
const docRefs = ours.doc_refs ?? [];
|
||||||
if (docRefs.length === 0) {
|
if (docRefs.length === 0) {
|
||||||
throw new Error("entry saved but doc_refs field is empty — the field accepted by the API isn't being persisted");
|
throw new Error("entry saved but doc_refs field is empty — the field accepted by the API isn't being persisted");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user