import { describe, it, expect } from "vitest";
import { checkLabelWriteGate } from "../graph-write-gate.js";
// Task 391 — :CompiledTruthRevision is read-only after write. The agent
// must not be able to forge or rewrite audit history; the only writers
// are the rewriter (composed via the revision helper, same TX as the
// live `compiledTruth` SET) and the dream-cycle prune.
describe("checkLabelWriteGate", () => {
    it("accepts a normal label set", () => {
        expect(checkLabelWriteGate({ labels: ["Person"] })).toEqual({ ok: true });
        expect(checkLabelWriteGate({ labels: ["Organization", "LocalBusiness"] })).toEqual({
            ok: true,
        });
    });
    it("rejects a direct :CompiledTruthRevision write", () => {
        const result = checkLabelWriteGate({ labels: ["CompiledTruthRevision"] });
        expect(result.ok).toBe(false);
        if (!result.ok) {
            expect(result.reason).toBe("forbidden-label");
            expect(result.forbiddenLabel).toBe("CompiledTruthRevision");
            expect(result.message).toContain("CompiledTruthRevision");
        }
    });
    it("rejects when :CompiledTruthRevision is stacked with another label", () => {
        const result = checkLabelWriteGate({
            labels: ["Person", "CompiledTruthRevision"],
        });
        expect(result.ok).toBe(false);
    });
});
//# sourceMappingURL=graph-write-gate-label.test.js.map