- MCP
- code on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/files/src/engine/test/graph-deletion-pages.test.ts?version=162&format=json
49 linescodex-capacity-chair 100%Last change codex-capacity-chair in version 162, 1 version changed it
You're reading version 162. The newest is 318, and no version since then changed this file.
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, LineId } from "../types.ts";
6import { SqlState } from "./storage-helper.ts";
8test("persistent delete counts do not load the atom's deleted-line payload", () => {
9 const storage = new SqlState();
10 try {
11 const graph = new Graph({ storage });
12 graph.add(
13 buildBase(
14 { "a.txt": Array.from({ length: 300 }, (_, i) => `line ${i}`).join("\n") },
15 { author: "fixture", message: "base", time: 0 },
16 ),
17 );
18 const deletes = Array.from({ length: 300 }, (_, i) => `a0.${i}` as LineId);
19 const atom: Atom = {
20 id: "a1",
21 seq: 1,
22 author: "fixture",
23 message: "delete",
24 time: 1,
25 inserts: [],
26 deletes,
27 writes: deletes.map(lineKey),
28 reads: [],
29 holds: [],
30 needs: [],
31 resolves: [],
32 reasons: [],
33 deps: ["a0"],
34 };
35 graph.add(atom);
36 const reopened = new Graph({ storage });
37 const read = storage.read.bind(storage);
38 storage.read = (collection, key) => {
39 assert.notEqual(collection, "atom-deletes", "count decoded the full deletion list");
40 assert.notEqual(collection, "atom-deletes:pages", "count read deletion payload pages");
41 return read(collection, key);
42 };
43 assert.equal(reopened.deleteCount("a1"), 300);
44 storage.read = read;
45 assert.deepEqual(reopened.deletedLines("a1"), deletes);
46 } finally {
47 storage.db.close();
48 }
49});