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
blame on this site's /mcp
CLI
abso blame server/test/projected-sync.test.ts --json
JSON
/christopher/abso-core/blame/server/test/projected-sync.test.ts?format=json
43 linescodex-capacity-chair 100%Last change codex-capacity-chair in version 163,

43 lines from 1 change in 1 version.

codex-capacity-chair163Integrate reviewed disk-backed operations, queue and bounded read cachesCompare1import assert from "node:assert/strict";
2import { test } from "node:test";
3import { answer } from "../../worker/project/http.ts";
4import { DiskFirstRuntime } from "../src/disk-first-runtime.ts";
5import { memoryStorage } from "./helpers.ts";
6
7test("disk runtime syncs overlapping edits without unkeyed membership", (t) => {
8 const storage = memoryStorage();
9 t.after(() => storage.db.close());
10 const runtime = () => new DiskFirstRuntime(storage, "sync", "sync");
11 runtime().initialize(
12 (c) => answer(c, "init", undefined, { files: { "a.txt": "one\ntwo\nthree\n" } }),
13 () => {},
14 );
15 while (!runtime().preparePage(() => {}).ready) {}
16 const call = (op: string, agent: string, body: unknown) =>
17 runtime().write(
18 (c) => answer(c, op, agent, body),
19 () => {},
20 );
21 for (const agent of ["alice", "bob"]) assert.equal(call("sync", agent, {}).status, 200);
22 assert.equal(call("record", "alice", { files: { "a.txt": "one\nalice\nthree\n" } }).status, 200);
23 assert.equal(call("record", "bob", { files: { "a.txt": "one\nbob\nthree\n" } }).status, 200);
24 assert.equal(call("publish", "alice", { message: "alice" }).status, 200);
25 const result = call("sync", "bob", {});
26 assert.equal(result.status, 200, JSON.stringify(result));
27 const body = result.body as {
28 version: number;
29 files: Record<string, string>;
30 collisions: { kind: string; marked?: boolean }[];
31 };
32 assert.equal(body.version, 1);
33 assert.equal(body.collisions.length, 1);
34 assert.equal(body.collisions[0]!.kind, "lines");
35 assert.equal(body.collisions[0]!.marked, true);
36 assert.match(body.files["a.txt"]!, /<<<<<<< yours/);
37 assert.match(body.files["a.txt"]!, /bob/);
38 assert.match(body.files["a.txt"]!, /alice/);
39 const repeated = call("sync", "bob", {});
40 assert.equal(repeated.status, 200);
41 assert.equal((repeated.body as typeof body).collisions.length, 1);
42 assert.equal((repeated.body as typeof body).collisions[0]!.marked, true);
43});