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 126 to 127

Compare

+43 −0 in 1 place
Lines 5–53 at 127 (were 5–10 at 126)
55import { lines, Repo } from "./helpers.ts";
66import { SqlState } from "./storage-helper.ts";
77
8+test("relocation indexes stream one fixed page before yielding and preserve order", () => {
9+ class ObservedStorage extends SqlState {
10+ pageReads = 0;
11+ largestPage = 0;
12+ override read(collection: string, key: string): unknown {
13+ if (collection.startsWith("relocat") && collection.endsWith(":pages")) this.pageReads++;
14+ return super.read(collection, key);
15+ }
16+ override write(collection: string, key: string, value: unknown): void {
17+ if (collection.startsWith("relocat") && collection.endsWith(":pages")) {
18+ assert.ok(Array.isArray(value));
19+ this.largestPage = Math.max(this.largestPage, value.length);
20+ }
21+ super.write(collection, key, value);
22+ }
23+ }
24+ const storage = new ObservedStorage();
25+ try {
26+ const oracle = Repo.init({ "a.txt": "one\n", "b.txt": "" });
27+ const move = oracle.draft({ move: { file: "a.txt", start: 0, end: 1, to: "b.txt", at: 0 } });
28+ const graph = new Graph({ storage });
29+ graph.add(oracle.graph.atom("a0"));
30+ for (let seq = 1; seq <= 513; seq++) {
31+ const atom = { ...move, id: `a${seq}`, seq };
32+ graph.add(atom);
33+ oracle.graph.add(atom);
34+ }
35+ const reopened = new Graph({ storage });
36+ storage.pageReads = 0;
37+ const iterator = reopened.eachRelocationOf("a0.0");
38+ assert.deepEqual(iterator.next().value, oracle.graph.relocationsOf("a0.0")[0]);
39+ assert.equal(storage.pageReads, 1, "first result must decode only one page");
40+ assert.deepEqual(reopened.relocationsOf("a0.0"), oracle.graph.relocationsOf("a0.0"));
41+ const parent = move.moves![0]!.parent;
42+ const code = reopened.codeOf(parent)!;
43+ assert.deepEqual(reopened.relocatedTo(parent), oracle.graph.relocatedTo(parent));
44+ assert.deepEqual([...reopened.eachRelocatedToCode(code)], oracle.graph.relocatedToCode(code));
45+ assert.equal(storage.largestPage, 256);
46+ } finally {
47+ storage.db.close();
48+ }
49+});
851test("hot claim indexes stream bounded pages after reopening", (t) => {
952 const oracle = Repo.init({ "a.txt": lines("one", "two") });
1053 const draft = oracle.draft({ edits: [{ file: "a.txt", old: "one", new: "ONE" }] });
MCP
compare on this site's /mcp
CLI
abso diff 126 127 src/engine/test/state-source.test.ts --json
JSON
/christopher/abso-core/compare/126..127?file=src%2Fengine%2Ftest%2Fstate-source.test.ts&format=json