- MCP
- blame on this site's /mcp
- CLI
- abso blame worker/project/test/order.test.ts --json
- JSON
- /christopher/abso-core/blame/worker/project/test/order.test.ts?format=json
68 linesFirst import 94% · pinch 4% · rename 1%Last change rename in version 100,
68 lines from 3 changes in 3 versions.
init0Start the project1// Randomized: agents edit lines far enough apart that the engine's rule finds
2// no collision. Every publish order must go through and give the same files,
3// equal to doing all the edits to plain text.
5import assert from "node:assert/strict";
6import { test } from "node:test";
7import { MemoryStore, Project } from "../project.ts";
9function rng(seed: number): () => number {
10 let s = seed >>> 0;
11 return () => {
12 s = (s + 0x6d2b79f5) >>> 0;
13 let t = s;
14 t = Math.imul(t ^ (t >>> 15), t | 1);
15 t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
16 return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
17 };
18}
20interface Plan {
21 agent: string;
22 start: number;
23 end: number;
24 lines: string[];
25}
rename100abso publish is now abso push, abso sync is now abso pull (abso 427)
Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing.
push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch.
Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare27test("changes that do not collide give the same files in every push order", () => {
29 const rand = rng(seed);
30 const pick = (n: number): number => Math.floor(rand() * n);
31 const count = 12 + pick(30);
32 const base = Array.from({ length: count }, (_, i) => `line ${i}`);
33 // Cut the file into regions with two untouched lines between them.
34 const plans: Plan[] = [];
35 let at = pick(3);
36 let n = 0;
37 while (at < count) {
38 const len = pick(3); // 0 = pure insertion
39 if (at + len > count) break;
40 const lines = Array.from({ length: pick(3) + (len === 0 ? 1 : 0) }, (_, i) => `agent${n} new ${i}`);
41 if (len > 0 || lines.length > 0) plans.push({ agent: `agent${n++}`, start: at, end: at + len, lines });
42 at += len + 2 + pick(3);
43 }
44 if (plans.length < 2) continue;
46 const expected = [...base];
47 for (const p of [...plans].reverse()) expected.splice(p.start, p.end - p.start, ...p.lines);
pinch78Biome is silent: about 90 hints cleared. String joins as templates, dotted keys, unused imports, variables and a private method removed, optional chains (one kept boolean with === true), the preset field instead of the deprecated recommended. Two rules off where they don't fit: noExplicitAny in the hook modules, whose engine types come from the host, and noTemplateCurlyInString in tests, which hold source text as data.Compare48 const expectedText = expected.length > 0 ? `${expected.join("\n")}\n` : undefined;
50 const orders = [plans.map((_, i) => i), plans.map((_, i) => plans.length - 1 - i)];
51 for (let k = 0; k < 3; k++) orders.push([...orders[0]!].sort(() => rand() - 0.5));
52 for (const order of orders) {
53 const project = new Project(new MemoryStore());
pinch78Biome is silent: about 90 hints cleared. String joins as templates, dotted keys, unused imports, variables and a private method removed, optional chains (one kept boolean with === true), the preset field instead of the deprecated recommended. Two rules off where they don't fit: noExplicitAny in the hook modules, whose engine types come from the host, and noTemplateCurlyInString in tests, which hold source text as data.Compare54 project.init({ "f.txt": `${base.join("\n")}\n` }, 0);
56 project.sync(p.agent);
57 const lines = [...base];
58 lines.splice(p.start, p.end - p.start, ...p.lines);
pinch78Biome is silent: about 90 hints cleared. String joins as templates, dotted keys, unused imports, variables and a private method removed, optional chains (one kept boolean with === true), the preset field instead of the deprecated recommended. Two rules off where they don't fit: noExplicitAny in the hook modules, whose engine types come from the host, and noTemplateCurlyInString in tests, which hold source text as data.Compare59 project.record(p.agent, { "f.txt": `${lines.join("\n")}\n` }, 1);
61 for (const i of order) {
62 const answer = project.publish(plans[i]!.agent, "m", 2);
63 assert.equal(answer.ok, true, `seed ${seed}, order ${order}: ${JSON.stringify(answer)}`);
64 }
65 assert.equal(project.files()["f.txt"], expectedText, `seed ${seed}, order ${order}`);
66 }
67 }
68});