fix: check revision-scoped schema and evidence records in their collections

This commit is contained in:
2026-08-12 18:14:14 +02:00
parent 1cec3da838
commit a1cd44b771
+16 -8
View File
@@ -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 })] };
},
},
{