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
show on this site's /mcp
CLI
abso show 11 --json
JSON
/christopher/abso-core/versions/11?format=json

Exit 1 when a file is left out for size: record and publish say so and still send the rest. Measured on abso 156: both exited 0 with a 21 MB file missing, so a script or CI read success. withLeftOut in commands.ts, used by record and publish; the existing blobs test now expects exit 1 and the left-out line and JSON (client suite: 170 pass). init is unchanged (its exit stays 0).

of shared·review··Not checked

Version 10 · Files at version 11

3 files, 47 lines added, 14 removed.

--- a/client/src/commands.ts
+++ b/client/src/commands.ts
@@ -120,6 +120,21 @@
120120 ];
121121}
122122
123+/**
124+ * A command that left files out for size did not do everything it was asked: say so in the exit code too, so
125+ * a script, CI or an agent cannot read "ok" while a file is missing. Other exits (refused, queued) stay as they are.
126+ */
127+export function withLeftOut(out: Output, leftOut: readonly LeftOut[]): Output {
128+ if (leftOut.length === 0) return out;
129+ const text = out.text.includes("Left out,") ? out.text : [out.text, ...leftOutText(leftOut)].join("\n");
130+ return {
131+ ...out,
132+ text: `${text}\nExit ${EXIT.error}: ${leftOut.length} file${leftOut.length === 1 ? " was" : "s were"} not sent.`,
133+ json: { ...out.json, leftOut },
134+ exit: out.exit === undefined || out.exit === EXIT.ok ? EXIT.error : out.exit,
135+ };
136+}
123138/** Upload binary files' bytes before the record or init that names them, each hash once. */
124139export async function uploadBlobs(api: Api, blobs: ReadonlyMap<string, BlobToSend>): Promise<void> {
125140 const seen = new Set<string>();
@@ -290,16 +305,19 @@
290305 r.sent === 0
291306 ? "Nothing to record: the folder matches what the server has."
292307 : `Recorded ${recordedList(r)}${changed === undefined ? "" : `; ${changed} changed on the server`}.`;
293− return {
294− text: [...turnedBinaryText(r.turnedBinary), text, ...leftOutText(r.leftOut)].join("\n"),
295− json: {
296− sent: r.sent,
297− changed: r.changed ?? null,
298− news: newsLines(r.news),
299− leftOut: r.leftOut,
300− turnedBinary: r.turnedBinary,
308+ return withLeftOut(
309+ {
310+ text: [...turnedBinaryText(r.turnedBinary), text, ...leftOutText(r.leftOut)].join("\n"),
311+ json: {
312+ sent: r.sent,
313+ changed: r.changed ?? null,
314+ news: newsLines(r.news),
315+ leftOut: r.leftOut,
316+ turnedBinary: r.turnedBinary,
317+ },
301318 },
302− };
319+ r.leftOut,
320+ );
303321}
304322
305323// --- writing answers into the folder ---
--- a/client/src/publish-commands.ts
+++ b/client/src/publish-commands.ts
@@ -18,10 +18,11 @@
1818 syncFolder,
1919 turnedBinaryText,
2020 unwrittenText,
21+ withLeftOut,
2122} from "./commands.ts";
2223import { type Config, isReader } from "./config.ts";
2324import { ignoredHere } from "./fetch.ts";
24−import { absolute, forgetKnown, isLocalOnly, loadIgnore, readText, writeFileAtomic } from "./folder.ts";
25+import { absolute, forgetKnown, isLocalOnly, type LeftOut, loadIgnore, readText, writeFileAtomic } from "./folder.ts";
2526import { PROJECT_FILE, readProjectFile } from "./project-file.ts";
2627import { pulledText, STILL_QUEUED, standing, WAIT_SECONDS, waitForQueued } from "./queue.ts";
2728import { type Refused, refusedText, unsafePath } from "./safety.ts";
@@ -186,15 +187,17 @@
186187 say("avcs: the check passed; publishing.\n");
187188 }
188189 const checked = check !== undefined;
189− const steps = publishSteps(args, env, root, config, api, message, checked, waitSeconds, skippedCheck);
190+ const leftOut: LeftOut[] = [];
191+ const steps = publishSteps(args, env, root, config, api, message, checked, waitSeconds, skippedCheck, leftOut);
190192 // Say how far it got when the server can't be reached (#37, GAME - UI/UX: did the check run? did the draft go up?).
191− const out = await unreached(
193+ const reached = await unreached(
192194 steps,
193195 checked
194196 ? "The check passed, but the publish never reached the server: nothing was published."
195197 : "Nothing was published.",
196198 `${checked ? "The check passed; " : ""}the publish may have reached the server before its answer was lost: abso status shows whether your draft was published.`,
197199 );
200+ const out = withLeftOut(reached, leftOut);
198201 // --done: this publish finishes the work the start note named (#44): take the note back once it's published or queued.
199202 const went =
200203 (out.json as { version?: unknown; queued?: unknown }).version !== undefined ||
@@ -282,8 +285,10 @@
282285 checked: boolean,
283286 waitSeconds: number,
284287 skippedCheck: boolean,
288+ leftOut: LeftOut[],
285289): Promise<Output> {
286290 const recorded = await recordFolder(root, api, false, meantBinary(args));
291+ leftOut.push(...recorded.leftOut);
287292 const pre = [...recordedFirst(recorded), ...droppedIgnoredText(await dropIgnoredFromDraft(root, api))];
288293 if (recorded.turnedBinary.length > 0) {
289294 // Publishing now would leave the others on the file's old text without anyone noticing (#25).
--- a/client/test/client.test.ts
+++ b/client/test/client.test.ts
@@ -232,7 +232,12 @@
232232 assert.deepEqual(init.json.leftOut, [{ path: "huge.bin", reason: "too big" }]);
233233 const hosted = fake.projects.get("blobs")!;
234234 assert.deepEqual(Object.keys(hosted.project.blobs()).sort(), ["big.txt", "pic.bin"]);
235− assert.equal((await avcs(dir, "record")).json.sent, 0, "the known blobs match");
235+ const again = await avcs(dir, "record");
236+ assert.equal(again.json.sent, 0, "the known blobs match");
237+ assert.equal(again.exit, 1, "a file left out for size is not a success");
238+ const saidSo = await main(["record"], { cwd: dir, env: ENV, write: () => {} });
239+ assert.match(saidSo.stdout, /Left out, over the server's 20 MB limit.*huge\.bin/);
240+ assert.match(saidSo.stdout, /Exit 1: 1 file was not sent\./);
236241
237242 // Another agent gets the bytes.
238243 const bob = temp();
@@ -251,7 +256,12 @@
251256 refused.stdout,
252257 /NOT SENT: b\.txt was text and now has a NUL byte at line 1 \(byte 0\)\..*pass --binary b\.txt\.\nNot published\./,
253258 );
254− assert.equal((await avcs(dir, "publish", "-m", "new picture, b is binary now", "--binary", "b.txt")).exit, 0);
259+ // The publish goes through, and still says the huge file was left out, with a non-zero exit.
260+ const published = await avcs(dir, "publish", "-m", "new picture, b is binary now", "--binary", "b.txt");
261+ assert.equal(published.exit, 1, published.out);
262+ assert.ok(published.json.version !== undefined, "the rest was published");
263+ assert.deepEqual(published.json.leftOut, [{ path: "huge.bin", reason: "too big" }]);
264+ rmSync(join(dir, "huge.bin")); // the rest of the test is about the files that do go
255265 assert.equal("b.txt" in shared("blobs"), false);
256266 assert.ok("b.txt" in hosted.project.blobs());
257267 assert.equal((await avcs(bob, "sync")).exit, 0);