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

A draft that moves lines shares its base's layouts too (abso Capacity, issue 664).

of shared·capacity··Not checked

touchedBeyond gave up on any draft with moves, so such an agent's view shared nothing with its base: it laid out every file, took no author totals, compared every file to mark what it changed, and its file list walked every file the graph ever had, laying each out (and, dropping the absent ones again, re-laying them on every call). View.placedDifferently now says where the two views place a moved line differently (a different relocation wins, or a different parent), in either view; besides the files the draft's atoms name, those are the only files its moves can change, since a line's descendants follow it. touchedBeyond adds them, and gives up only when a view resolves its moves in scratch.

On typescript-rs (Testing's fresh 262 adoption, cloud-ts-01, a draft with two moving atoms; my machine): the draft now touches 3 files. Agent tree with authors 432 ms first and 19 ms again (2.7 s and 579 ms before); agent folder blame 388 ms and 14 ms (1.7 s and 525 ms); agent files 374 ms and 0 ms (1.5 s and 350 ms).

Exactness: the tests with drafts that move lines (agent-views-shared's fay, author-totals' fay, known-paths' dee, moves, touched-beyond) compare every read against the in-memory project. All of src/engine/test (294) and worker/project/test (354) pass.

Version 265 · Files at version 266

3 files, 48 lines added, 6 removed.

--- a/src/engine/view.ts
+++ b/src/engine/view.ts
@@ -56,6 +56,7 @@
5656 | "knowPaths"
5757 | "laidOut"
5858 | "forget"
59+ | "placedDifferently"
5960 | "fileOfNumber"
6061 | "lineNumberOf"
6162 | "visibleWriters"
@@ -543,6 +544,29 @@
543544 return parent;
544545 }
545546
547+ /**
548+ * The files where a moved line sits, in this view or in `other`, when the two place it differently: a different
549+ * relocation wins, or a different parent (abso Capacity). Besides the files a draft's atoms name, these are the only
550+ * ones a draft's moves can lay out differently from its base, since a line's descendants follow it. Undefined when
551+ * either view resolves its moves in scratch, which keeps no map of them to compare.
552+ */
553+ placedDifferently(other: View): Set<string> | undefined {
554+ if (this.#scratchMoves() || other.#scratchMoves()) return undefined;
555+ const here = this.#hasMoves ? this.#relocationsN() : undefined;
556+ const there = other.#hasMoves ? other.#relocationsN() : undefined;
557+ const files = new Set<string>();
558+ const add = (n: number) => {
559+ files.add(this.#fileOfN(n));
560+ files.add(other.#fileOfN(n));
561+ };
562+ for (const [n, x] of here ?? []) {
563+ const y = there?.get(n);
564+ if (!y || y.parent !== x.parent || y.r.atom !== x.r.atom) add(n);
565+ }
566+ for (const n of there?.keys() ?? []) if (!here?.has(n)) add(n);
567+ return files;
568+ }
546570 /** Whether any atom in the set moves lines. */
547571 hasMoves(): boolean {
548572 return this.#hasMoves;
--- a/worker/project/collisions.ts
+++ b/worker/project/collisions.ts
@@ -302,7 +302,7 @@
302302
303303/**
304304 * The files a view over `below` plus `mine` can lay out differently from `below` (abso Capacity, View.shareFiles), or
305− * undefined when any of it moves lines. A view's set is closed under dependencies, so it holds `mine` and whatever
305+ * undefined when any of it moves lines and `placedDifferently` can't say where those land differently. A view's set is closed under dependencies, so it holds `mine` and whatever
306306 * `mine` depends on that `below` lacks; each of those can change a file, so all of them count. Counting `mine` alone
307307 * missed the files of work the draft depends on (Testing's typescript-rs diff for cloud-ts-01, core 235).
308308 */
@@ -311,6 +311,7 @@
311311 below: ReadonlySet<AtomId>,
312312 mine: Iterable<AtomId>,
313313 views: readonly ReadView[],
314+ placedDifferently?: () => ReadonlySet<string> | undefined,
314315): Set<string> | undefined {
315316 const beyond = new Set<AtomId>();
316317 const stack = [...mine];
@@ -320,8 +321,15 @@
320321 beyond.add(id);
321322 for (const dep of g.atom(id).deps) if (!beyond.has(dep) && !below.has(dep)) stack.push(dep);
322323 }
323− for (const id of beyond) if ((g.atom(id).moves?.length ?? 0) > 0) return undefined;
324− return touchedFiles(g, beyond, views);
324+ const files = touchedFiles(g, beyond, views);
325+ // Moves change more than the files their atoms name only where a moved line lands differently (View.placedDifferently,
326+ // abso Capacity); without that comparison, a draft that moves lines shares nothing.
327+ if ([...beyond].some((id) => (g.atom(id).moves?.length ?? 0) > 0)) {
328+ const placed = placedDifferently?.();
329+ if (!placed) return undefined;
330+ for (const file of placed) files.add(file);
331+ }
332+ return files;
325333}
326334
327335/** The atom's visible lines in a file of a view, or where it acted when none are left. */
--- a/worker/project/project.ts
+++ b/worker/project/project.ts
@@ -281,6 +281,11 @@
281281 return "json" in frame ? (JSON.parse(frame.json) as Entry) : frame.entry;
282282}
283283
284+/** Where a view and its base place moved lines differently (View.placedDifferently), when both are Views. */
285+function placedBetween(view: ReadView, base: ReadView): ReadonlySet<string> | undefined {
286+ return view instanceof View && base instanceof View ? view.placedDifferently(base) : undefined;
287+}
284289export class Project {
285290 readonly #store: ProjectStore;
286291 readonly #writerStorage?: GraphStateStorage;
@@ -1841,7 +1846,8 @@
18411846 #agentTouched(agent: AgentState): ReadonlySet<string> | undefined {
18421847 if (agent.mine.length === 0) return new Set();
18431848 const base = this.#viewAt(this.#spaceOf(agent), agent.base);
1844− return touchedBeyond(this.#graph, base.set, agent.mine, [base, this.#agentView(agent)]);
1849+ const view = this.#agentView(agent);
1850+ return touchedBeyond(this.#graph, base.set, agent.mine, [base, view], () => placedBetween(view, base));
18451851 }
18461852
18471853 /**
@@ -1992,7 +1998,9 @@
19921998 );
19931999 if (this.#writerStorage && mine.length > 0 && view instanceof View && base instanceof View) {
19942000 view.shareMoves(base);
1995− view.shareFiles(base, () => touchedBeyond(this.#graph, base.set, mine, [base, view]));
2001+ view.shareFiles(base, () =>
2002+ touchedBeyond(this.#graph, base.set, mine, [base, view], () => placedBetween(view, base)),
2003+ );
19962004 }
19972005 return view;
19982006 }
@@ -2852,7 +2860,9 @@
28522860 // view holds beyond its base is the draft and whatever the draft depends on that the base lacks (the view's
28532861 // set is closed): each of those can change a file, so all of them count.
28542862 const mine = agent.mine;
2855− view.shareFiles(base, () => touchedBeyond(this.#graph, base.set, mine, [base, view]));
2863+ view.shareFiles(base, () =>
2864+ touchedBeyond(this.#graph, base.set, mine, [base, view], () => placedBetween(view, base)),
2865+ );
28562866 }
28572867 }
28582868 return view;