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

Reduce implicit dependencies to their maximal frontier

of shared·codex-capacity-chair··Not checked

Version 123 · Files at version 124

5 files, 53 lines added, 17 removed.

--- a/src/engine/build.ts
+++ b/src/engine/build.ts
@@ -333,7 +333,12 @@
333333 * - creating a file over a deleted one: the atoms that deleted its lines;
334334 * - needs and resolves.
335335 * Nothing else from the view: not the line below an insertion, not the
336− * tombstones around it.
336+ * tombstones around it. New atoms encode implicit dependencies as maximal
337+ * tips: ancestors reachable through another tip are omitted from direct deps.
338+ * Explicit needs/resolves always remain direct. Existing atoms are not rewritten.
339+ * Direct-edge diagnostics (including why/Deps trailers and missingDeps) therefore
340+ * show fewer redundant edges; transitive closure and dependency ordering remain
341+ * the semantic contract. A missing tip still implies its required ancestors.
337342 */
338343function deriveDeps(
339344 view: View,
@@ -347,16 +352,30 @@
347352 },
348353): AtomId[] {
349354 const graph = view.graph;
350− const deps = new Set<AtomId>(parts.emptiedBy);
355+ // New atoms retain maximal implicit dependencies. Their transitive closure is
356+ // unchanged; explicit needs/resolves remain direct edges below.
357+ const deps = new Set<AtomId>();
358+ const addImplicit = (candidate: AtomId): void => {
359+ if (deps.has(candidate)) return;
360+ const candidateClock = graph.lamport(candidate);
361+ for (const previous of deps) {
362+ const previousClock = graph.lamport(previous);
363+ // Equal Lamport clocks cannot reach each other; check only the possible direction.
364+ if (previousClock > candidateClock && graph.dependsOn(previous, candidate)) return;
365+ if (candidateClock > previousClock && graph.dependsOn(candidate, previous)) deps.delete(previous);
366+ }
367+ deps.add(candidate);
368+ };
369+ for (const id of parts.emptiedBy) addImplicit(id);
351370 for (const key of [...parts.writes, ...parts.reads, ...parts.holds]) {
352371 const { kind, node } = parseKey(key);
353372 // An attribute builds on whoever set it last in the view, the way an insertion builds on a gap's writers;
354373 // a move builds on the earlier moves of its lines.
355− if (kind !== "attr" && !isStartNode(node)) deps.add(writerOf(node));
356− if (kind !== "line") for (const writer of graph.eachWriterOf(key)) if (view.set.has(writer)) deps.add(writer);
374+ if (kind !== "attr" && !isStartNode(node)) addImplicit(writerOf(node));
375+ if (kind !== "line") for (const writer of graph.eachWriterOf(key)) if (view.set.has(writer)) addImplicit(writer);
357376 }
358377 for (const key of parts.writes) {
359− for (const reader of graph.eachReaderOf(key)) if (view.set.has(reader)) deps.add(reader);
378+ for (const reader of graph.eachReaderOf(key)) if (view.set.has(reader)) addImplicit(reader);
360379 }
361380 for (const id of parts.needs) deps.add(id);
362381 for (const id of parts.resolves) deps.add(id);
--- a/src/engine/test/build.test.ts
+++ b/src/engine/test/build.test.ts
@@ -335,7 +335,8 @@
335335 assert.equal(repo.text("g.txt"), "g1\ng2\n");
336336 const edited = repo.edit({ edits: [{ file: "g.txt", old: "g2", new: "G2" }] });
337337 const removed = repo.edit({ edits: [{ file: "g.txt", old: "g1\nG2\n", new: "" }] });
338− assert.deepEqual(removed.deps, [created.id, edited.id]);
338+ assert.deepEqual(removed.deps, [edited.id]);
339+ assert.deepEqual(repo.graph.closureOf(removed.deps), repo.graph.closureOf([created.id, edited.id]));
339340 assert.equal(repo.view().hasFile("g.txt"), false);
340341 assert.deepEqual(Object.keys(repo.files()), ["f.txt"]);
341342 assert.deepEqual(repo.view().knownPaths(), ["f.txt", "g.txt"]);
@@ -343,7 +344,8 @@
343344 // lines hang off the start (gap rule) and on the deletions: it relies on
344345 // the file being empty, so its closure shows only the new text.
345346 const again = repo.edit({ edits: [{ file: "g.txt", old: "", new: "fresh\n" }] });
346− assert.deepEqual(again.deps, [created.id, edited.id, removed.id]);
347+ assert.deepEqual(again.deps, [removed.id]);
348+ assert.deepEqual(repo.graph.closureOf(again.deps), repo.graph.closureOf([created.id, edited.id, removed.id]));
347349 assert.equal(repo.text("g.txt"), "fresh\n");
348350 assert.equal(repo.text("g.txt", repo.graph.closure(again.id)), "fresh\n");
349351 });
@@ -395,7 +397,8 @@
395397 reliesOn: [{ file: "g.txt", start: 0, end: 1 }],
396398 });
397399 assert.deepEqual(atom.holds, [lineKey(`${g2.id}.0`)]);
398− assert.deepEqual(atom.deps, ["a0", g2.id]);
400+ assert.deepEqual(atom.deps, [g2.id]);
401+ assert.deepEqual(repo.graph.closureOf(atom.deps), repo.graph.closureOf(["a0", g2.id]));
399402 });
400403
401404 it("reliesOn a range of lines also holds the gaps between them", () => {
@@ -436,7 +439,8 @@
436439 const three = repo.edit({ edits: [{ file: "f.txt", old: "three", new: "THREE" }] });
437440 // Inserting after "two": the gap holds mid (a tombstone hanging off "two") and then THREE.
438441 const atom = repo.edit({ edits: [{ file: "f.txt", old: "two\n", new: "two\nnew\n", mode: "after" }] });
439− assert.deepEqual(atom.deps, ["a0", added.id]);
442+ assert.deepEqual(atom.deps, [added.id]);
443+ assert.deepEqual(repo.graph.closureOf(atom.deps), repo.graph.closureOf(["a0", added.id]));
440444 assert.equal(repo.text("f.txt"), lines("one", "two", "new", "THREE", "four", "five"));
441445 // It outranks mid, so it sits directly after "two" in any set; in its own
442446 // closure mid is back (the deletion isn't in it) and stays below it.
@@ -481,7 +485,8 @@
481485 const draft = repo.draft({ message: "N after X", edits: [{ file: "f.txt", start: 1, end: 1, lines: ["N"] }] });
482486 assert.deepEqual(repo.check(draft).conflicts, []);
483487 const N = repo.edit({ message: "N after X", edits: [{ file: "f.txt", start: 1, end: 1, lines: ["N"] }] });
484− assert.deepEqual(N.deps, ["a0", A.id, B.id]);
488+ assert.deepEqual(N.deps, [A.id, B.id]);
489+ assert.deepEqual(repo.graph.closureOf(N.deps), repo.graph.closureOf(["a0", A.id, B.id]));
485490 assert.equal(repo.text("f.txt"), lines("X", "N", "B", "A", "Y"));
486491 assert.deepEqual(
487492 conflicts(repo.graph, repo.shared).map((c) => c.atoms),
@@ -504,7 +509,8 @@
504509 // Deleting "three" (the line below the insert) touches nothing the insert wrote,
505510 // but it changes a line the insert read: a sequential edit, so a dependency.
506511 const atom = repo.edit({ edits: [{ file: "f.txt", old: "three\n", new: "" }] });
507− assert.deepEqual(atom.deps, ["a0", between.id]);
512+ assert.deepEqual(atom.deps, [between.id]);
513+ assert.deepEqual(repo.graph.closureOf(atom.deps), repo.graph.closureOf(["a0", between.id]));
508514 assert.deepEqual(
509515 checkDraft(repo.graph, repo.shared, repo.draft({ edits: [{ file: "f.txt", old: "four\n", new: "" }] })).conflicts,
510516 [],
--- a/src/engine/test/concurrent.test.ts
+++ b/src/engine/test/concurrent.test.ts
@@ -453,10 +453,18 @@
453453 [before, "before"],
454454 ] as const) {
455455 subset(claimsOf(narrow), claimsOf(both), `claims ${name} ⊆ both`);
456− subset(narrow.deps, both.deps, `deps ${name} ⊆ both`);
456+ subset(
457+ [...repo.graph.closureOf(narrow.deps)],
458+ [...repo.graph.closureOf(both.deps)],
459+ `dependency closure ${name} ⊆ both`,
460+ );
457461 }
458462 subset(claimsOf(both), claimsOf(wide), "claims both ⊆ wide");
459− subset(both.deps, wide.deps, "deps both ⊆ wide");
463+ subset(
464+ [...repo.graph.closureOf(both.deps)],
465+ [...repo.graph.closureOf(wide.deps)],
466+ "dependency closure both ⊆ wide",
467+ );
460468 for (const other of pool) {
461469 const [hitAfter, hitBefore, hitBoth, hitWide] = [after, before, both, wide].map(
462470 (v) => keyOverlap(v, other).length > 0,
--- a/src/engine/test/record-query-contract.test.ts
+++ b/src/engine/test/record-query-contract.test.ts
@@ -24,7 +24,8 @@
2424 // Nine existing atoms make a finite, repeatable history. The last query
2525 // both replaces a line and inserts at the repeatedly written gap.
2626 assert.equal(repo.graph.size, 9);
27− assert.deepEqual(recreation.deps, ["a0", deletion.id]);
27+ assert.deepEqual(recreation.deps, [deletion.id]);
28+ assert.deepEqual(repo.graph.closureOf(recreation.deps), repo.graph.closureOf(["a0", deletion.id]));
2829 assert.deepEqual(repo.view().attrs("src.txt"), {
2930 exists: false,
3031 exec: false,
@@ -43,9 +44,10 @@
4344 attrs: [{ file: "src.txt", name: "exec" as const, value: "1" }],
4445 };
4546 const liveAtom = buildAtom(repo.view(), input);
46− const expectedDeps = ["a0", writerOne.id, writerTwo.id, readerOne.id, readerTwo.id, attrOne.id, attrTwo.id];
47+ const expectedDeps = [writerOne.id, writerTwo.id, readerOne.id, readerTwo.id, attrOne.id, attrTwo.id];
4748 assert.deepEqual(liveAtom.deps, expectedDeps);
48− assert.equal(liveAtom.deps.length, 7);
49+ assert.deepEqual(repo.graph.closureOf(liveAtom.deps), repo.graph.closureOf(["a0", ...expectedDeps]));
50+ assert.equal(liveAtom.deps.length, 6);
4951 assert.equal(liveAtom.writes.length, 3);
5052 assert.equal(liveAtom.reads.length, 2);
5153 assert.equal(liveAtom.holds.length, 0);
--- a/src/engine/test/view.test.ts
+++ b/src/engine/test/view.test.ts
@@ -117,8 +117,9 @@
117117 assert.equal(repo.text("f.txt"), lines("top", "r", "q", "p", "bottom"));
118118 assert.deepEqual(
119119 r.deps,
120− ["a0", p.id, q.id].sort((a, b) => Number(a.slice(1)) - Number(b.slice(1))),
120+ [p.id, q.id].sort((a, b) => Number(a.slice(1)) - Number(b.slice(1))),
121121 );
122+ assert.deepEqual(repo.graph.closureOf(r.deps), repo.graph.closureOf(["a0", p.id, q.id]));
122123 });
123124
124125 it("puts a line's replacements ahead of the lines inserted after it, whatever their priority", () => {