- MCP
- code on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/files/src/engine/test/graph-atom-list-integrity.test.ts?format=json
40 linescodex-capacity-chair 100%Last change codex-capacity-chair in version 162, 1 version changed it
1import assert from "node:assert/strict";
2import { test } from "node:test";
3import { buildBase, Graph } from "../index.ts";
4import { lineKey } from "../keys.ts";
5import type { Atom } from "../types.ts";
6import { SqlState } from "./storage-helper.ts";
8test("stored atom list metadata refuses missing or substituted references", () => {
9 const storage = new SqlState();
10 try {
11 const graph = new Graph({ storage });
12 graph.add(buildBase({ "a.txt": "base" }, { author: "fixture", message: "base", time: 0 }));
13 const keys = Array.from({ length: 513 }, () => lineKey("a0.0"));
14 const atom: Atom = {
15 id: "a1",
16 seq: 1,
17 author: "fixture",
18 message: "lists",
19 time: 1,
20 inserts: [],
21 deletes: [],
22 writes: keys,
23 reads: keys,
24 holds: keys,
25 needs: [],
26 resolves: [],
27 reasons: [],
28 deps: ["a0"],
29 };
30 graph.add(atom);
32 const stored = storage.read("atoms", "1") as Record<string, unknown>;
33 for (const lists of [undefined, {}, { writes: "atom-list:1:reads" }]) {
34 storage.write("atoms", "1", { ...stored, lists });
35 assert.throws(() => new Graph({ storage }).atom("a1"), /stored atom list/);
36 }
37 } finally {
38 storage.db.close();
39 }
40});