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 244 --json
JSON
/christopher/abso-core/versions/244?format=json

compare keeps its own answer type; the summary is compareSummary (abso issue 680; abso Capacity).

of shared·capacity··Not checked

243 gave compare one answer type for both shapes, full and summary. abso's own callers read compare(...).files as file changes (worker/src/engine-project.ts, scripts/versions-check.ts, test/versions.test.ts), and the union broke their types, which showed when I pinned 243 into abso. Core's own tests didn't catch it.

  • version-log.ts: compared() works out the files and both views; compare answers {from, to, files: FileChange[]} as before 243, and compareSummary answers {from, to, summary: true, files}. Project.compareSummary calls it.
  • server/src/engine-project.ts: compare(..., summary) calls compareSummary when summary is set. http.ts and ProjectHistory are unchanged from 243 (?summary=1, a fifth argument).
  • compare-summary.test.ts calls compareSummary.

Answers are the same as 243's. Every engine test (292 of 292), every worker/project test (342 of 342); tsc (worker and server) and biome clean.

Version 243 · Files at version 244

4 files, 37 lines added, 15 removed.

--- a/server/src/engine-project.ts
+++ b/server/src/engine-project.ts
@@ -524,7 +524,8 @@
524524 return this.project.fileAt(path, version, { draft, ...(agent ? { agent } : {}) });
525525 }
526526 compare(from: number, to: number, draft: string | null, agent?: string, summary?: boolean) {
527− return this.project.compare(from, to, { draft, ...(agent ? { agent } : {}), ...(summary ? { summary } : {}) });
527+ const where = { draft, ...(agent ? { agent } : {}) };
528+ return summary ? this.project.compareSummary(from, to, where) : this.project.compare(from, to, where);
528529 }
529530 without(version: number, versions: readonly number[]) {
530531 return this.project.without(version, versions);
--- a/worker/project/project.ts
+++ b/worker/project/project.ts
@@ -203,6 +203,7 @@
203203import {
204204 type LogHost,
205205 compare as versionCompare,
206+ compareSummary as versionCompareSummary,
206207 fileAt as versionFileAt,
207208 log as versionLog,
208209 ribbon as versionRibbon,
@@ -1861,6 +1862,11 @@
18611862 return versionCompare(this.#logHost, ...args);
18621863 }
18631864
1865+ /** compare as each file's size and SHA-256, not its texts (version-log.ts, abso issue 680). */
1866+ compareSummary(...args: Tail<Parameters<typeof versionCompareSummary>>): ReturnType<typeof versionCompareSummary> {
1867+ return versionCompareSummary(this.#logHost, ...args);
1868+ }
18641870 /** A version of shared without some earlier versions, or the refusal naming what builds on them (without.ts). */
18651871 without(version: number, versions: readonly number[]): ReturnType<typeof hostedWithout> {
18661872 const host: WithoutHost = {
--- a/worker/project/test/compare-summary.test.ts
+++ b/worker/project/test/compare-summary.test.ts
@@ -48,7 +48,7 @@
4848 for (const project of [new Project(new MemoryStore(), { hasBlob: held }), writer()]) {
4949 history(project);
5050 const full = project.compare(0, 1);
51− const summary = project.compare(0, 1, { summary: true });
51+ const summary = project.compareSummary(0, 1);
5252 if ("summary" in full || !("summary" in summary)) throw Error("compare answered the wrong shape");
5353 assert.deepEqual(
5454 summary.files.map((f) => f.path),
--- a/worker/project/version-log.ts
+++ b/worker/project/version-log.ts
@@ -238,15 +238,13 @@
238238 };
239239}
240240
241−/** Every file that differs between two versions of shared (or a named draft), before (at `from`) and after (at `to`). */
242−export function compare(
241+/** The files that may differ between two versions, and both views: compare's and compareSummary's ground. */
242+function compared(
243243 host: LogHost,
244244 from: number,
245245 to: number,
246− options: { draft?: string | null; agent?: string; summary?: boolean } = {},
247−):
248− | { from: number; to: number; files: FileChange[] }
249− | { from: number; to: number; summary: true; files: ReturnType<typeof summariesBetween> } {
246+ options: { draft?: string | null; agent?: string },
247+): { before: ReadView; after: ReadView; files: Set<string> } {
250248 host.needInit();
251249 const space = host.spaceFor(options);
252250 host.checkVersion(space, from);
@@ -254,18 +252,13 @@
254252 const before = host.viewAt(space, from);
255253 const after = host.viewAt(space, to);
256254 const files = new Set<string>();
257− // With summary, each file's size and SHA-256 instead of its texts (abso issue 680).
258− const answer = (paths: Iterable<string>) =>
259− options.summary
260− ? { from, to, summary: true as const, files: summariesBetween(before, after, paths) }
261− : { from, to, files: changesBetween(before, after, paths) };
262255 // A stored writer keeps each shared version's changed files (version-files.ts, abso Capacity): every file that
263256 // differs between two versions changed in one between them, so those lists are the candidates, not every atom
264257 // either set holds.
265258 if (space.name === SHARED && host.graph.packedFiles) {
266259 for (let v = Math.min(from, to) + 1; v <= Math.max(from, to); v++)
267260 for (const file of host.paths.versionFiles(space, v)) files.add(file);
268− return answer(files);
261+ return { before, after, files };
269262 }
270263 const a = host.at(space, from);
271264 const b = host.at(space, to);
@@ -281,9 +274,31 @@
281274 ))
282275 files.add(file);
283276 }
284− return answer(files);
277+ return { before, after, files };
285278}
286279
280+/** Every file that differs between two versions of shared (or a named draft), before (at `from`) and after (at `to`). */
281+export function compare(
282+ host: LogHost,
283+ from: number,
284+ to: number,
285+ options: { draft?: string | null; agent?: string } = {},
286+): { from: number; to: number; files: FileChange[] } {
287+ const { before, after, files } = compared(host, from, to, options);
288+ return { from, to, files: changesBetween(before, after, files) };
289+}
291+/** compare's files as each one's size and SHA-256 before and after, not its texts (abso issue 680). */
292+export function compareSummary(
293+ host: LogHost,
294+ from: number,
295+ to: number,
296+ options: { draft?: string | null; agent?: string } = {},
297+): { from: number; to: number; summary: true; files: ReturnType<typeof summariesBetween> } {
298+ const { before, after, files } = compared(host, from, to, options);
299+ return { from, to, summary: true, files: summariesBetween(before, after, files) };
300+}
287302/** A version of shared (or of a named draft) as a ReadView, for reading lines (blame at a version). */
288303export function viewAt(
289304 host: LogHost,