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 147 to 148

Compare

+33 −0 in 1 place
new file, 33 lines
1+import assert from "node:assert/strict";
2+import { test } from "node:test";
3+import { Graph } from "../graph.ts";
4+import { Repo } from "./helpers.ts";
5+import { SqlState } from "./storage-helper.ts";
6+
7+test("indexed identities and metadata do not decode atom payloads", () => {
8+ const db = new SqlState();
9+ try {
10+ const repo = Repo.init({ "a.txt": "one\ntwo\n" });
11+ const graph = new Graph({ storage: db });
12+ graph.add(repo.graph.atom("a0"));
13+ const read = db.read.bind(db);
14+ db.read = (collection, key) => {
15+ if (collection === "atoms") throw Error("atom payload read forbidden");
16+ return read(collection, key);
17+ };
18+ assert.equal(graph.idOfSeq(0), "a0");
19+ assert.equal(graph.lamport("a0"), 0);
20+ assert.deepEqual(graph.filesOf("a0"), ["a.txt"]);
21+ assert.equal(graph.line("a0.0")?.atom, "a0");
22+ assert.equal(graph.lineIdOf(0), "a0.0");
23+ for (const seq of [-1, 1, 0.5, NaN, Infinity]) assert.throws(() => graph.idOfSeq(seq), /no atom/);
24+ for (const id of ["a1", "a00", "a-1", "invalid"]) {
25+ assert.throws(() => graph.lamport(id), /no atom/);
26+ assert.throws(() => graph.filesOf(id), /no atom/);
27+ }
28+ assert.equal(graph.line("a1.0"), undefined);
29+ assert.throws(() => graph.atom("a0"), /payload read forbidden/);
30+ } finally {
31+ db.db.close();
32+ }
33+});
MCP
compare on this site's /mcp
CLI
abso diff 147 148 src/engine/test/graph-metadata-indexed.test.ts --json
JSON
/christopher/abso-core/compare/147..148?file=src%2Fengine%2Ftest%2Fgraph-metadata-indexed.test.ts&format=json