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

why on a stored writer (disk-first 2; abso Capacity).

of shared·capacity··Not checked

  • A View reads atoms' numbers from their ids instead of reading each atom: building one from a plain set read every atom twice, and every mover once.
  • keptThrough, the settle a line was kept through, looks only among the atoms that write or take out the file's lines (graph.eachAtomIn), and lays out the file just before that settle from a lazy prefix of the view's set when that set is closed. It used to read every atom in the history and list all the earlier ones.
  • publishOf looks in shared before listing the named drafts, since listing them decodes each one's space.
  • view.ts loses #eachMover, unused since 215.

On abso's export, why for line 1 of issues/src/index.ts went from 41 s to 11 s on one opened writer, matching Project.load. The rest is trail's search for a moved line's origin among nearby changes.

Named tests: trail, named-drafts, files-reads, project, markers, version-files, draft-reads-stored, view, moves, drop (109 of 109); tsc and biome clean.

Version 217 · Files at version 218

3 files, 53 lines added, 25 removed.

--- a/src/engine/view.ts
+++ b/src/engine/view.ts
@@ -242,23 +242,24 @@
242242 return;
243243 }
244244 const inSet = new Uint8Array(graph.size);
245− for (const id of set) {
246− const atom = graph.atom(id);
247− inSet[atom.seq] = 1;
248− }
245+ // An atom's number is in its id (abso Capacity): reading the atom for it read the whole history on a stored graph.
246+ const seqIn = (id: AtomId): number => {
247+ const seq = seqOf(id);
248+ return seq >= 0 && seq < inSet.length && graph.idOfSeq(seq) === id ? seq : graph.atom(id).seq;
249+ };
250+ for (const id of set) inSet[seqIn(id)] = 1;
249251 // Validate one atom at a time. Keeping all decoded atoms here defeats
250252 // storage-backed Graph reads even though the view only needs membership.
251253 for (let seq = 0; seq < inSet.length; seq++) {
252254 if (inSet[seq] !== 1) continue;
253255 const atom = graph.atom(graph.idOfSeq(seq));
254256 for (const d of atom.deps) {
255− if (inSet[graph.atom(d).seq] !== 1)
256− throw new EngineError("not-closed", `set is not closed: ${atom.id} depends on ${d}`);
257+ if (inSet[seqIn(d)] !== 1) throw new EngineError("not-closed", `set is not closed: ${atom.id} depends on ${d}`);
257258 }
258259 }
259260 this.graph = graph;
260261 this.#in = inSet;
261− this.#movers = graph.movers().filter((id) => inSet[graph.atom(id).seq] === 1);
262+ this.#movers = graph.movers().filter((id) => inSet[seqOf(id)] === 1);
262263 this.#hasMoves = this.#movers.length > 0;
263264 this.#relocs = this.#movers.length === 0 ? new Map() : undefined;
264265 this.#relocsN = this.#movers.length === 0 ? new Map() : undefined;
@@ -459,10 +460,6 @@
459460 hasMoves(): boolean {
460461 return this.#hasMoves;
461462 }
462− *#eachMover(): IterableIterator<AtomId> {
463− if (this.#movers) yield* this.#movers;
464− else for (const id of this.graph.movers()) if (this.#stable!.has(id)) yield id;
465− }
466463
467464 /** The file a line is in, in this set: the one its chain of parents reaches. */
468465 fileOf(line: LineId): string {
--- a/worker/project/blame.ts
+++ b/worker/project/blame.ts
@@ -4,7 +4,8 @@
44// shared, with its message. Why adds the change's reasons, what it settled,
55// and the reasons other changes give that point at it, and the line's
66// earlier changes (trail.ts).
7−import { type Atom, type AtomId, type LineId, type ReadView, View } from "../../src/engine/index.ts";
7+import { type Atom, type AtomId, type LineId, type ReadView, seqOf, View } from "../../src/engine/index.ts";
8+import { isClosedSet, markClosed, StableSet } from "../../src/engine/state-source.ts";
89import { blocksIn, isMarkerLine } from "./markers.ts";
910import { pathKey } from "./pathkey.ts";
1011import type { Project } from "./project.ts";
@@ -126,21 +127,28 @@
126127function keptThrough(project: Project, view: ReadView, file: string, line: LineId, author: Atom): Atom | undefined {
127128 const graph = project.graph;
128129 const set = view.set;
129− for (const s of graph.atoms()) {
130− if (s.seq <= author.seq || s.resolves.length === 0 || !set.has(s.id)) continue;
130+ // Only atoms that write or take out the file's lines can take out its markers (abso Capacity): every atom in the
131+ // history was read on a stored graph.
132+ for (const id of graph.eachAtomIn(file)) {
133+ if (seqOf(id) <= author.seq) continue;
134+ const s = graph.atom(id);
135+ if (s.resolves.length === 0 || !set.has(s.id)) continue;
131136 const marks = s.deletes.filter((id) => {
132137 const info = graph.line(id);
133138 return info !== undefined && info.file === file && isMarkerLine(info.text);
134139 });
135140 if (marks.length === 0) continue;
136− // The file just before the settle, markers and all.
141+ // The file just before the settle, markers and all: of a closed set, its atoms before the settle, which a
142+ // stored set answers one by one; otherwise listed.
137143 const before = new View(
138144 graph,
139− graph
140− .atoms()
141− .slice(0, s.seq)
142− .filter((a) => set.has(a.id))
143− .map((a) => a.id),
145+ isClosedSet(set)
146+ ? markClosed(new BeforeSet(set, s.seq))
147+ : graph
148+ .atoms()
149+ .slice(0, s.seq)
150+ .filter((a) => set.has(a.id))
151+ .map((a) => a.id),
144152 );
145153 if (!before.hasFile(file)) continue;
146154 const lines = before.lines(file);
@@ -152,6 +160,28 @@
152160 return undefined;
153161}
154162
163+/** A set's atoms numbered below a limit. Atoms depend only on earlier ones, so a closed set's prefix is closed. */
164+class BeforeSet extends StableSet<AtomId> {
165+ readonly #set: ReadonlySet<AtomId>;
166+ readonly #limit: number;
167+ readonly retainedBytes = 32;
168+ constructor(set: ReadonlySet<AtomId>, limit: number) {
169+ super();
170+ this.#set = set;
171+ this.#limit = limit;
172+ }
173+ has(id: AtomId): boolean {
174+ const seq = seqOf(id);
175+ return seq >= 0 && seq < this.#limit && this.#set.has(id);
176+ }
177+ *values(): SetIterator<AtomId> {
178+ for (const id of this.#set) {
179+ const seq = seqOf(id);
180+ if (seq >= 0 && seq < this.#limit) yield id;
181+ }
182+ }
183+}
155185/** The settler's push that was held for this collision, newest first: its message is that side's reason. */
156186function heldPush(project: Project, settle: Atom, file: string, after: number) {
157187 const held = project
--- a/worker/project/publish-of.ts
+++ b/worker/project/publish-of.ts
@@ -18,11 +18,12 @@
1818 host: PublishOfHost,
1919 atom: AtomId,
2020): { draft: string | null; version: number; agent: string; message: string; time: number } | undefined {
21− const spaces = [
22− host.shared(),
23− ...[...host.spaces.values()].filter((s) => s.name !== SHARED).toSorted((a, b) => (a.name < b.name ? -1 : 1)),
24− ];
25− for (const space of spaces) {
21+ // Shared first, and the named drafts only when it isn't there: listing them reads each one's space.
22+ const spaces = function* (): Generator<Space> {
23+ yield host.shared();
24+ yield* [...host.spaces.values()].filter((s) => s.name !== SHARED).toSorted((a, b) => (a.name < b.name ? -1 : 1));
25+ };
26+ for (const space of spaces()) {
2627 const version = space.publishedIn.get(atom);
2728 if (version === undefined) continue;
2829 const p = space.versions[version]!;