{"version":308,"agent":"capacity","message":"Owed news can be worked out a few agents at a time: owedAgents lists who may be owed, and definitionNewsOwed takes only those named (abso 714; Cloud's (b), Capacity)\n\n- On prod abso at 6:31 PM CT, one owed-news read over every draft ran as one storage transaction and reset the object. Core 307 cut that read about ninefold; this lets the host bound it outright.\n- owedAgents(owed): every other agent in the space, behind the version, with a draft, in the order definitionNewsOwed takes them. Cheap: no definition rule.\n- definitionNewsOwed(owed, only?): the same news, for only those agents when named. Per agent it's the same work and the same items as before, so the news one agent at a time adds up to the whole.\n- abso's DiskRoute (worker side, with Cloud) lists them once per owed row, then works out and tells up to four a tick, each in its own read and write, keeping the rest on the row.\n\nChecks: core tsc clean; Biome clean; node --test worker/project/test/owed-definition-news (new: owedAgents lists bob and cat, one agent at a time equals the whole, a synced agent drops out), changed-definition, news-lazy, news-cap, news-lines, news-written, news-times, shared-additions, project: 46 of 46 pass.","time":1792194705042,"timeIso":"2026-10-16T23:51:45.042Z","changes":3,"change":5251,"files":["worker/project/news.ts","worker/project/project.ts","worker/project/test/owed-definition-news.test.ts"],"draft":null,"diff":[{"path":"worker/project/news.ts","added":27,"removed":3,"diff":"--- a/worker/project/news.ts\n+++ b/worker/project/news.ts\n@@ -424,15 +424,20 @@\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+export function definitionNewsOwed(\n+\thost: NewsHost,\n+\towed: OwedDefinitionNews,\n+\t/** Only these agents (owedAgents' names), so a host can work the news out a few agents at a time (abso 714). */\n+\tonly?: readonly string[],\n+): { 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\tif (only && !only.includes(agent.name)) continue;\n+\t\tif (!owedTo(host, owed, space, agent)) 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@@ -441,3 +446,22 @@\n \t}\n \treturn out;\n }\n+\n+/**\n+ * The agents a publish's owed news may be for, in the order definitionNewsOwed takes them: every other agent in the\n+ * space, behind the version, with a draft. Cheap (no definition rule), so a host can list them once and then work the\n+ * news out a few at a time, each in its own read (abso 714: one read over every draft reset prod abso's object).\n+ */\n+export function owedAgents(host: NewsHost, owed: OwedDefinitionNews): string[] {\n+\tconst space = host.spaceNamed(owed.space);\n+\tif (!space || owed.version > last(space) || !space.versions[owed.version]) return [];\n+\treturn [...host.agents.values()]\n+\t\t.toSorted((a, b) => (a.name < b.name ? -1 : 1))\n+\t\t.filter((agent) => owedTo(host, owed, space, agent))\n+\t\t.map((agent) => agent.name);\n+}\n+\n+function owedTo(host: NewsHost, owed: OwedDefinitionNews, space: Space, agent: AgentState): boolean {\n+\tif (agent.name === owed.publisher || agent.space !== space.name || agent.base >= owed.version) return false;\n+\treturn host.draft(agent).length > 0;\n+}"},{"path":"worker/project/project.ts","added":9,"removed":3,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -106,6 +106,7 @@\n \tdefinitionNewsOwed as hostedDefinitionNewsOwed,\n \tnewsAboutOwnDraft as hostedNewsAboutOwnDraft,\n \tnewsForOthers as hostedNewsForOthers,\n+\towedAgents as hostedOwedAgents,\n \tmarkedItem,\n \ttype NewsHost,\n \ttype NewsItem,\n@@ -1352,11 +1353,16 @@\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/** What a publish owes, worked out against its version (news.ts definitionNewsOwed), for `only` these agents if given. Reads only. */\n+\tdefinitionNewsOwed(owed: OwedDefinitionNews, only?: readonly string[]): { agent: string; items: NewsItem[] }[] {\n+\t\treturn hostedDefinitionNewsOwed(this.#newsHost, owed, only);\n \t}\n \n+\t/** The agents a publish's owed news may be for (news.ts owedAgents). Reads only. */\n+\towedAgents(owed: OwedDefinitionNews): string[] {\n+\t\treturn hostedOwedAgents(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[] = [];"},{"path":"worker/project/test/owed-definition-news.test.ts","added":17,"removed":0,"diff":"--- a/worker/project/test/owed-definition-news.test.ts\n+++ b/worker/project/test/owed-definition-news.test.ts\n@@ -128,3 +128,20 @@\n \tassert.deepEqual(told.takeOwedDefinitionNews(), []);\n \tassert.equal(definitionNews(told.news(\"bob\").news).length, 1);\n });\n+\n+test(\"owedAgents lists who may be owed, and the news one agent at a time adds up to the whole (abso 714)\", () => {\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+\tassert.deepEqual(owing.owedAgents(owed!), [\"bob\", \"cat\"], \"every other agent behind it with a draft\");\n+\tconst whole = owing.definitionNewsOwed(owed!);\n+\tassert.equal(whole.length, 1);\n+\tassert.deepEqual(\n+\t\towing.owedAgents(owed!).flatMap((agent) => owing.definitionNewsOwed(owed!, [agent])),\n+\t\twhole,\n+\t);\n+\towing.sync(\"bob\");\n+\tassert.deepEqual(owing.owedAgents(owed!), [\"cat\"], \"synced past it\");\n+});"}],"ci":null}