Versions 165 to 318
Lines 4–31 at 318 (were 4–9 at 165)
66
26+ assert.equal(textReads, Math.ceil(line.length / 16384), "an indexed read decodes only the selected line");
28+
Lines 47–52 at 318 (were 25–75 at 165)
2749
28−import { SqliteWriterState } from "../../../server/src/writer-host.ts";
29−import { memoryStorage } from "../../../server/test/helpers.ts";
30−
31−test("persistent atom metadata accepts text beyond the generic state limit", (t) => {
32− const database = memoryStorage();
33− t.after(() => database.db.close());
34− SqliteWriterState.initialize(database);
35− const storage = new SqliteWriterState(database, "long-atom");
36− const memory = new MemoryStore();
37− const value = "x".repeat(8100000);
38− new Project(memory).init({ "large.txt": value }, 0);
39− const entry = memory.entries[0]!;
40− if (entry.type !== "init") throw Error("expected init");
41− new Graph({ storage }).add(entry.atom);
42− assert.ok(JSON.stringify(storage.read("atoms", "0")).length < 4096);
43− const read = storage.read.bind(storage);
44− let textReads = 0;
45− t.mock.method(storage, "read", (collection: string, key: string) => {
46− if (collection === "atom-text:long:chunks") textReads++;
47− return read(collection, key);
48− });
49− const graph = new Graph({ storage });
50− const atom = graph.atom("a0");
51− assert.equal(textReads, 0, "reading atom metadata must not load long text");
52− assert.equal(atom.inserts[0]!.lines[0], value);
53− assert.ok(textReads > 0);
54− assert.equal(graph.lineText("a0.0"), value);
55− assert.equal(
56− database.db
57− .prepare(
58− "SELECT COUNT(*) AS n FROM writer_state WHERE namespace = 'long-atom' AND collection = 'atom-text:long:chunks' AND part = -1",
59− )
60− .get()!.n,
61− Math.ceil(value.length / 16384),
62− );
63− assert.equal(
64− database.db
65− .prepare(
66− "SELECT COUNT(*) AS n FROM writer_state WHERE namespace = 'long-atom' AND collection = 'line-text:long:chunks'",
67− )
68− .get()!.n,
69− 0,
70− );
71−});
72−
- MCP
- compare on this site's /mcp
- CLI
- abso diff 165 318 src/engine/test/graph-long-text.test.ts --json
- JSON
- /christopher/abso-core/compare/165..318?file=src%2Fengine%2Ftest%2Fgraph-long-text.test.ts&format=json