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 196 to 318

Compare

+0 −68 in 1 place
server/test/autosettle.test.tsdeleted; this is the file as it was before+0 −68
--- a/server/test/autosettle.test.ts
+++ /dev/null
@@ -1,68 +0,0 @@
1−import assert from "node:assert/strict";
2−import { test } from "node:test";
3−import { type Ai, adviseHeld, refused, ruled } from "../src/autosettle.ts";
4−
5−/** A stand-in for Workers AI that always answers `pick`, and counts its calls. */
6−function fakeAi(pick: string): Ai & { calls: number } {
7− const ai = {
8− calls: 0,
9− async run() {
10− ai.calls++;
11− return { response: { pick, confidence: 0.9, reason: "a fixed answer" }, usage: { prompt_tokens: 10 } };
12− },
13− };
14− return ai;
15−}
16−
17−const held = (yours: string, theirs: string, kind = "lines") => ({
18− kind,
19− file: "src/a.ts",
20− yours: { lines: [3, 3] as [number, number], text: yours },
21− theirs: { agent: "other", message: "their reason", text: theirs },
22−});
23−
24−test("code settles when one side's lines are all in the other's, without asking the model", async () => {
25− const ai = fakeAi("both");
26− const [a] = await adviseHeld(ai, [held("\ttimeoutMs: 30000,\n", "\ttimeoutMs: 30000,\n\tretries: 2,\n")], {
27− agent: "me",
28− message: "my reason",
29− });
30− assert.equal(a?.pick, "theirs");
31− assert.equal(a?.by, "rule");
32− assert.equal(ai.calls, 0);
33−});
34−
35−test("a keep-both that sets one key twice, or holds one import in two versions, goes to an agent", () => {
36− const hold = (yours: string[], theirs: string[]) => ({ file: "a", base: [], yours, theirs, before: [], after: [] });
37− assert.match(refused(hold(["\tmaxNesting: 64,"], ["\tmaxNesting: 1000,"]), "both") ?? "", /maxNesting twice/);
38− assert.match(
39− refused(hold(['import { a, b, c } from "./x.ts";'], ['import { a, b, d } from "./x.ts";']), "both") ?? "",
40− /one statement in two versions/,
41− );
42− assert.equal(refused(hold(['\t"/blame": blame,'], ['\t"/search": search,']), "both"), undefined);
43− assert.equal(ruled(hold(['\t"/blame": blame,'], ['\t"/search": search,'])), undefined);
44−});
45−
46−test("the model's pick comes back with how many samples agree, and other kinds get no advice", async () => {
47− const ai = fakeAi("both");
48− const advice = await adviseHeld(
49− ai,
50− [held('\t"/blame": blame,\n', '\t"/search": search,\n'), held("x", "y", "definition")],
51− { agent: "me", message: "my reason" },
52− );
53− assert.equal(advice[0]?.pick, "both");
54− assert.equal(advice[0]?.by, "model");
55− assert.equal(advice[0]?.confidence, 1);
56− assert.equal(advice[1], null);
57− assert.equal(ai.calls, 5);
58−});
59−
60−test("a model that fails leaves no advice instead of failing the push's answer", async () => {
61− const ai: Ai = {
62− async run() {
63− throw new Error("Workers AI is down");
64− },
65− };
66− const [a] = await adviseHeld(ai, [held("a = 1", "b = 2")], { agent: "me", message: "m" });
67− assert.equal(a, null);
68−});
MCP
compare on this site's /mcp
CLI
abso diff 196 318 server/test/autosettle.test.ts --json
JSON
/christopher/abso-core/compare/196..318?file=server%2Ftest%2Fautosettle.test.ts&format=json