From a1cd44b7719e83256aa9aff2161ddf8622ad4112 Mon Sep 17 00:00:00 2001 From: mptyl Date: Wed, 12 Aug 2026 18:14:14 +0200 Subject: [PATCH] fix: check revision-scoped schema and evidence records in their collections --- backend/scripts/p3-acceptance.mjs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/backend/scripts/p3-acceptance.mjs b/backend/scripts/p3-acceptance.mjs index aeed613b..b0f2261d 100644 --- a/backend/scripts/p3-acceptance.mjs +++ b/backend/scripts/p3-acceptance.mjs @@ -1296,17 +1296,25 @@ async function realChecks(ctx) { { id: "revision_scoped_records", async run() { - const collection = "p2-dwh"; + // Schema records live in the filesystem workspace collection (index-schema ran there); + // Evidence records live in the p2-dwh collection (evidence preprocessing ran there). const base = `http://127.0.0.1:${ctx.fixturePorts.qdrant}`; - const scroll = await fetch(`${base}/collections/${collection}/points/scroll?limit=200`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ with_payload: true, with_vector: false }) }); - const body = await scroll.json(); - const points = body.result?.points ?? []; - const schema = points.filter((p) => (p.payload?.record_kind ?? p.payload?.kind ?? "") === "schema_table"); - const memory = points.filter((p) => (p.payload?.record_kind ?? p.payload?.kind ?? "") === "memory"); + const scroll = async (collection) => { + const res = await fetch(`${base}/collections/${collection}/points/scroll?limit=500`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ with_payload: true, with_vector: false }) }); + const body = await res.json(); + return body.result?.points ?? []; + }; + const schema = (await scroll("p2-filesystem")).filter((p) => (p.payload?.record_kind ?? p.payload?.kind ?? "") === "schema_table"); + const evidence = (await scroll("p2-dwh")).filter((p) => (p.payload?.record_kind ?? p.payload?.kind ?? "") === "evidence"); + const memory = (await scroll("p2-filesystem")).filter((p) => (p.payload?.record_kind ?? p.payload?.kind ?? "") === "memory"); assert(schema.length > 0, "no revision-scoped schema records found"); + assert(evidence.length > 0, "no revision-scoped evidence records found"); assert(schema.every((p) => /^[0-9a-f]{40}$/.test(p.payload?.workspace_revision ?? "")), "schema records lack workspace_revision"); - assert(memory.every((p) => p.payload?.workspace_revision === undefined), "memory records must stay workspace-wide"); - return { commands: [], artifacts: [await evidence(ctx.run, "logs/revision-scoped-records.json", { schema: schema.length, memory: memory.length })] }; + assert(evidence.every((p) => /^[0-9a-f]{40}$/.test(p.payload?.workspace_revision ?? "")), "evidence records lack workspace_revision"); + if (memory.length > 0) { + assert(memory.every((p) => p.payload?.workspace_revision === undefined), "memory records must stay workspace-wide"); + } + return { commands: [], artifacts: [await evidence(ctx.run, "logs/revision-scoped-records.json", { schema: schema.length, evidence: evidence.length, memory: memory.length })] }; }, }, {