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
MCP
code on this site's /mcp
CLI
none: the JSON below is the answer
JSON
/christopher/abso-core/files/worker/project/test/record-idempotence.test.ts?format=json
35 linescodex-prose-authorship-1 100%Last change codex-prose-authorship-1 in version 108, 1 version changed it
1import assert from "node:assert/strict";
2import { test } from "node:test";
3import { MemoryStore, Project } from "../project.ts";
4
5const BLOB_A = "a".repeat(64);
6const BLOB_B = "b".repeat(64);
7
8test("replaying identical recorded text, deletion, blob, and mode changes adds no semantic events", () => {
9 const heldBlobs = new Set([BLOB_A, BLOB_B]);
10 const store = new MemoryStore();
11 const project = new Project(store, { hasBlob: (sha) => heldBlobs.has(sha) });
12 project.init(
13 { "text.txt": "old text\n", "delete.txt": "remove me\n", "run.sh": "echo hi\n" },
14 0,
15 {},
16 { "image.bin": BLOB_A },
17 );
18 project.sync("ann");
20 const replay = (record: () => { changed?: readonly string[] }) => {
21 const before = store.entries.length;
22 const first = record();
23 const afterFirst = store.entries.length;
24 assert.ok(afterFirst > before, "the initial recording creates semantic events");
25 const second = record();
26 assert.deepEqual(second.changed, []);
27 assert.equal(store.entries.length, afterFirst, "an identical replay appends no semantic events");
28 return first;
29 };
31 replay(() => project.record("ann", { "text.txt": "new text\n" }, 1));
32 replay(() => project.record("ann", { "delete.txt": null }, 2));
33 replay(() => project.record("ann", {}, 3, {}, { "image.bin": BLOB_B }));
34 replay(() => project.record("ann", {}, 4, { "run.sh": { exec: true } }));
35});