Versions 170 to 318
Lines 47–52 at 318 (were 47–97 at 170)
4949
50−import { SqliteWriterState } from "../../../server/src/writer-host.ts";
51−import { memoryStorage } from "../../../server/test/helpers.ts";
52−
53−test("persistent atom metadata accepts text beyond the generic state limit", (t) => {
54− const database = memoryStorage();
55− t.after(() => database.db.close());
56− SqliteWriterState.initialize(database);
57− const storage = new SqliteWriterState(database, "long-atom");
58− const memory = new MemoryStore();
59− const value = "x".repeat(8100000);
60− new Project(memory).init({ "large.txt": value }, 0);
61− const entry = memory.entries[0]!;
62− if (entry.type !== "init") throw Error("expected init");
63− new Graph({ storage }).add(entry.atom);
64− assert.ok(JSON.stringify(storage.read("atoms", "0")).length < 4096);
65− const read = storage.read.bind(storage);
66− let textReads = 0;
67− t.mock.method(storage, "read", (collection: string, key: string) => {
68− if (collection === "atom-text:long:chunks") textReads++;
69− return read(collection, key);
70− });
71− const graph = new Graph({ storage });
72− const atom = graph.atom("a0");
73− assert.equal(textReads, 0, "reading atom metadata must not load long text");
74− assert.equal(atom.inserts[0]!.lines[0], value);
75− assert.ok(textReads > 0);
76− assert.equal(graph.lineText("a0.0"), value);
77− assert.equal(
78− database.db
79− .prepare(
80− "SELECT COUNT(*) AS n FROM writer_state WHERE namespace = 'long-atom' AND collection = 'atom-text:long:chunks' AND part = -1",
81− )
82− .get()!.n,
83− Math.ceil(value.length / 16384),
84− );
85− assert.equal(
86− database.db
87− .prepare(
88− "SELECT COUNT(*) AS n FROM writer_state WHERE namespace = 'long-atom' AND collection = 'line-text:long:chunks'",
89− )
90− .get()!.n,
91− 0,
92− );
93−});
94−
- MCP
- compare on this site's /mcp
- CLI
- abso diff 170 318 src/engine/test/graph-long-text.test.ts --json
- JSON
- /christopher/abso-core/compare/170..318?file=src%2Fengine%2Ftest%2Fgraph-long-text.test.ts&format=json