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

Compare

+47 −0 in 1 place
new file, 47 lines
1+import assert from "node:assert/strict";
2+import { test } from "node:test";
3+import { buildBase, Graph } from "../index.ts";
4+import type { Atom } from "../types.ts";
5+import { SqlState } from "./storage-helper.ts";
6+
7+test("persistent atom validation uses rollback scratch for memberships", () => {
8+ const storage = new SqlState();
9+ try {
10+ const graph = new Graph({ storage });
11+ graph.add(buildBase({ "a.txt": "base" }, { author: "fixture", message: "base", time: 0 }));
12+ const atom: Atom = {
13+ id: "a1",
14+ seq: 1,
15+ author: "fixture",
16+ message: "next",
17+ time: 1,
18+ inserts: [],
19+ deletes: [],
20+ writes: [],
21+ reads: [],
22+ holds: [],
23+ needs: [],
24+ resolves: [],
25+ reasons: [],
26+ deps: ["a0"],
27+ };
28+ const before = storage.db.prepare("SELECT * FROM state ORDER BY collection,key").all();
29+ assert.throws(() => graph.add({ ...atom, deps: ["a0", "a0"] }), /listed twice/);
30+ assert.deepEqual(storage.db.prepare("SELECT * FROM state ORDER BY collection,key").all(), before);
31+ let scratchWrites = 0;
32+ const write = storage.write.bind(storage);
33+ storage.write = (collection, key, value) => {
34+ if (collection.startsWith("projection-scratch:") && collection.endsWith(":deps")) scratchWrites++;
35+ write(collection, key, value);
36+ };
37+ graph.add(atom);
38+ assert.ok(scratchWrites > 0);
39+ assert.equal(
40+ storage.db.prepare("SELECT COUNT(*) AS n FROM state WHERE collection LIKE 'projection-scratch:%'").get()!.n,
41+ 0,
42+ );
43+ assert.equal(new Graph({ storage }).size, 2);
44+ } finally {
45+ storage.db.close();
46+ }
47+});
MCP
compare on this site's /mcp
CLI
abso diff 102 318 src/engine/test/graph-validation-scratch.test.ts --json
JSON
/christopher/abso-core/compare/102..318?file=src%2Fengine%2Ftest%2Fgraph-validation-scratch.test.ts&format=json