import { describe, it, expect } from "vitest";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { VECTOR_INDEXED_LABELS, DOCUMENT_ARCHIVE_LABELS, } from "../../../../../../lib/graph-write/dist/index.js";
// Task 636 — drift guard. graph-write must know which labels carry a vector
// index so the chokepoint can detect a null-embedding write of an indexed
// label, but it stays out of the node:fs import chain (it is bundled into the
// ESM payload), so it cannot read schema.cypher at runtime. The label set is a
// hardcoded constant; this test pins it to schema.cypher so a new
// `CREATE VECTOR INDEX … FOR (n:Label) ON (n.embedding)` cannot silently
// diverge from the constant.
const SCHEMA_CYPHER_PATH = resolve(import.meta.dirname, "../../../../../../neo4j/schema.cypher");
describe("VECTOR_INDEXED_LABELS matches schema.cypher", () => {
    it("equals exactly the labels with a vector index on .embedding", () => {
        const text = readFileSync(SCHEMA_CYPHER_PATH, "utf8");
        const re = /CREATE VECTOR INDEX[\s\S]*?FOR \(\w+:(\w+)\) ON \(\w+\.embedding\)/g;
        const fromSchema = new Set([...text.matchAll(re)].map((m) => m[1]));
        expect(fromSchema.size).toBeGreaterThan(20); // sanity: parser found indexes
        expect([...VECTOR_INDEXED_LABELS].sort()).toEqual([...fromSchema].sort());
    });
    it("DOCUMENT_ARCHIVE_LABELS is a subset of VECTOR_INDEXED_LABELS", () => {
        for (const l of DOCUMENT_ARCHIVE_LABELS) {
            expect(VECTOR_INDEXED_LABELS.has(l)).toBe(true);
        }
    });
});
//# sourceMappingURL=vector-indexed-labels-drift.test.js.map