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

A publish owes all its news for other agents after the commit, not only definition news (abso 714, piece 2 of Christopher's base fix)

of shared·capacity··Not checked

  • With owesDefinitionNews set (abso's disk route), newsForOthers no longer works out other agents' news inside the publish. At the first other agent with a draft, it owes { version, space, publisher, all: true } and returns. Nothing else changes in the publish or its answer.
  • newsOwed(owed, only?) works the news out against the publish's version, for those agents only: same lines (pairsIn at the owed version), definitions (changed names, from owed.names or worked out once), and moves. Items an agent was already told are left out. definitionNewsOwed stays as an alias. A row from before all: true (names only) still tells definition news only.
  • owedNewsNames(owed) works out the changed definitions once, so a host can keep them on its row. New host hooks are setAt and collisionAt (project.ts), and moveNews takes the version to read at.
  • The publishNews end line no longer reports files: changed names are now worked out only when an agent needs them.
  • Tests: owed-definition-news.test.ts adds a test that each of three agents' full news (definition and same-lines), told one agent at a time after the publish, equals the news told at publish time, plus one where nothing is owed. news-lines.test.ts drops the files check.

Checks: tsc and tsc -p server clean. Biome clean on the changed files; the existing errors in server/ are untouched. Core tests: worker/project and src, 762 passed, none failed. Lab, on abso's Oct 14 tables with abso's disk route on top, in the 1470-shaped publish: publish 24,209 statements (was 36,038). The owed news then goes out in 17 short transactions (longest 3.8 s) for 16 agents.

Version 308 · Files at version 309

4 files, 139 lines added, 43 removed.

--- a/worker/project/news.ts
+++ b/worker/project/news.ts
@@ -273,15 +273,25 @@
273273 names: ReadonlySet<string>,
274274 version: number,
275275 ): DefinitionCollision[];
276+ /** The space's atoms at `version`: setOf as it was then (owed news). */
277+ setAt(space: Space, version: number): ReadonlySet<AtomId>;
278+ /** collision, with theirs described from the agent's space at `version`, not its newest (owed news). */
279+ collisionAt(agent: AgentState, pair: Pair, version: number): Collision;
276280}
277281
278−/** A publish's definition news for other agents, not yet worked out: the version it made, and the names it changed. */
279−export interface OwedDefinitionNews {
282+/**
283+ * A publish's news for other agents, not yet worked out: the version it made, and who made it. `all`: everything the
284+ * publish would have told them (same lines, definitions, moves; abso 714). Without it, as owed before 714, only the
285+ * definition news. `names`: the names its definitions changed, once worked out (owedNewsNames).
286+ */
287+export interface OwedNews {
280288 readonly version: number;
281289 readonly space: string;
282290 readonly publisher: string;
283− readonly names: readonly string[];
291+ readonly names?: readonly string[];
292+ readonly all?: boolean;
284293}
294+export type OwedDefinitionNews = OwedNews;
285295
286296function lineNews(host: NewsHost, agent: AgentState, pairs: readonly Pair[]): NewsItem[] {
287297 return pairs.map((p) => ({ key: pairKey(p), text: linesText(host.collision(agent, p)) }));
@@ -302,6 +312,8 @@
302312 just: ReadonlySet<AtomId>,
303313 space: Space,
304314 version: number,
315+ /** The space's version the moved lines' files are read at: its newest, or an owed publish's own. */
316+ now = last(space),
305317): NewsItem[] {
306318 const g = host.graph;
307319 const movers = [...just].filter((id) => g.atom(id).moves);
@@ -314,7 +326,7 @@
314326 }
315327 }
316328 const was = host.viewAt(space, version - 1);
317− const now = host.viewAt(space, last(space));
329+ const after = host.viewAt(space, now);
318330 const out: NewsItem[] = [];
319331 for (const id of movers) {
320332 const moved = g
@@ -323,7 +335,7 @@
323335 .filter((k) => k.kind === "pos" && claimed.has(k.node))
324336 .map((k) => k.node);
325337 if (moved.length === 0) continue;
326− out.push(moveItem(id, host.origin(id, space.name), was.fileOf(moved[0]!), now.fileOf(moved[0]!)));
338+ out.push(moveItem(id, host.origin(id, space.name), was.fileOf(moved[0]!), after.fileOf(moved[0]!)));
327339 }
328340 return out;
329341}
@@ -360,37 +372,30 @@
360372 // For the host's logs (abso 702): a line as the work starts, written before it, and one as it ends, so work that
361373 // outlives its request still shows. No time in them: a Durable Object's clock stands still in synchronous code.
362374 let drafts = 0;
363− let files = 0;
364375 let news = 0;
365− const compareDefinitions = (): ReadonlySet<string> => {
366− const touched = touchedFiles(host.graph, just, [host.viewAt(space, version - 1), host.viewAt(space, last(space))]);
367− files = touched.size;
368− const before = definitionsIn(host.viewAt(space, version - 1), touched);
369− const after = definitionsIn(host.viewAt(space, last(space)), touched);
370− return new Set(
371− [...new Set([...before.keys(), ...after.keys()])].filter(
372− (name) => !before.has(name) || signature(before.get(name)!) !== signature(after.get(name) ?? []),
373− ),
374− );
375− };
376− // Owed (abso Capacity, 2026-10-15): the definition rule over every other draft was most of a publish's write on
377− // stored tables (5.5 of 7.3 s on abso in the lab, about 45 s in prod, long enough to reset the object). Same lines
378− // and moves are told here as before; the definition news is worked out after the write, against this version.
379− // Asked only once some other agent has a draft (news-lazy.test.ts: no news work at all otherwise).
376+ // Owed (abso 714, Christopher's base fix): on stored tables this news for other agents was most of a publish's one
377+ // write transaction (the same-lines pairs, the definitions, the moves, for every draft: about 10 s for a 30-line
378+ // change to abso's 12k-line index.ts), long enough to time storage out and reset the object (prod abso, 23:32Z
379+ // 2026-10-16). Owing, the publish only notes what it owes, here, once some other agent has a draft; it's worked out
380+ // after the commit, one agent at a time, against this version (newsOwed). Asked only then (news-lazy.test.ts: no
381+ // news work at all otherwise).
380382 let owing: boolean | undefined;
381− let owed = false;
382383 for (const agent of [...host.agents.values()].toSorted((a, b) => (a.name < b.name ? -1 : 1))) {
383384 if (agent === publisher || agent.space !== space.name) continue;
384385 const draft = host.draft(agent);
385386 if (draft.length === 0) continue;
387+ owing ??= host.owesDefinitionNews();
388+ if (owing) {
389+ host.owe({ version, space: space.name, publisher: publisher.name, all: true });
390+ host.logLine?.({ work: "publishNews", step: "owed", space: space.name, version, publisher: publisher.name });
391+ return;
392+ }
386393 if (drafts++ === 0)
387394 host.logLine?.({ work: "publishNews", step: "start", space: space.name, version, publisher: publisher.name });
388395 const lines = pairsIn(host.graph, draft, just, unionOverlay(host.setOf(space), draft));
389− changedNames ??= compareDefinitions();
390− owing ??= host.owesDefinitionNews();
391− if (owing && changedNames.size > 0) owed = true;
396+ changedNames ??= changedNamesAt(host, space, version);
392397 const defs =
393− changedNames.size > 0 && !owing
398+ changedNames.size > 0
394399 ? host.definitionCollisions(agent, host.newerFor(agent), changedNames).filter((d) => just.has(d.by))
395400 : [];
396401 const items = [
@@ -409,43 +414,77 @@
409414 version,
410415 publisher: publisher.name,
411416 drafts,
412− files,
413417 changedNames: changedNames?.size ?? 0,
414418 news,
415− owed: owed ? 1 : 0,
416419 });
417− if (owed)
418− host.owe({ version, space: space.name, publisher: publisher.name, names: [...(changedNames ?? [])].sort() });
419420}
420421
421422/**
423+ * The names whose definitions the publish at `version` changed, in the files it touched: before it against its own
424+ * version. Most publishes change none; then only the same-lines rule can bring news. A definition collision the publish
425+ * brings is one of these, so a draft that uses none of them has none (abso Capacity, prod abso 2026-10-15).
426+ */
427+function changedNamesAt(host: NewsHost, space: Space, version: number): ReadonlySet<string> {
428+ const just = new Set(space.versions[version]!.atoms);
429+ const touched = touchedFiles(host.graph, just, [host.viewAt(space, version - 1), host.viewAt(space, version)]);
430+ const before = definitionsIn(host.viewAt(space, version - 1), touched);
431+ const after = definitionsIn(host.viewAt(space, version), touched);
432+ return new Set(
433+ [...new Set([...before.keys(), ...after.keys()])].filter(
434+ (name) => !before.has(name) || signature(before.get(name)!) !== signature(after.get(name) ?? []),
435+ ),
436+ );
437+}
439+/** owedNews's names, worked out once for a publish (the host keeps them on its row): changedNamesAt its version. */
440+export function owedNewsNames(host: NewsHost, owed: OwedNews): string[] {
441+ const space = host.spaceNamed(owed.space);
442+ if (!space || owed.version > last(space) || !space.versions[owed.version]) return [];
443+ return [...changedNamesAt(host, space, owed.version)].sort();
444+}
446+/**
422447 * The definition news a publish owes, worked out as newsForOthers would have at that version: the same agents, the
423448 * same rule against the space at `owed.version` and the work published up to it, the same words and keys. Reads only.
424449 * An agent that has synced past the version since is left out (the version is no longer newer for it), and an item
425450 * an agent was already told (from its own edit since, or this run before) is dropped, as queueNews would.
426451 */
427−export function definitionNewsOwed(
452+export function newsOwed(
428453 host: NewsHost,
429− owed: OwedDefinitionNews,
430− /** Only these agents (owedAgents' names), so a host can work the news out a few agents at a time (abso 714). */
454+ owed: OwedNews,
455+ /** Only these agents (owedAgents' names), so a host can work the news out one agent at a time (abso 714). */
431456 only?: readonly string[],
432457): { agent: string; items: NewsItem[] }[] {
433458 const space = host.spaceNamed(owed.space);
434459 if (!space || owed.version > last(space) || !space.versions[owed.version]) return [];
435460 const just = new Set(space.versions[owed.version]!.atoms);
436− const names = new Set(owed.names);
461+ let names: ReadonlySet<string> | undefined = owed.names ? new Set(owed.names) : undefined;
437462 const out: { agent: string; items: NewsItem[] }[] = [];
438463 for (const agent of [...host.agents.values()].toSorted((a, b) => (a.name < b.name ? -1 : 1))) {
439464 if (only && !only.includes(agent.name)) continue;
440465 if (!owedTo(host, owed, space, agent)) continue;
441− const defs = host
442− .definitionCollisionsAt(agent, host.newerAt(agent, owed.version), names, owed.version)
443− .filter((d) => just.has(d.by));
444− const items = definitionNews(defs).filter((item) => !agent.told.has(item.key));
466+ const draft = host.draft(agent);
467+ names ??= changedNamesAt(host, space, owed.version);
468+ const lines = owed.all
469+ ? pairsIn(host.graph, draft, just, unionOverlay(host.setAt(space, owed.version), draft)).map((p) => ({
470+ key: pairKey(p),
471+ text: linesText(host.collisionAt(agent, p, owed.version)),
472+ }))
473+ : [];
474+ const defs =
475+ names.size > 0
476+ ? host
477+ .definitionCollisionsAt(agent, host.newerAt(agent, owed.version), names, owed.version)
478+ .filter((d) => just.has(d.by))
479+ : [];
480+ const moves = owed.all ? moveNews(host, draft, just, space, owed.version, owed.version) : [];
481+ const items = [...lines, ...definitionNews(defs), ...moves].filter((item) => !agent.told.has(item.key));
445482 if (items.length > 0) out.push({ agent: agent.name, items });
446483 }
447484 return out;
448485}
486+/** newsOwed, under the name tonight's owed definition news had (abso 2341e805). */
487+export const definitionNewsOwed = newsOwed;
449488
450489/**
451490 * The agents a publish's owed news may be for, in the order definitionNewsOwed takes them: every other agent in the
--- a/worker/project/project.ts
+++ b/worker/project/project.ts
@@ -103,10 +103,11 @@
103103import { move as hostedMove, type MoveHost } from "./move.ts";
104104import {
105105 addressedItem,
106− definitionNewsOwed as hostedDefinitionNewsOwed,
107106 newsAboutOwnDraft as hostedNewsAboutOwnDraft,
108107 newsForOthers as hostedNewsForOthers,
108+ newsOwed as hostedNewsOwed,
109109 owedAgents as hostedOwedAgents,
110+ owedNewsNames as hostedOwedNewsNames,
110111 markedItem,
111112 type NewsHost,
112113 type NewsItem,
@@ -1353,11 +1354,21 @@
13531354 return owed;
13541355 }
13551356
1356− /** What a publish owes, worked out against its version (news.ts definitionNewsOwed), for `only` these agents if given. Reads only. */
1357+ /** What a publish owes, worked out against its version (news.ts newsOwed), for `only` these agents if given. Reads only. */
1358+ newsOwed(owed: OwedDefinitionNews, only?: readonly string[]): { agent: string; items: NewsItem[] }[] {
1359+ return hostedNewsOwed(this.#newsHost, owed, only);
1360+ }
1362+ /** newsOwed, under the name owed definition news had before abso 714. */
13571363 definitionNewsOwed(owed: OwedDefinitionNews, only?: readonly string[]): { agent: string; items: NewsItem[] }[] {
1358− return hostedDefinitionNewsOwed(this.#newsHost, owed, only);
1364+ return this.newsOwed(owed, only);
13591365 }
13601366
1367+ /** The names a publish's definitions changed (news.ts owedNewsNames), worked out once for its owed news. Reads only. */
1368+ owedNewsNames(owed: OwedDefinitionNews): string[] {
1369+ return hostedOwedNewsNames(this.#newsHost, owed);
1370+ }
13611372 /** The agents a publish's owed news may be for (news.ts owedAgents). Reads only. */
13621373 owedAgents(owed: OwedDefinitionNews): string[] {
13631374 return hostedOwedAgents(this.#newsHost, owed);
@@ -2176,6 +2187,9 @@
21762187 newerAt: (agent, version) => this.#newerFor(agent, version),
21772188 definitionCollisionsAt: (agent, newer, names, version) =>
21782189 this.#definitionCollisions(agent, newer, names, version),
2190+ setAt: (space, version) => this.#at(space, version),
2191+ collisionAt: (agent, pair, version) =>
2192+ this.#describe(pair, this.#agentView(agent), this.#viewAt(this.#spaceOf(agent), version), agent.space),
21792193 };
21802194 return this.#news;
21812195 }
--- a/worker/project/test/news-lines.test.ts
+++ b/worker/project/test/news-lines.test.ts
@@ -37,7 +37,6 @@
3737 );
3838 assert.equal(news[0]!.publisher, "lib");
3939 assert.equal(news[1]!.drafts, 1);
40− assert.equal(news[1]!.files, 1);
4140 assert.equal(news[1]!.changedNames, 1);
4241 assert.equal(news[1]!.news, 1);
4342});
--- a/worker/project/test/owed-definition-news.test.ts
+++ b/worker/project/test/owed-definition-news.test.ts
@@ -66,7 +66,7 @@
6666 assert.deepEqual(owing.publish("ann", "parsePattern takes flags", 4), toldAnswer, "the publisher's answer");
6767 const owed = owing.takeOwedDefinitionNews();
6868 assert.deepEqual(owed, [
69− { version: owing.version, space: owed[0]!.space, publisher: "ann", names: ["parsePattern"] },
69+ { version: owing.version, space: owed[0]!.space, publisher: "ann", all: true },
7070 ]);
7171 assert.deepEqual(owing.takeOwedDefinitionNews(), [], "handed over once");
7272 // Not told yet: bob's news holds no definition news until it's delivered.
@@ -145,3 +145,47 @@
145145 owing.sync("bob");
146146 assert.deepEqual(owing.owedAgents(owed!), ["cat"], "synced past it");
147147});
149+test("everything a publish tells other agents is owed and told after it, the same news (abso 714)", () => {
150+ // bob's draft calls parsePattern (definition news), dee's changes the line ann's publish changes (same-lines news),
151+ // and cat's touches nothing of it (no news).
152+ const scenario = (project: Project) => {
153+ drafts(project);
154+ project.sync("dee");
155+ project.edit(
156+ "dee",
157+ { file: "src/parse.ts", old: "parsePattern(text: string): Node", new: "parsePattern(input: string): Node" },
158+ 5,
159+ );
160+ };
161+ const told = new Project(new MemoryStore());
162+ scenario(told);
163+ const toldAnswer = told.publish("ann", "parsePattern takes flags", 6);
164+ const expected = Object.fromEntries(["bob", "cat", "dee"].map((a) => [a, told.news(a).news.toSorted()]));
165+ assert.ok(expected.bob!.length > 0 && expected.dee!.length > 0, "the scenario has both kinds of news");
167+ const owing = new Project(new MemoryStore());
168+ owing.owesDefinitionNews = true;
169+ scenario(owing);
170+ assert.deepEqual(owing.publish("ann", "parsePattern takes flags", 6), toldAnswer, "the publisher's answer");
171+ const [owed] = owing.takeOwedDefinitionNews();
172+ assert.equal(owed!.all, true);
173+ for (const a of ["bob", "cat", "dee"]) assert.deepEqual(owing.news(a).news, [], `${a} is told nothing in the publish`);
174+ const names = owing.owedNewsNames(owed!);
175+ assert.deepEqual(names, ["parsePattern"]);
176+ // One agent at a time, as the host works it out.
177+ for (const agent of owing.owedAgents(owed!)) owing.deliverOwedNews(owing.newsOwed({ ...owed!, names }, [agent]));
178+ for (const a of ["bob", "cat", "dee"]) assert.deepEqual(owing.news(a).news.toSorted(), expected[a], a);
179+ // Twice tells nothing more.
180+ assert.deepEqual(owing.newsOwed({ ...owed!, names }), []);
181+});
183+test("a publish that no other draft can collide with owes nothing", () => {
184+ const owing = new Project(new MemoryStore());
185+ owing.owesDefinitionNews = true;
186+ owing.init({ "a.txt": "one\n" }, 0);
187+ owing.sync("ann");
188+ owing.edit("ann", { file: "a.txt", old: "one", new: "two" }, 1);
189+ owing.publish("ann", "alone", 2);
190+ assert.deepEqual(owing.takeOwedDefinitionNews(), []);
191+});