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 133 to 134

Compare

+57 −8 in 1 place
Lines 46–119 at 134 (were 46–70 at 133)
4646 const out: Pair[] = [];
4747 for (const yours of draft) {
4848 const atom = g.atom(yours);
49− const candidates = new Set<AtomId>();
49+ const streams: IterableIterator<AtomId>[] = [];
5050 for (const key of atom.writes) {
51− for (const list of [g.writersOf(key), g.readersOf(key), g.holdersOf(key)]) {
52− for (const id of list) if (against.has(id)) candidates.add(id);
53− }
51+ streams.push(g.eachWriterOf(key), g.eachReaderOf(key), g.eachHolderOf(key));
5452 }
55− for (const key of claimsOf(atom)) for (const id of g.writersOf(key)) if (against.has(id)) candidates.add(id);
56− for (const theirs of [...candidates].sort((p, q) => g.atom(p).seq - g.atom(q).seq)) {
53+ for (const key of claimsOf(atom)) streams.push(g.eachWriterOf(key));
54+ for (const theirs of orderedClaimants(g, streams)) {
55+ if (!against.has(theirs)) continue;
5756 const [lo, hi] = g.atom(yours).seq < g.atom(theirs).seq ? [yours, theirs] : [theirs, yours];
5857 const keys = conflictKeys(g.atom(lo), g.atom(hi), g.dependsOn(hi, lo));
5958 if (keys.length === 0 || sideBySide(g, lo, hi, keys)) continue;
60− const fromHi = new Set(g.resolversOf(hi));
61− if (g.resolversOf(lo).some((r) => fromHi.has(r) && settled.has(r))) continue;
59+ if (hasCommonResolver(g, lo, hi, settled)) continue;
6260 out.push({ yours, theirs, keys });
6361 }
6462 }
6563 return out;
6664}
6765
66+/** Claim indexes append in canonical seq order. Merge one cursor per current
67+ * atom key, retaining no candidate set proportional to historical claims. */
68+function* orderedClaimants(g: Graph, streams: IterableIterator<AtomId>[]): IterableIterator<AtomId> {
69+ try {
70+ const heads = streams.map((stream) => stream.next());
71+ let previous = -1;
72+ for (;;) {
73+ let best = -1;
74+ let seq = Infinity;
75+ for (let i = 0; i < heads.length; i++) {
76+ const head = heads[i]!;
77+ if (head.done) continue;
78+ const current = g.atom(head.value).seq;
79+ if (current < seq) {
80+ best = i;
81+ seq = current;
82+ }
83+ }
84+ if (best < 0) return;
85+ const id = heads[best]!.value!;
86+ heads[best] = streams[best]!.next();
87+ if (seq === previous) continue;
88+ previous = seq;
89+ yield id;
90+ }
91+ } finally {
92+ for (const stream of streams) stream.return?.();
93+ }
94+}
96+/** Resolver indexes share the same append order, so intersection needs two cursors. */
97+function hasCommonResolver(g: Graph, lo: AtomId, hi: AtomId, settled: ReadonlySet<AtomId>): boolean {
98+ const left = g.eachResolverOf(lo);
99+ const right = g.eachResolverOf(hi);
100+ try {
101+ let a = left.next();
102+ let b = right.next();
103+ while (!a.done && !b.done) {
104+ const x = g.atom(a.value).seq;
105+ const y = g.atom(b.value).seq;
106+ if (x === y && settled.has(a.value)) return true;
107+ if (x <= y) a = left.next();
108+ if (y <= x) b = right.next();
109+ }
110+ return false;
111+ } finally {
112+ left.return?.();
113+ right.return?.();
114+ }
115+}
68117/**
69118 * Two pure insertions at the same point, and nothing else between them
70119 * (#37, the game trial): both only write the gap after one line. Neither
MCP
compare on this site's /mcp
CLI
abso diff 133 134 worker/project/collisions.ts --json
JSON
/christopher/abso-core/compare/133..134?file=worker%2Fproject%2Fcollisions.ts&format=json