Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 165 to 318

Compare

+22 −45 in 2 places
Lines 4–31 at 318 (were 4–9 at 165)
44import { Graph } from "../graph.ts";
55import { SqlState } from "./storage-helper.ts";
66
7+test("large insertion text stays lazy even when the run has few lines", (t) => {
8+ const storage = new SqlState();
9+ t.after(() => storage.db.close());
10+ const memory = new MemoryStore();
11+ const line = "x".repeat(100000);
12+ new Project(memory).init({ "a.txt": `${line}\n${line}\n${line}\n` }, 0);
13+ const entry = memory.entries[0]!;
14+ if (entry.type !== "init") throw Error("expected init");
15+ new Graph({ storage }).add(entry.atom);
16+ const read = storage.read.bind(storage);
17+ let textReads = 0;
18+ t.mock.method(storage, "read", (collection: string, key: string) => {
19+ if (collection === "atom-text:long:chunks") textReads++;
20+ return read(collection, key);
21+ });
22+ const atom = new Graph({ storage }).atom("a0");
23+ assert.equal(atom.inserts[0]!.lines.length, 3);
24+ assert.equal(textReads, 0, "reading line count must not decode the complete run");
25+ assert.equal(atom.inserts[0]!.lines[1], line);
26+ assert.equal(textReads, Math.ceil(line.length / 16384), "an indexed read decodes only the selected line");
27+});
729test("persistent graph stores long lines in chunks and reopens exact text", () => {
830 const storage = new SqlState();
931 try {
Lines 47–52 at 318 (were 25–75 at 165)
2547 }
2648});
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−
7350test("long atom acceptance rolls back partial chunks and detects missing text", (t) => {
7451 const storage = new SqlState();
7552 t.after(() => storage.db.close());
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