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

Path names kept in memory once read (disk-first 2; abso Capacity).

of shared·capacity··Not checked

After 239, collisions on website spent most of its 4.6 s naming files: finding a deleted line's file ends at a file's start node, and Graph.#nodeName read the stored path list for it every time, through the row cache. Line records, line files and an atom's files read it the same way.

Graph.#pathName keeps path names by index in memory, up to 4,096, and clears them whenever the graph accepts an atom, so a name a rolled-back add made never stays.

On website adopted fresh, cold, one opened writer: collisions 4.6 s to 1.6 s (replay 0.4 s), matching replay. typescript-rs: all 27 answers match.

Named tests: every engine test (290 of 290), every worker/project test (341 of 341); tsc and biome clean.

Version 239 · Files at version 240

1 file, 28 lines added, 5 removed.

--- a/src/engine/graph.ts
+++ b/src/engine/graph.ts
@@ -267,6 +267,8 @@
267267/** A run written in another file under one of a file's lines: [the parent's n, the run's file index]. */
268268export type PackedCrossing = [number, number];
269269const EMPTY_NUMBERS: readonly number[] = Object.freeze([]);
270+/** At most this many path names kept in memory (Graph.#pathName). */
271+const PATH_NAMES = 4096;
270272/** Lines longer than this aren't packed with their file; their text is read on its own. */
271273const PACKED_TEXT = 4096;
272274
@@ -881,7 +883,7 @@
881883 id,
882884 atom: this.idOfSeq(seq),
883885 k: n - this.#lineBase[seq]!,
884− file: this.#paths[this.#lineFile.at(n)]!,
886+ file: this.#pathName(this.#lineFile.at(n)),
885887 parent: this.#nodeName(this.#lineParent.at(n)),
886888 text: this.#text(n),
887889 };
@@ -902,7 +904,7 @@
902904 /** The file a line was written in, or undefined: line(id).file without making the record. */
903905 lineFile(id: LineId): string | undefined {
904906 const n = this.#lineN(id);
905− return n < 0 ? undefined : this.#paths[this.#lineFile.at(n)];
907+ return n < 0 ? undefined : this.#pathName(this.#lineFile.at(n));
906908 }
907909
908910 /** The node a line was written after, or undefined: line(id).parent without making the record. */
@@ -1014,7 +1016,7 @@
10141016
10151017 /** The file line n was written in. */
10161018 writtenIn(n: number): string {
1017− return this.#paths[this.#lineFile.at(n)]!;
1019+ return this.#pathName(this.#lineFile.at(n));
10181020 }
10191021
10201022 /** The code of the node line n was written after. */
@@ -1177,9 +1179,30 @@
11771179 }
11781180
11791181 #nodeName(code: number): NodeId {
1180− return code >= 0 ? this.#lineName(code) : startNode(this.#paths[-1 - code]!);
1182+ return code >= 0 ? this.#lineName(code) : startNode(this.#pathName(-1 - code));
11811183 }
11821184
1185+ /**
1186+ * A path's name by its index, kept in memory once read (abso Capacity): finding a deleted line's file names the file
1187+ * it reaches, and a stored graph read the path list each time. Cleared when the graph accepts an atom, so a name a
1188+ * rolled-back add made never stays.
1189+ */
1190+ #pathName(index: number): string {
1191+ if (this.#pathNamesAt !== this.#accepted) {
1192+ this.#pathNames.clear();
1193+ this.#pathNamesAt = this.#accepted;
1194+ }
1195+ let name = this.#pathNames.get(index);
1196+ if (name === undefined) {
1197+ name = this.#paths[index]!;
1198+ if (this.#pathNames.size >= PATH_NAMES) this.#pathNames.clear();
1199+ this.#pathNames.set(index, name);
1200+ }
1201+ return name;
1202+ }
1203+ readonly #pathNames = new Map<number, string>();
1204+ #pathNamesAt = -1;
11831206 #pathOf(file: string): number {
11841207 let p = this.#pathIndex.get(file);
11851208 if (p === undefined) {
@@ -1689,7 +1712,7 @@
16891712 }
16901713 const files = new Set<string>();
16911714 for (const run of atom.inserts) files.add(run.file);
1692− for (const n of deletedNumbers(this)) files.add(this.#paths[this.#lineFile.at(n)]!);
1715+ for (const n of deletedNumbers(this)) files.add(this.#pathName(this.#lineFile.at(n)));
16931716 for (const a of frozen.attrs ?? []) files.add(a.file);
16941717 for (const m of frozen.moves ?? []) {
16951718 files.add(this.lineFile(m.line)!);