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 149 to 150

Compare

+37 −0 in 1 place
new file, 37 lines
1+import assert from "node:assert/strict";
2+import { describe, it } from "node:test";
3+import { answer } from "../../worker/project/http.ts";
4+import { EngineProject, SqliteLog } from "../src/engine-project.ts";
5+import { memoryStorage } from "./helpers.ts";
6+
7+describe("the engine over the object's SQLite log", () => {
8+ it("serves init, records and pushes through answer(), and holds a collision", () => {
9+ const storage = memoryStorage();
10+ const p = EngineProject.open(storage);
11+ assert.equal(answer(p, "init", undefined, { files: { "a.txt": "one\ntwo\nthree\n" } }).status, 200);
12+ for (const agent of ["alice", "bob"]) assert.equal(answer(p, "sync", agent, {}).status, 200);
13+ answer(p, "record", "alice", { files: { "a.txt": "one\nTWO by alice\nthree\n" } });
14+ answer(p, "record", "bob", { files: { "a.txt": "one\ntwo by bob\nthree\n" } });
15+ const first = answer(p, "publish", "alice", { message: "Alice's two" });
16+ assert.deepEqual(first, { status: 200, body: { ok: true, version: 1, changes: 1 } });
17+ const second = answer(p, "publish", "bob", { message: "Bob's two" }).body as { ok: boolean; collisions: unknown[] };
18+ assert.equal(second.ok, false);
19+ assert.equal(second.collisions.length, 1);
20+ });
22+ it("loads the same project back from the log", () => {
23+ const storage = memoryStorage();
24+ const p = EngineProject.open(storage);
25+ answer(p, "init", undefined, { files: { "a.txt": "one\n" } });
26+ answer(p, "sync", "alice", {});
27+ answer(p, "record", "alice", { files: { "a.txt": "one\ntwo\n" } });
28+ answer(p, "publish", "alice", { message: "Add two" });
29+ const again = EngineProject.open(storage);
30+ assert.equal(again.shared().version, 1);
31+ assert.equal(again.shared().files["a.txt"], "one\ntwo\n");
32+ const log = new SqliteLog(storage);
33+ assert.equal(log.sharedVersion(), 1);
34+ assert.deepEqual(log.lastPublish()?.agent, "alice");
35+ assert.equal(log.logSize().entries, log.seq());
36+ });
37+});
MCP
compare on this site's /mcp
CLI
abso diff 149 150 server/test/engine-project.test.ts --json
JSON
/christopher/abso-core/compare/149..150?file=server%2Ftest%2Fengine-project.test.ts&format=json