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 24 to 25

Compare

+71 −0 in 1 place
new file, 71 lines
1+// The project file's new name (224): abso.json is read first, then avcs.json
2+// from before the rename. Both are checked the same way, and when shared has
3+// both, abso.json counts and status says avcs.json is ignored.
4+
5+import assert from "node:assert/strict";
6+import { test } from "node:test";
7+import { MemoryStore, Project } from "../project.ts";
8+
9+const review = (reviewer: string) => JSON.stringify({ review: [{ paths: ["src/**"], reviewer }] }) + "\n";
11+function touchSrc(project: Project, time: number): void {
12+ project.sync("builder");
13+ const a = project.edit("builder", { file: "src/a.ts", old: `${time - 1}`, new: `${time}` }, time);
14+ if (!a.ok) throw new Error("edit out of step");
15+ project.publish("builder", `a ${time}`, time + 1);
16+}
18+test("abso.json alone is the project file: its reviewers are told", () => {
19+ const project = new Project(new MemoryStore(), { now: () => 100 });
20+ project.init({ "abso.json": review("security"), "src/a.ts": "export const a = 0;\n" }, 0);
21+ project.sync("security");
22+ touchSrc(project, 1);
23+ assert.equal(project.news("security").news.length, 1);
24+ assert.equal(project.status().projectFile, undefined, "one file: nothing to say");
25+});
27+test("avcs.json alone still works", () => {
28+ const project = new Project(new MemoryStore(), { now: () => 100 });
29+ project.init({ "avcs.json": review("security"), "src/a.ts": "export const a = 0;\n" }, 0);
30+ project.sync("security");
31+ touchSrc(project, 1);
32+ assert.equal(project.news("security").news.length, 1);
33+});
35+test("with both, abso.json counts and status says avcs.json is ignored", () => {
36+ const project = new Project(new MemoryStore(), { now: () => 100 });
37+ project.init(
38+ { "abso.json": review("security"), "avcs.json": review("writer"), "src/a.ts": "export const a = 0;\n" },
39+ 0,
40+ );
41+ for (const a of ["security", "writer"]) project.sync(a);
42+ touchSrc(project, 1);
43+ assert.equal(project.news("security").news.length, 1);
44+ assert.equal(project.news("writer").news.length, 0, "avcs.json is ignored");
45+ assert.deepEqual(project.status().projectFile, { used: "abso.json", ignored: "avcs.json" });
46+});
48+test("a broken abso.json is refused like a broken avcs.json, at publish and at init", () => {
49+ const project = new Project(new MemoryStore());
50+ project.init({ "abso.json": '{"queue": false}\n' }, 0);
51+ project.sync("alice");
52+ project.record("alice", { "abso.json": '{"queue": "yes"}\n' }, 1);
53+ assert.throws(() => project.publish("alice", "queue as text", 2), /abso\.json has "queue" that isn't true or false/);
54+ assert.equal(project.files()["abso.json"], '{"queue": false}\n', "shared keeps the good one");
55+ // A broken avcs.json is still refused when abso.json is there too: it may be read again once abso.json goes.
56+ project.record("alice", { "abso.json": '{"queue": false}\n', "avcs.json": "[1]\n" }, 3);
57+ assert.throws(() => project.publish("alice", "old file broken", 4), /avcs\.json must be a JSON object/);
58+ assert.throws(
59+ () => new Project(new MemoryStore()).init({ "abso.json": "[1]\n" }, 0),
60+ /init: abso\.json must be a JSON object/,
61+ );
62+});
64+test(".abso/ stays in the agent's folder, like .avcs/", () => {
65+ const project = new Project(new MemoryStore());
66+ project.init({ "a.txt": "a\n" }, 0);
67+ for (const p of [".abso/config.json", "sub/.ABSO/x", ".avcs/config.json"]) {
68+ assert.throws(() => project.record("ann", { [p]: "x\n" }, 1), /is under \.(abso|avcs)\//, p);
69+ }
70+ assert.equal(project.record("ann", { ".absolutely.txt": "x\n" }, 1) !== undefined, true);
71+});
MCP
compare on this site's /mcp
CLI
abso diff 24 25 worker/project/test/project-file.test.ts --json
JSON
/christopher/abso-core/compare/24..25?file=worker%2Fproject%2Ftest%2Fproject-file.test.ts&format=json