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 177 to 178

Compare

+46 −3 in 5 places
Lines 1–10 at 178 (were 1–9 at 177)
11import assert from "node:assert/strict";
2−import { registerHooks } from "node:module";
2+import { createRequire, registerHooks } from "node:module";
33import { test } from "node:test";
44import git from "isomorphic-git";
55import { Project } from "../../worker/project/project.ts";
66import { EngineProject } from "../src/engine-project.ts";
7+import { GitDiskIntake } from "../src/git-disk-intake.ts";
78import { MemoryFS } from "../src/memory-fs.ts";
89import { memoryStorage } from "./helpers.ts";
Lines 21–60 at 178 (were 20–25 at 177)
2021const { ProjectObject } = await import("../src/project-object.ts");
2122hooks.deregister();
2223
24+function assertGitScratchEmpty(storage: ReturnType<typeof memoryStorage>) {
25+ for (const table of [
26+ "git_pack_spool",
27+ "git_pack_resolve",
28+ "git_object_meta",
29+ "git_object_bytes",
30+ "git_object_budget",
31+ ])
32+ assert.equal(storage.db.prepare(`SELECT COUNT(*) AS n FROM ${table}`).get()!.n, 0, table);
33+}
35+/** Keep transport synthetic while exercising the real disk pack decoder and cache. */
36+async function cloneFixture(remote: MemoryFS, options: Parameters<typeof git.clone>[0]) {
37+ const intake = (options.cache as Record<symbol, GitDiskIntake> | undefined)?.[Symbol.for("abso.git.disk-pack")];
38+ if (!intake) {
39+ (options.fs as MemoryFS).entries = structuredClone(remote.entries);
40+ return;
41+ }
42+ const oids = [...remote.entries.keys()].flatMap((path) => {
43+ const match = /\/objects\/([0-9a-f]{2})\/([0-9a-f]{38})$/.exec(path);
44+ return match ? [match[1]! + match[2]!] : [];
45+ });
46+ const pack = (await git.packObjects({ fs: remote, dir: "/repo", oids, write: false })).packfile!;
47+ const { Inflate } = createRequire(import.meta.url)("pako");
48+ await intake.ingest([pack], () => new Inflate({ chunkSize: 16384 }));
49+ await git.init({ fs: options.fs, dir: options.dir, defaultBranch: "main" });
50+ await git.writeRef({
51+ fs: options.fs,
52+ dir: options.dir,
53+ ref: "main",
54+ value: await git.resolveRef({ fs: remote, dir: "/repo", ref: "main" }),
55+ });
56+}
2358test("empty disk projects and unloadable legacy projects preserve lookup fallbacks", async (t) => {
2459 const storage = memoryStorage();
2560 t.after(() => storage.db.close());
Lines 379–392 at 178 (were 344–352 at 177)
344379 await git.writeRef({ fs: remote, dir: "/repo", ref: "main", value: incoming, force: true });
345380 t.mock.method(git, "listServerRefs", async () => [{ ref: "refs/heads/main", oid: incoming }]);
346381 t.mock.method(git, "clone", async (options: Parameters<typeof git.clone>[0]) => {
347− (options.fs as MemoryFS).entries = structuredClone(remote.entries);
382+ await cloneFixture(remote, options);
348383 });
349384 const beforeIntake = rows();
385+ const originalRead = GitDiskIntake.prototype.read;
386+ t.mock.method(GitDiskIntake.prototype, "read", function (this: GitDiskIntake, oid: string) {
387+ if (oid === blob) throw Error("whole intake text blob forbidden");
388+ return originalRead.call(this, oid);
389+ });
350390 const originalIngest = EngineProject.prototype.ingest;
351391 const failedIngest = t.mock.method(
352392 EngineProject.prototype,
Lines 397–414 at 178 (were 357–371 at 177)
357397 },
358398 );
359399 await assert.rejects(() => bound().gitSync(), /injected after Git intake/);
400+ assertGitScratchEmpty(storage);
360401 assert.deepEqual(rows(), beforeIntake);
361402 assert.equal((await bound().out()).git.head, parent, "failed intake must not acknowledge the remote head");
362403 failedIngest.mock.restore();
363404 failGitAcknowledgement = true;
364405 await assert.rejects(() => bound().gitSync(), /Git cursor persistence failure/);
406+ assertGitScratchEmpty(storage);
365407 const committedIntake = rows();
366408 assert.equal((await bound().out()).version, 3);
367409 assert.equal((await bound().out()).git.head, parent);
368410 const intake = await bound().gitSync();
411+ assertGitScratchEmpty(storage);
369412 assert.deepEqual(rows(), committedIntake, "retry after cursor failure returns the atomic intake receipt");
370413 assert.ok(intake);
371414 assert.equal(intake?.head, incoming);
Lines 486–492 at 178 (were 443–449 at 177)
443486 let head = await commit({ "A.TXT": "clash\n", "a.txt": "original\n" }, "Refused", [base]);
444487 t.mock.method(git, "listServerRefs", async () => [{ ref: "refs/heads/main", oid: head }]);
445488 t.mock.method(git, "clone", async (options: Parameters<typeof git.clone>[0]) => {
446− (options.fs as MemoryFS).entries = structuredClone(remote.entries);
489+ await cloneFixture(remote, options);
447490 });
448491 const refused = await object().gitSync();
449492 assert.ok(refused);
MCP
compare on this site's /mcp
CLI
abso diff 177 178 server/test/project-object-disk-first.test.ts --json
JSON
/christopher/abso-core/compare/177..178?file=server%2Ftest%2Fproject-object-disk-first.test.ts&format=json