{"version":295,"agent":"capacity","message":"Owed news: a publish can leave its definition news for other agents for after its write (abso Capacity; prod abso's publishes reset its object, 2026-10-15)\n\n- With Project.owesDefinitionNews set, newsForOthers still tells same-lines and move news in the publish, but leaves the definition rule over other agents' drafts out. It records an OwedDefinitionNews {version, space, publisher, names} instead; takeOwedDefinitionNews hands it to the host once.\n- definitionNewsOwed(owed) works that news out later, as it would have been told at the publish: the rule runs against the space at that version, with the work published up to that version only (#newerFor and SharedAdditions take an end version). It reads only. An agent that has synced past the version since is left out.\n- deliverOwedNews(found) tells it through queueNews, so a key an agent was already told adds nothing.\n- Default off: the replay engine and every existing caller behave as before. abso's disk route turns it on, keeps the marker in the publish's own transaction, and delivers from the alarm.\n- Why: on abso's stored tables, the definition rule over ~40 drafts was 5.5 of a 1437-shaped publish's 7.3 s in the lab, about 45 s of one storage transaction in prod. That reset abso's object at 11:08 PM CT. With the rule owed, the publish's write is 18,622 statements instead of 105,252.\n- On prod since 11:35 PM CT as a patch (abso 2341e805), with Agent VCS's yes. This brings core level with it; abso's pin follows.\n- Keeps Observability's publishNews log lines (abso 702), and adds owed: 1 or 0 to the end line.\n\nChecks: tsc clean. node --test in worker/project/test, 41 of 41 pass: changed-definition, collision-streaming, collisions-kept-views, news-cap, news-lazy, news-lines, news-times, news-written, owed-definition-news (new: the same news, against the publish's version even after a later publish removes the name, synced agents left out, the replay engine unchanged), project-writer-storage, writer-adoption.","time":1792125636019,"timeIso":"2026-10-16T04:40:36.019Z","changes":4,"change":4648,"files":["worker/project/news.ts","worker/project/project.ts","worker/project/spaces.ts","worker/project/test/owed-definition-news.test.ts"],"draft":null,"diff":[{"path":"worker/project/news.ts","added":60,"removed":1,"diff":"--- a/worker/project/news.ts\n+++ b/worker/project/news.ts\n@@ -257,8 +257,32 @@\n \tqueueNews(agent: AgentState, items: readonly NewsItem[], entries: Entry[]): void;\n \t/** A line for the host's logs (ProjectOptions.logLine). */\n \tlogLine?(line: Record<string, string | number>): void;\n+\t/**\n+\t * Owed news (abso Capacity, 2026-10-15): when this answers true, a publish leaves its definition news for other\n+\t * agents to be worked out after its write (definitionNewsOwed) and hands it to owe instead.\n+\t */\n+\towesDefinitionNews(): boolean;\n+\towe(owed: OwedDefinitionNews): void;\n+\tspaceNamed(name: string): Space | undefined;\n+\t/** newerFor as it was at `version` of the agent's space. */\n+\tnewerAt(agent: AgentState, version: number): ReadonlySet<AtomId>;\n+\t/** definitionCollisions against the agent's space at `version`, not its newest. */\n+\tdefinitionCollisionsAt(\n+\t\tagent: AgentState,\n+\t\tnewer: ReadonlySet<AtomId>,\n+\t\tnames: ReadonlySet<string>,\n+\t\tversion: number,\n+\t): DefinitionCollision[];\n }\n \n+/** A publish's definition news for other agents, not yet worked out: the version it made, and the names it changed. */\n+export interface OwedDefinitionNews {\n+\treadonly version: number;\n+\treadonly space: string;\n+\treadonly publisher: string;\n+\treadonly names: readonly string[];\n+}\n+\n function lineNews(host: NewsHost, agent: AgentState, pairs: readonly Pair[]): NewsItem[] {\n \treturn pairs.map((p) => ({ key: pairKey(p), text: linesText(host.collision(agent, p)) }));\n }\n@@ -349,6 +373,12 @@\n \t\t\t),\n \t\t);\n \t};\n+\t// Owed (abso Capacity, 2026-10-15): the definition rule over every other draft was most of a publish's write on\n+\t// 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\n+\t// and moves are told here as before; the definition news is worked out after the write, against this version.\n+\t// Asked only once some other agent has a draft (news-lazy.test.ts: no news work at all otherwise).\n+\tlet owing: boolean | undefined;\n+\tlet owed = false;\n \tfor (const agent of [...host.agents.values()].toSorted((a, b) => (a.name < b.name ? -1 : 1))) {\n \t\tif (agent === publisher || agent.space !== space.name) continue;\n \t\tconst draft = host.draft(agent);\n@@ -357,8 +387,10 @@\n \t\t\thost.logLine?.({ work: \"publishNews\", step: \"start\", space: space.name, version, publisher: publisher.name });\n \t\tconst lines = pairsIn(host.graph, draft, just, unionOverlay(host.setOf(space), draft));\n \t\tchangedNames ??= compareDefinitions();\n+\t\towing ??= host.owesDefinitionNews();\n+\t\tif (owing && changedNames.size > 0) owed = true;\n \t\tconst defs =\n-\t\t\tchangedNames.size > 0\n+\t\t\tchangedNames.size > 0 && !owing\n \t\t\t\t? host.definitionCollisions(agent, host.newerFor(agent), changedNames).filter((d) => just.has(d.by))\n \t\t\t\t: [];\n \t\tconst items = [\n@@ -380,5 +412,32 @@\n \t\t\tfiles,\n \t\t\tchangedNames: changedNames?.size ?? 0,\n \t\t\tnews,\n+\t\t\towed: owed ? 1 : 0,\n \t\t});\n+\tif (owed)\n+\t\thost.owe({ version, space: space.name, publisher: publisher.name, names: [...(changedNames ?? [])].sort() });\n }\n+\n+/**\n+ * The definition news a publish owes, worked out as newsForOthers would have at that version: the same agents, the\n+ * same rule against the space at `owed.version` and the work published up to it, the same words and keys. Reads only.\n+ * An agent that has synced past the version since is left out (the version is no longer newer for it), and an item\n+ * an agent was already told (from its own edit since, or this run before) is dropped, as queueNews would.\n+ */\n+export function definitionNewsOwed(host: NewsHost, owed: OwedDefinitionNews): { agent: string; items: NewsItem[] }[] {\n+\tconst space = host.spaceNamed(owed.space);\n+\tif (!space || owed.version > last(space) || !space.versions[owed.version]) return [];\n+\tconst just = new Set(space.versions[owed.version]!.atoms);\n+\tconst names = new Set(owed.names);\n+\tconst out: { agent: string; items: NewsItem[] }[] = [];\n+\tfor (const agent of [...host.agents.values()].toSorted((a, b) => (a.name < b.name ? -1 : 1))) {\n+\t\tif (agent.name === owed.publisher || agent.space !== space.name || agent.base >= owed.version) continue;\n+\t\tif (host.draft(agent).length === 0) continue;\n+\t\tconst defs = host\n+\t\t\t.definitionCollisionsAt(agent, host.newerAt(agent, owed.version), names, owed.version)\n+\t\t\t.filter((d) => just.has(d.by));\n+\t\tconst items = definitionNews(defs).filter((item) => !agent.told.has(item.key));\n+\t\tif (items.length > 0) out.push({ agent: agent.name, items });\n+\t}\n+\treturn out;\n+}"},{"path":"worker/project/project.ts","added":44,"removed":4,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -105,9 +105,11 @@\n \taddressedItem,\n \tnewsAboutOwnDraft as hostedNewsAboutOwnDraft,\n \tnewsForOthers as hostedNewsForOthers,\n+\tdefinitionNewsOwed as hostedDefinitionNewsOwed,\n \tmarkedItem,\n \ttype NewsHost,\n \ttype NewsItem,\n+\ttype OwedDefinitionNews,\n \treviewItem,\n \tsettledItem,\n } from \"./news.ts\";\n@@ -330,6 +332,12 @@\n \t * doesn't depend on it.\n \t */\n \tcheckerReady = false;\n+\t/**\n+\t * Owed news (abso Capacity, 2026-10-15): a publish's definition news for other agents is left for after its write\n+\t * (takeOwedDefinitionNews, definitionNewsOwed, deliverOwedNews). The disk route sets it; the replay engine doesn't.\n+\t */\n+\towesDefinitionNews = false;\n+\t#owed: OwedDefinitionNews[] = [];\n \treadonly #now: (() => number) | undefined;\n \treadonly #newsWritten: ((items: readonly NewsWritten[]) => void) | undefined;\n \treadonly #whole: ProjectOptions[\"whole\"];\n@@ -1337,6 +1345,29 @@\n \t\treturn hostedAnnouncePerson(this.#announceHost, ...args);\n \t}\n \n+\t/** The definition news the writes since the last call owe other agents, handed over once (news.ts). */\n+\ttakeOwedDefinitionNews(): OwedDefinitionNews[] {\n+\t\tconst owed = this.#owed;\n+\t\tthis.#owed = [];\n+\t\treturn owed;\n+\t}\n+\n+\t/** What a publish owes, worked out against its version (news.ts definitionNewsOwed). Reads only. */\n+\tdefinitionNewsOwed(owed: OwedDefinitionNews): { agent: string; items: NewsItem[] }[] {\n+\t\treturn hostedDefinitionNewsOwed(this.#newsHost, owed);\n+\t}\n+\n+\t/** Tells each agent its owed items, as queueNews does: what an agent was already told adds nothing. */\n+\tdeliverOwedNews(found: readonly { agent: string; items: readonly NewsItem[] }[]): number {\n+\t\tconst entries: Entry[] = [];\n+\t\tfor (const { agent: name, items } of found) {\n+\t\t\tconst agent = this.#agents.get(name);\n+\t\t\tif (agent) this.#queueNews(agent, items, entries);\n+\t\t}\n+\t\tthis.#flush(entries);\n+\t\treturn entries.length;\n+\t}\n+\n \t/** A seat's earlier chat hears that another chat just used the seat (announce.ts seatNotice). */\n \tseatNotice(...args: Tail<Parameters<typeof hostedSeatNotice>>): ReturnType<typeof hostedSeatNotice> {\n \t\treturn hostedSeatNotice(this.#announceHost, ...args);\n@@ -2133,6 +2164,12 @@\n \t\t\tdefinitionCollisions: (agent, newer, names) => this.#definitionCollisions(agent, newer, names),\n \t\t\tqueueNews: (agent, items, entries) => this.#queueNews(agent, items, entries),\n \t\t\tlogLine: (line) => this.#logLine?.(line),\n+\t\t\towesDefinitionNews: () => this.owesDefinitionNews,\n+\t\t\towe: (owed) => void this.#owed.push(owed),\n+\t\t\tspaceNamed: (name) => (name === SHARED ? this.#shared : this.#spaces.get(name)),\n+\t\t\tnewerAt: (agent, version) => this.#newerFor(agent, version),\n+\t\t\tdefinitionCollisionsAt: (agent, newer, names, version) =>\n+\t\t\t\tthis.#definitionCollisions(agent, newer, names, version),\n \t\t};\n \t\treturn this.#news;\n \t}\n@@ -2995,13 +3032,14 @@\n \t}\n \n \t/** The space's atoms published after the agent's base, by others. */\n-\t#newerFor(agent: AgentState): ReadonlySet<AtomId> {\n+\t/** `upTo`: the work published after the agent's base up to that version only (owed news, news.ts). */\n+\t#newerFor(agent: AgentState, upTo?: number): ReadonlySet<AtomId> {\n \t\tconst space = this.#spaceOf(agent);\n \t\tconst base = this.#at(space, agent.base);\n-\t\tconst current = this.#setOf(space);\n+\t\tconst current = upTo === undefined ? this.#setOf(space) : this.#at(space, upTo);\n \t\tconst newer =\n \t\t\tspace.name === SHARED && space.membershipVersion\n-\t\t\t\t? new SharedAdditions(space, agent.base, base, current)\n+\t\t\t\t? new SharedAdditions(space, agent.base, base, current, upTo ?? last(space))\n \t\t\t\t: differenceSet(current, base);\n \t\treturn differenceSet(newer, new StableOverlaySet(agent.mine));\n \t}\n@@ -3141,6 +3179,8 @@\n \t\tagent: AgentState,\n \t\tnewer: ReadonlySet<AtomId>,\n \t\tnames?: ReadonlySet<string>,\n+\t\t/** The space's version to compare against: its newest, or an owed publish's (news.ts). */\n+\t\tversion?: number,\n \t): DefinitionCollision[] {\n \t\tconst draft = new Set(this.#draft(agent));\n \t\tif (draft.size === 0 || newer.size === 0) return [];\n@@ -3153,7 +3193,7 @@\n \t\t\tdraft,\n \t\t\tthis.#agentView(agent),\n \t\t\tbase,\n-\t\t\tthis.#viewAt(space, last(space)),\n+\t\t\tthis.#viewAt(space, version ?? last(space)),\n \t\t\tnewer,\n \t\t\tspace.name,\n \t\t\tundefined,"},{"path":"worker/project/spaces.ts","added":9,"removed":2,"diff":"--- a/worker/project/spaces.ts\n+++ b/worker/project/spaces.ts\n@@ -361,10 +361,17 @@\n \treadonly baseVersion: number;\n \treadonly base: ReadonlySet<AtomId>;\n \treadonly current: ReadonlySet<AtomId>;\n-\tconstructor(space: Space, baseVersion: number, base: ReadonlySet<AtomId>, current: ReadonlySet<AtomId>) {\n+\t/** `endVersion`: the version `current` is (the newest by default; an earlier one for owed news, news.ts). */\n+\tconstructor(\n+\t\tspace: Space,\n+\t\tbaseVersion: number,\n+\t\tbase: ReadonlySet<AtomId>,\n+\t\tcurrent: ReadonlySet<AtomId>,\n+\t\tendVersion = last(space),\n+\t) {\n \t\tsuper();\n \t\tif (space.name !== SHARED || !space.membershipVersion) throw Error(\"shared additions require indexed shared space\");\n-\t\tthis.endVersion = last(space);\n+\t\tthis.endVersion = endVersion;\n \t\tthis.space = space;\n \t\tthis.baseVersion = baseVersion;\n \t\tthis.base = base;"},{"path":"worker/project/test/owed-definition-news.test.ts","added":116,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/owed-definition-news.test.ts\n@@ -0,0 +1,116 @@\n+// Owed news (abso Capacity, 2026-10-15): with owesDefinitionNews set (abso's disk route sets it), a publish leaves its\n+// definition news for other agents for after its write. The same news, against the publish's version; told once; and\n+// the publisher's own answer as before. abso's worker/test/owed-news.test.ts covers the disk route's marker and alarm.\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { MemoryStore, Project } from \"../project.ts\";\n+\n+// abso-core's changed-definition.test.ts scenario: parse.ts defines parsePattern, match.ts imports it.\n+const START = {\n+\t\"src/parse.ts\": [\n+\t\t\"export function parsePattern(text: string): Node {\",\n+\t\t'  return { kind: \"lit\", text };',\n+\t\t\"}\",\n+\t\t\"\",\n+\t\t\"export interface Node {\",\n+\t\t\"  kind: string;\",\n+\t\t\"  text: string;\",\n+\t\t\"}\",\n+\t].join(\"\\n\"),\n+\t\"src/match.ts\": ['import { parsePattern } from \"./parse.ts\";', \"\", \"export function run(p: string) {\", \"  return p;\", \"}\"].join(\n+\t\t\"\\n\",\n+\t),\n+\t\"README.md\": \"Uses parsePattern.\\n\",\n+};\n+\n+/** bob's draft calls parsePattern; ann's draft changes its signature; cat's touches something else. Nothing published. */\n+function drafts(project: Project): void {\n+\tproject.init(START, 0);\n+\tproject.sync(\"bob\");\n+\tproject.sync(\"ann\");\n+\tproject.sync(\"cat\");\n+\tproject.edit(\"bob\", { file: \"src/match.ts\", old: \"  return p;\\n\", new: \"  const tree = parsePattern(p);\\n  return tree;\\n\" }, 1);\n+\tproject.edit(\n+\t\t\"ann\",\n+\t\t{ file: \"src/parse.ts\", old: \"parsePattern(text: string): Node\", new: \"parsePattern(text: string, flags: string): Node\" },\n+\t\t2,\n+\t);\n+\tproject.edit(\"cat\", { file: \"README.md\", old: \"Uses parsePattern.\", new: \"Uses parsePattern, twice.\" }, 3);\n+}\n+\n+const definitionNews = (news: readonly string[]) => news.filter((n) => /definition of parsePattern/.test(n)).sort();\n+\n+test(\"the news owed is the news a publish would have told, and the publisher's own answer is the same\", () => {\n+\tconst told = new Project(new MemoryStore());\n+\tdrafts(told);\n+\tconst toldAnswer = told.publish(\"ann\", \"parsePattern takes flags\", 4);\n+\tconst expected = definitionNews(told.news(\"bob\").news);\n+\tassert.equal(expected.length, 1, \"the scenario has a definition collision\");\n+\n+\tconst owing = new Project(new MemoryStore());\n+\towing.owesDefinitionNews = true;\n+\tdrafts(owing);\n+\tassert.deepEqual(owing.publish(\"ann\", \"parsePattern takes flags\", 4), toldAnswer, \"the publisher's answer\");\n+\tconst owed = owing.takeOwedDefinitionNews();\n+\tassert.deepEqual(owed, [{ version: owing.version, space: owed[0]!.space, publisher: \"ann\", names: [\"parsePattern\"] }]);\n+\tassert.deepEqual(owing.takeOwedDefinitionNews(), [], \"handed over once\");\n+\t// Not told yet: bob's news holds no definition news until it's delivered.\n+\tassert.deepEqual(definitionNews(owing.news(\"bob\").news), []);\n+\tconst found = owing.definitionNewsOwed(owed[0]!);\n+\tassert.deepEqual(\n+\t\tfound.map((f) => f.agent),\n+\t\t[\"bob\"],\n+\t);\n+\tassert.ok(owing.deliverOwedNews(found) > 0);\n+\tassert.deepEqual(definitionNews(owing.news(\"bob\").news), expected);\n+\t// Told twice adds nothing, and a run of the read after delivery finds nothing left.\n+\tassert.equal(owing.deliverOwedNews(found), 0);\n+\tassert.deepEqual(owing.definitionNewsOwed(owed[0]!), []);\n+});\n+\n+test(\"worked out against the publish's version, though more was published before the news went out\", () => {\n+\tconst told = new Project(new MemoryStore());\n+\tdrafts(told);\n+\ttold.publish(\"ann\", \"parsePattern takes flags\", 4);\n+\tconst expected = definitionNews(told.news(\"bob\").news);\n+\n+\tconst owing = new Project(new MemoryStore());\n+\towing.owesDefinitionNews = true;\n+\tdrafts(owing);\n+\towing.publish(\"ann\", \"parsePattern takes flags\", 4);\n+\tconst [first] = owing.takeOwedDefinitionNews();\n+\t// Then parsePattern is removed, before the first publish's news is out: against the newest version the news\n+\t// would say \"removes\"; against the first publish's, it says \"changes\", as told at publish time.\n+\towing.sync(\"ann\");\n+\towing.edit(\n+\t\t\"ann\",\n+\t\t{\n+\t\t\tfile: \"src/parse.ts\",\n+\t\t\told: 'export function parsePattern(text: string, flags: string): Node {\\n  return { kind: \"lit\", text };\\n}\\n',\n+\t\t\tnew: \"\",\n+\t\t},\n+\t\t5,\n+\t);\n+\towing.publish(\"ann\", \"parsePattern goes\", 6);\n+\tassert.ok(owing.deliverOwedNews(owing.definitionNewsOwed(first!)) > 0);\n+\tassert.deepEqual(definitionNews(owing.news(\"bob\").news), expected, \"the first publish's news, as it was\");\n+});\n+\n+test(\"an agent that synced past the version since isn't told it\", () => {\n+\tconst owing = new Project(new MemoryStore());\n+\towing.owesDefinitionNews = true;\n+\tdrafts(owing);\n+\towing.publish(\"ann\", \"parsePattern takes flags\", 4);\n+\tconst [owed] = owing.takeOwedDefinitionNews();\n+\towing.sync(\"bob\");\n+\tassert.deepEqual(owing.definitionNewsOwed(owed!), []);\n+});\n+\n+test(\"the replay engine tells it at publish time, as before\", () => {\n+\tconst told = new Project(new MemoryStore());\n+\tdrafts(told);\n+\ttold.publish(\"ann\", \"parsePattern takes flags\", 4);\n+\tassert.deepEqual(told.takeOwedDefinitionNews(), []);\n+\tassert.equal(definitionNews(told.news(\"bob\").news).length, 1);\n+});"}],"ci":null}