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
42 linescodex-capacity-chair 100%Last change codex-capacity-chair in version 162, 1 version changed it
1import assert from "node:assert/strict";
2import { test } from "node:test";
3import { buildBase, Graph } from "../index.ts";
4import { lineKey } from "../keys.ts";
5import type { Atom } from "../types.ts";
6import { SqlState } from "./storage-helper.ts";
7
8test("replacement membership distinguishes first, repeated and previous deletions", () => {
9 const storage = new SqlState();
10 try {
11 const graph = new Graph({ storage });
12 const oracle = new Graph();
13 const base = buildBase({ "a.txt": "base" }, { author: "fixture", message: "base", time: 0 });
14 graph.add(base);
15 oracle.add(base);
16 for (let seq = 1; seq <= 3; seq++) {
17 const deleting = seq < 3;
18 const atom: Atom = {
19 id: `a${seq}`,
20 seq,
21 author: "fixture",
22 message: "replacement",
23 time: seq,
24 inserts: [{ file: "a.txt", parent: "a0.0", lines: [`new ${seq}`] }],
25 deletes: deleting ? ["a0.0"] : [],
26 writes: deleting ? [lineKey("a0.0")] : [],
27 reads: [],
28 holds: [],
29 needs: [],
30 resolves: [],
31 reasons: [],
32 deps: [`a${seq - 1}`],
33 };
34 graph.add(atom);
35 oracle.add(atom);
36 assert.equal(graph.replaces(`a${seq}.0`), deleting);
37 assert.equal(new Graph({ storage }).replaces(`a${seq}.0`), oracle.replaces(`a${seq}.0`));
38 }
39 } finally {
40 storage.db.close();
41 }
42});