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

Compare

+41 −0 in 1 place
Lines 144–187 at 318 (were 144–146 at 259)
144144 for (let i = 0; i < 40; i++) cache.keyed(`other-${i}`, () => set);
145145 assert.deepEqual(cache.view(set).files(), new View(graph, set).files());
146146});
148+test("trim lets go of the least recently used file layouts across views before whole views (abso Capacity)", () => {
149+ const graph = new Graph();
150+ const lines = (name: string) => Array.from({ length: 40 }, (_, i) => `${name} line ${i}\n`).join("");
151+ graph.add(
152+ buildBase({ "a.txt": lines("a"), "b.txt": lines("b"), "c.txt": lines("c") }, { author: "test", message: "base" }),
153+ );
154+ const set = new Set(["a0"]);
155+ // a.txt in x first, then b.txt in y, then c.txt in x: a.txt is the least recently used.
156+ const use = (cache: ViewCache) => {
157+ const x = cache.keyed("x", () => set);
158+ const y = cache.keyed("y", () => set);
159+ x.text("a.txt");
160+ y.text("b.txt");
161+ x.text("c.txt");
162+ return { x: x as View, y: y as View };
163+ };
164+ const probe = use(new ViewCache(graph));
165+ const total = probe.x.weight() + probe.y.weight();
166+ const cache = new ViewCache(graph, undefined, total - 1);
167+ const { x, y } = use(cache);
168+ cache.trim();
169+ assert.deepEqual(
170+ [...x.laidOut()].map((f) => f.path),
171+ ["c.txt"],
172+ );
173+ assert.deepEqual(
174+ [...y.laidOut()].map((f) => f.path),
175+ ["b.txt"],
176+ );
177+ assert.equal(
178+ cache.keyed("x", () => set),
179+ x,
180+ "both views are still cached",
181+ );
182+ assert.equal(
183+ cache.keyed("y", () => set),
184+ y,
185+ );
186+ assert.equal(x.text("a.txt"), lines("a"), "a.txt is laid out again, the same");
187+});
MCP
compare on this site's /mcp
CLI
abso diff 259 318 worker/project/test/view-cache.test.ts --json
JSON
/christopher/abso-core/compare/259..318?file=worker%2Fproject%2Ftest%2Fview-cache.test.ts&format=json