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 161 to 162

Compare

+51 −0 in 1 place
new file, 51 lines
1+import assert from "node:assert/strict";
2+import { test } from "node:test";
3+import { buildBase, Graph } from "../index.ts";
4+import { lineKey } from "../keys.ts";
5+import type { Atom } from "../types.ts";
6+import { SqlState } from "./storage-helper.ts";
7+
8+test("large persisted atom lists stay out of metadata and read incrementally", () => {
9+ const storage = new SqlState();
10+ try {
11+ const graph = new Graph({ storage });
12+ graph.add(buildBase({ "a.txt": "base" }, { author: "fixture", message: "base", time: 0 }));
13+ const keys = Array.from({ length: 513 }, () => lineKey("a0.0"));
14+ const atom: Atom = {
15+ id: "a1",
16+ seq: 1,
17+ author: "fixture",
18+ message: "lists",
19+ time: 1,
20+ inserts: [],
21+ deletes: [],
22+ writes: keys,
23+ reads: keys,
24+ holds: keys,
25+ needs: [],
26+ resolves: [],
27+ reasons: [],
28+ deps: ["a0"],
29+ };
30+ graph.add(atom);
31+ assert.ok(JSON.stringify(storage.read("atoms", "1")).length < 2048);
32+ let items = 0;
33+ const read = storage.read.bind(storage);
34+ storage.read = (collection, key) => {
35+ if (collection.startsWith("atom-list:") && !collection.endsWith(":meta")) items++;
36+ return read(collection, key);
37+ };
38+ const saved = new Graph({ storage }).atom("a1");
39+ assert.equal(items, 0);
40+ assert.equal(saved.writes.length, 513);
41+ assert.equal(items, 0);
42+ assert.equal(saved.writes[512], keys[512]);
43+ assert.equal(items, 1);
44+ assert.throws(() => {
45+ (saved.writes as string[])[0] = "changed";
46+ }, /read-only/);
47+ assert.deepEqual([...saved.writes], keys);
48+ } finally {
49+ storage.db.close();
50+ }
51+});
MCP
compare on this site's /mcp
CLI
abso diff 161 162 src/engine/test/graph-atom-lists.test.ts --json
JSON
/christopher/abso-core/compare/161..162?file=src%2Fengine%2Ftest%2Fgraph-atom-lists.test.ts&format=json