fix: check revision-scoped schema and evidence records in their collections
This commit is contained in:
@@ -1296,17 +1296,25 @@ async function realChecks(ctx) {
|
|||||||
{
|
{
|
||||||
id: "revision_scoped_records",
|
id: "revision_scoped_records",
|
||||||
async run() {
|
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 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 scroll = async (collection) => {
|
||||||
const body = await scroll.json();
|
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 points = body.result?.points ?? [];
|
const body = await res.json();
|
||||||
const schema = points.filter((p) => (p.payload?.record_kind ?? p.payload?.kind ?? "") === "schema_table");
|
return body.result?.points ?? [];
|
||||||
const memory = points.filter((p) => (p.payload?.record_kind ?? p.payload?.kind ?? "") === "memory");
|
};
|
||||||
|
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(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(schema.every((p) => /^[0-9a-f]{40}$/.test(p.payload?.workspace_revision ?? "")), "schema records lack workspace_revision");
|
||||||
|
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");
|
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 })] };
|
}
|
||||||
|
return { commands: [], artifacts: [await evidence(ctx.run, "logs/revision-scoped-records.json", { schema: schema.length, evidence: evidence.length, memory: memory.length })] };
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user