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 108 to 109

Compare

+29 −0 in 1 place
Lines 3–40 at 109 (were 3–11 at 108)
33import assert from "node:assert/strict";
44import { describe, it } from "node:test";
55import { buildBase, conflicts, Graph, project, View } from "../index.ts";
6+import { StableOverlaySet, StableSet } from "../state-source.ts";
7+import type { AtomId } from "../types.ts";
68import { lines, Repo } from "./helpers.ts";
79
810describe("View", () => {
11+ it("immutable indexed membership avoids a history-sized bitmap and remains a snapshot", () => {
12+ class RangeMembership extends StableSet<AtomId> {
13+ readonly retainedBytes = 64;
14+ readonly count: number;
15+ constructor(count: number) {
16+ super();
17+ this.count = count;
18+ }
19+ has(id: AtomId): boolean {
20+ return /^a[0-9]+$/.test(id) && Number(id.slice(1)) < this.count;
21+ }
22+ *values(): SetIterator<AtomId> {
23+ for (let i = 0; i < this.count; i++) yield `a${i}`;
24+ }
25+ }
26+ const repo = Repo.init({ "a.txt": "0\n" });
27+ for (let i = 1; i <= 40; i++) repo.edit({ edits: [{ file: "a.txt", old: `${i - 1}\n`, new: `${i}\n` }] });
28+ const first = new View(repo.graph, new RangeMembership(repo.graph.size));
29+ const weight = first.weight();
30+ for (let i = 41; i <= 80; i++) repo.edit({ edits: [{ file: "a.txt", old: `${i - 1}\n`, new: `${i}\n` }] });
31+ const second = new View(repo.graph, new RangeMembership(repo.graph.size));
32+ assert.equal(second.weight(), weight, "membership resident size does not increase with historical atom count");
33+ assert.equal(first.text("a.txt"), "40\n");
34+ assert.equal(second.text("a.txt"), "80\n");
35+ assert.equal(first.set.has("a80"), false);
36+ assert.throws(() => new View(repo.graph, new StableOverlaySet<AtomId>(["a1"])), /not closed/);
37+ });
938 it("keeps deleted lines as tombstones in the full sequence", () => {
1039 const repo = Repo.init({ "f.txt": lines("one", "two", "three") });
1140 const del = repo.edit({ edits: [{ file: "f.txt", old: "two\n", new: "" }] });
MCP
compare on this site's /mcp
CLI
abso diff 108 109 src/engine/test/view.test.ts --json
JSON
/christopher/abso-core/compare/108..109?file=src%2Fengine%2Ftest%2Fview.test.ts&format=json