compare's summary: each changed file's size and SHA-256 instead of its texts (abso issue 680; disk-first 2; abso Capacity). Version 243 of shared· capacity· Oct 15 (2026-10-15 14:00 UTC) · Not checked
compare 612 to 1224 on abso answers 13.2 MB: the full before and after text of about 3,000 changed files. Read Speed's shape lets the site ask for a summary and fetch a file's texts when it opens it.
view-changes.ts summariesBetween: the files changesBetween would list, each side as {size, sha256} for text (UTF-8 bytes, SHA-256 of the text), {blob} for a binary file (its hash; the Worker adds its size from the blob store), or null when absent; mode and blob as in the full answer. Each text is read, summed up and let go. version-log compare takes summary and answers {from, to, summary: true, files}. ProjectHistory.compare and both engine-project.ts implementations take a fifth argument, summary; http.ts passes ?summary=1. The full answer is unchanged. On abso adopted fresh: the summary for 612 to 1224 is 174 KB instead of 13.2 MB, with heap after at 38 MB. The time is the same (about 20 s cold): it still lays the files out to hash them. Stored per-version sizes and hashes would remove that; they're proposed with the author totals table.
New test compare-summary: on an in-memory and a writer-backed project, the summary lists the files the full compare does, with sizes and SHA-256s of its texts, blob hashes for a binary file, and no text. Every engine test (292 of 292), every worker/project test (342 of 342); tsc (worker and server) and biome clean.
Version 242 · Files at version 243
6 files, 133 lines added, 9 removed.
--- a/server/src/engine-project.ts
+++ b/server/src/engine-project.ts
@@ -523,8 +523,8 @@
523 523 fileAt(path: string, version: number, draft: string | null, agent?: string) { 524 524 return this.project.fileAt(path, version, { draft, ...(agent ? { agent } : {}) }); 526 − compare(from: number, to: number, draft: string | null, agent?: string) {
527 − return this.project.compare(from, to, { draft, ...(agent ? { agent } : {}) });
526 + compare(from: number, to: number, draft: string | null, agent?: string, summary?: boolean) { 527 + return this.project.compare(from, to, { draft, ...(agent ? { agent } : {}), ...(summary ? { summary } : {}) }); 529 529 without(version: number, versions: readonly number[]) { 530 530 return this.project.without(version, versions); --- a/worker/project/http.ts
+++ b/worker/project/http.ts
@@ -392,7 +392,8 @@
392 392 const from = int(q.from); 393 393 const to = int(q.to); 394 394 if (from === undefined || to === undefined) return fail(400, "compare needs ?from=<number>&to=<number>"); 395 − return { status: 200, body: history.compare(from, to, draft, who) };
395 + // summary=1: each file's size and SHA-256, not its texts (abso issue 680). 396 + return { status: 200, body: history.compare(from, to, draft, who, q.summary === "1") }; 397 398 const version = Number(q.version); 398 399 if (q.version === undefined || !Number.isInteger(version)) return fail(400, "show needs ?version=<number>"); --- a/worker/project/project-api.ts
+++ b/worker/project/project-api.ts
@@ -156,7 +156,7 @@
156 156 /** A file as it was at a version (#27). */ 157 157 fileAt(path: string, version: number, draft: string | null, agent?: string): unknown; 158 158 /** Every file that differs between two versions (#27). */ 159 − compare(from: number, to: number, draft: string | null, agent?: string): unknown;
159 + compare(from: number, to: number, draft: string | null, agent?: string, summary?: boolean): unknown; 160 160 /** Version `version` of shared without the versions in `versions` (without.ts). */ 161 161 without(version: number, versions: readonly number[]): unknown; 162 162 /** One version: who, why, and each file before and after (#27). */ --- /dev/null
+++ b/worker/project/test/compare-summary.test.ts
@@ -0,0 +1,72 @@
1 + // compare's summary (abso issue 680): every file a full compare lists, with its size in UTF-8 bytes and SHA-256 before 2 + // and after instead of its texts, or its blob's hash for a binary file. The same on a writer-backed project as in 5 + import assert from "node:assert/strict"; 6 + import { createHash } from "node:crypto"; 7 + import { test } from "node:test"; 8 + import { storedArray } from "../../../src/engine/state-source.ts"; 9 + import { SqlState } from "../../../src/engine/test/storage-helper.ts"; 10 + import { MemoryStore, Project } from "../project.ts"; 11 + import type { Entry, ProjectStore } from "../project-types.ts"; 13 + const A = "a".repeat(64); 14 + const B = "b".repeat(64); 15 + const held = (sha: string) => sha === A || sha === B; 18 + const storage = new SqlState(); 19 + const entries = storedArray<Entry>(storage, "canonical-log"); 20 + const store: ProjectStore = { 22 + for (const entry of batch) entries.push(entry); 25 + return new Project(store, { writerStorage: storage, hasBlob: held }); 28 + function history(project: Project) { 30 + { "keep.txt": "same\n", "edit.txt": "one\n", "gone.txt": "bye\n", "run.sh": "echo\n" }, 37 + { "edit.txt": "one\nzwei ü\n", "gone.txt": null, "new.txt": "hello\n" }, 39 + { "run.sh": { exec: true } }, 42 + assert.equal(project.publish("ann", "Changes", 2).ok, true); 45 + const sha = (text: string) => createHash("sha256").update(text, "utf8").digest("hex"); 47 + test("compare's summary lists what compare does, as sizes and SHA-256s", () => { 48 + for (const project of [new Project(new MemoryStore(), { hasBlob: held }), writer()]) { 50 + const full = project.compare(0, 1); 51 + const summary = project.compare(0, 1, { summary: true }); 52 + if ("summary" in full || !("summary" in summary)) throw Error("compare answered the wrong shape"); 54 + summary.files.map((f) => f.path), 55 + full.files.map((f) => f.path), 57 + for (const f of full.files) { 58 + const s: (typeof summary.files)[number] = summary.files.find((x) => x.path === f.path)!; 59 + const sum = (text: string | null, blob: string | null | undefined) => 60 + text === null ? null : blob ? { blob } : { size: Buffer.byteLength(text, "utf8"), sha256: sha(text) }; 61 + assert.deepEqual(s.before, sum(f.before, f.blob?.before ?? null), `${f.path} before`); 62 + assert.deepEqual(s.after, sum(f.after, f.blob?.after ?? null), `${f.path} after`); 63 + assert.deepEqual(s.mode, f.mode); 64 + assert.deepEqual(s.blob, f.blob); 66 + const edited = summary.files.find((f) => f.path === "edit.txt")!; 67 + assert.deepEqual(edited.after, { size: Buffer.byteLength("one\nzwei ü\n", "utf8"), sha256: sha("one\nzwei ü\n") }); 68 + assert.equal(summary.files.find((f) => f.path === "gone.txt")!.after, null); 69 + assert.deepEqual(summary.files.find((f) => f.path === "logo.png")!.after, { blob: B }); 70 + assert.ok(!JSON.stringify(summary).includes("zwei"), "no texts"); --- a/worker/project/version-log.ts
+++ b/worker/project/version-log.ts
@@ -9,7 +9,7 @@
9 9 import { ProjectError } from "./project-error.ts"; 10 10 import type { FileChange, LogAnswer, LogEntry, ShowAnswer } from "./project-types.ts"; 11 11 import { last, SHARED, type Space } from "./spaces.ts"; 12 − import { changesBetween } from "./view-changes.ts";
12 + import { changesBetween, summariesBetween } from "./view-changes.ts"; 14 14 /** What the version list reads need from a project. */ 15 15 export interface LogHost { @@ -243,8 +243,10 @@
246 − options: { draft?: string | null; agent?: string } = {},
247 − ): { from: number; to: number; files: FileChange[] } {
246 + options: { draft?: string | null; agent?: string; summary?: boolean } = {}, 248 + | { from: number; to: number; files: FileChange[] } 249 + | { from: number; to: number; summary: true; files: ReturnType<typeof summariesBetween> } { 249 251 const space = host.spaceFor(options); 250 252 host.checkVersion(space, from); @@ -252,13 +254,18 @@
252 254 const before = host.viewAt(space, from); 253 255 const after = host.viewAt(space, to); 254 256 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>) => 260 + ? { from, to, summary: true as const, files: summariesBetween(before, after, paths) } 261 + : { from, to, files: changesBetween(before, after, paths) }; 255 262 // A stored writer keeps each shared version's changed files (version-files.ts, abso Capacity): every file that 256 263 // differs between two versions changed in one between them, so those lists are the candidates, not every atom 257 264 // either set holds. 258 265 if (space.name === SHARED && host.graph.packedFiles) { 259 266 for (let v = Math.min(from, to) + 1; v <= Math.max(from, to); v++) 260 267 for (const file of host.paths.versionFiles(space, v)) files.add(file); 261 − return { from, to, files: changesBetween(before, after, files) };
268 + return answer(files); 263 270 const a = host.at(space, from); 264 271 const b = host.at(space, to); @@ -274,7 +281,7 @@
277 − return { from, to, files: changesBetween(before, after, files) };
284 + return answer(files); 280 287 /** A version of shared (or of a named draft) as a ReadView, for reading lines (blame at a version). */ --- a/worker/project/view-changes.ts
+++ b/worker/project/view-changes.ts
@@ -1,3 +1,4 @@
1 + import { createHash } from "node:crypto"; 1 2 import type { ReadView } from "../../src/engine/index.ts"; 2 3 import { ProjectError } from "./project-error.ts"; 3 4 import type { FileChange, Mode, Modes } from "./project-types.ts"; @@ -18,6 +19,49 @@
22 + /** A changed file's text or blob, summed up: its size in UTF-8 bytes and its SHA-256, or a blob's hash. */ 23 + export type FileSummary = { size: number; sha256: string } | { blob: string }; 26 + * changesBetween without the texts (abso issue 680, compare's summary): each changed file before and after as its size 27 + * and SHA-256, or its blob's hash for a binary file. Each text is read, summed up and let go, so a compare of thousands 28 + * of files never holds them all. 30 + export function summariesBetween( 33 + files: Iterable<string>, 36 + before: FileSummary | null; 37 + after: FileSummary | null; 38 + mode?: { before: Mode; after: Mode }; 39 + blob?: { before: string | null; after: string | null }; 41 + const sum = (view: ReadView, path: string): FileSummary | null => { 42 + if (!view.hasFile(path)) return null; 43 + const blob = view.attrs(path).blob; 44 + if (blob !== null) return { blob }; 45 + const text = view.text(path); 46 + return { size: Buffer.byteLength(text, "utf8"), sha256: createHash("sha256").update(text, "utf8").digest("hex") }; 48 + const out: ReturnType<typeof summariesBetween> = []; 49 + for (const path of [...new Set(files)].toSorted()) { 50 + if (!differs(before, after, path)) continue; 51 + const mode = modeChange(before, after, path); 52 + const bb = before.attrs(path).blob; 53 + const ab = after.attrs(path).blob; 56 + before: sum(before, path), 57 + after: sum(after, path), 58 + ...(mode ? { mode } : {}), 59 + ...(bb !== ab ? { blob: { before: bb, after: ab } } : {}), 21 65 /** Whether a file differs between two views: its text, its mode, or its blob (what changesBetween lists). */ 22 66 export function differs(before: ReadView, after: ReadView, path: string): boolean { 23 67 const had = before.hasFile(path);