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 173 to 174

Compare

+50 −0 in 1 place
new file, 50 lines
1+// A server writer's own storage holds long atom text in chunks (moved here from src/engine/test/graph-long-text.test.ts:
2+// the engine's tests stay free of server/, which the platform's pin on the tool doesn't carry).
3+import assert from "node:assert/strict";
4+import { test } from "node:test";
5+import { Graph } from "../../src/engine/graph.ts";
6+import { MemoryStore, Project } from "../../worker/project/project.ts";
7+import { SqliteWriterState } from "../src/writer-host.ts";
8+import { memoryStorage } from "./helpers.ts";
9+
10+test("persistent atom metadata accepts text beyond the generic state limit", (t) => {
11+ const database = memoryStorage();
12+ t.after(() => database.db.close());
13+ SqliteWriterState.initialize(database);
14+ const storage = new SqliteWriterState(database, "long-atom");
15+ const memory = new MemoryStore();
16+ const value = "x".repeat(8100000);
17+ new Project(memory).init({ "large.txt": value }, 0);
18+ const entry = memory.entries[0]!;
19+ if (entry.type !== "init") throw Error("expected init");
20+ new Graph({ storage }).add(entry.atom);
21+ assert.ok(JSON.stringify(storage.read("atoms", "0")).length < 4096);
22+ const read = storage.read.bind(storage);
23+ let textReads = 0;
24+ t.mock.method(storage, "read", (collection: string, key: string) => {
25+ if (collection === "atom-text:long:chunks") textReads++;
26+ return read(collection, key);
27+ });
28+ const graph = new Graph({ storage });
29+ const atom = graph.atom("a0");
30+ assert.equal(textReads, 0, "reading atom metadata must not load long text");
31+ assert.equal(atom.inserts[0]!.lines[0], value);
32+ assert.ok(textReads > 0);
33+ assert.equal(graph.lineText("a0.0"), value);
34+ assert.equal(
35+ database.db
36+ .prepare(
37+ "SELECT COUNT(*) AS n FROM writer_state WHERE namespace = 'long-atom' AND collection = 'atom-text:long:chunks' AND part = -1",
38+ )
39+ .get()!.n,
40+ Math.ceil(value.length / 16384),
41+ );
42+ assert.equal(
43+ database.db
44+ .prepare(
45+ "SELECT COUNT(*) AS n FROM writer_state WHERE namespace = 'long-atom' AND collection = 'line-text:long:chunks'",
46+ )
47+ .get()!.n,
48+ 0,
49+ );
50+});
MCP
compare on this site's /mcp
CLI
abso diff 173 174 server/test/writer-long-atom.test.ts --json
JSON
/christopher/abso-core/compare/173..174?file=server%2Ftest%2Fwriter-long-atom.test.ts&format=json