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 116 to 318

Compare

+46 −0 in 1 place
new file, 46 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("partial atom-list persistence rolls back and retries on the same graph", () => {
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: 257 }, () => 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: [],
24+ holds: [],
25+ needs: [],
26+ resolves: [],
27+ reasons: [],
28+ deps: ["a0"],
29+ };
30+ const before = storage.db.prepare("SELECT * FROM state ORDER BY collection,key").all();
31+ const write = storage.write.bind(storage);
32+ storage.write = (collection, key, value) => {
33+ write(collection, key, value);
34+ // Partway through: the second of the list's two pages (256 values to a page).
35+ if (collection === "atom-list:1:writes:pages" && key === "1") throw Error("injected list persistence failure");
36+ };
37+ assert.throws(() => graph.add(atom), /injected list persistence failure/);
38+ assert.deepEqual(storage.db.prepare("SELECT * FROM state ORDER BY collection,key").all(), before);
39+ assert.equal(graph.size, 1);
40+ storage.write = write;
41+ graph.add(atom);
42+ assert.deepEqual([...new Graph({ storage }).atom("a1").writes], keys);
43+ } finally {
44+ storage.db.close();
45+ }
46+});
MCP
compare on this site's /mcp
CLI
abso diff 116 318 src/engine/test/graph-atom-list-rollback.test.ts --json
JSON
/christopher/abso-core/compare/116..318?file=src%2Fengine%2Ftest%2Fgraph-atom-list-rollback.test.ts&format=json