{"version":286,"agent":"df-routing","message":"Log a line as a publish's news for other agents starts and ends (abso 702), through a new logLine option; nothing is written until a host passes it","time":1792119473159,"timeIso":"2026-10-16T02:57:53.159Z","changes":12,"change":4520,"files":["worker/project/news.ts","worker/project/project-types.ts","worker/project/project.ts","worker/project/test/news-lines.test.ts"],"draft":null,"diff":[{"path":"worker/project/news.ts","added":25,"removed":5,"diff":"--- a/worker/project/news.ts\n+++ b/worker/project/news.ts\n@@ -255,6 +255,8 @@\n \t\tnames?: ReadonlySet<string>,\n \t): DefinitionCollision[];\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 }\n \n function lineNews(host: NewsHost, agent: AgentState, pairs: readonly Pair[]): NewsItem[] {\n@@ -331,8 +333,14 @@\n \t// 2026-10-15): it compared definitions in every file changed since each agent's base, for every agent with a draft,\n \t// and a publish touching abso's worker/src/index.ts took 48 s of it.\n \tlet changedNames: ReadonlySet<string> | undefined;\n+\t// For the host's logs (abso 702): a line as the work starts, written before it, and one as it ends, so work that\n+\t// outlives its request still shows. No time in them: a Durable Object's clock stands still in synchronous code.\n+\tlet drafts = 0;\n+\tlet files = 0;\n+\tlet news = 0;\n \tconst compareDefinitions = (): ReadonlySet<string> => {\n \t\tconst touched = touchedFiles(host.graph, just, [host.viewAt(space, version - 1), host.viewAt(space, last(space))]);\n+\t\tfiles = touched.size;\n \t\tconst before = definitionsIn(host.viewAt(space, version - 1), touched);\n \t\tconst after = definitionsIn(host.viewAt(space, last(space)), touched);\n \t\treturn new Set(\n@@ -345,16 +353,28 @@\n \t\tif (agent === publisher || agent.space !== space.name) continue;\n \t\tconst draft = host.draft(agent);\n \t\tif (draft.length === 0) continue;\n+\t\tif (drafts++ === 0)\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\tconst defs =\n \t\t\tchangedNames.size > 0\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\thost.queueNews(\n-\t\t\tagent,\n-\t\t\t[...lineNews(host, agent, lines), ...definitionNews(defs), ...moveNews(host, draft, just, space, version)],\n-\t\t\tentries,\n-\t\t);\n+\t\tconst items = [...lineNews(host, agent, lines), ...definitionNews(defs), ...moveNews(host, draft, just, space, version)];\n+\t\tnews += items.length;\n+\t\thost.queueNews(agent, items, entries);\n \t}\n+\tif (drafts > 0)\n+\t\thost.logLine?.({\n+\t\t\twork: \"publishNews\",\n+\t\t\tstep: \"end\",\n+\t\t\tspace: space.name,\n+\t\t\tversion,\n+\t\t\tpublisher: publisher.name,\n+\t\t\tdrafts,\n+\t\t\tfiles,\n+\t\t\tchangedNames: changedNames?.size ?? 0,\n+\t\t\tnews,\n+\t\t});\n }"},{"path":"worker/project/project-types.ts","added":6,"removed":0,"diff":"--- a/worker/project/project-types.ts\n+++ b/worker/project/project-types.ts\n@@ -624,6 +624,12 @@\n \t * recent. Without it, all text stays in memory.\n \t */\n \tentryAt?: (at: number) => Entry;\n+\t/**\n+\t * One line for the host's logs about long work inside an operation (abso\n+\t * 702): written as the work starts and again when it ends, so work that\n+\t * outlives its request still shows. Without it, nothing is written.\n+\t */\n+\tlogLine?: (line: Record<string, string | number>) => void;\n }\n export interface LogEntry {\n \tversion: number;"},{"path":"worker/project/project.ts","added":3,"removed":0,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -332,6 +332,7 @@\n \treadonly #now: (() => number) | undefined;\n \treadonly #whole: ProjectOptions[\"whole\"];\n \treadonly #shapes: ProjectOptions[\"shapes\"];\n+\treadonly #logLine: ProjectOptions[\"logLine\"];\n \t/** For each log position, the newest time up to it (#41): time to position in one search. */\n \treadonly #timeAt: number[] = [];\n \t/** For each version of shared, the log position of the entry that made it (#41). */\n@@ -453,6 +454,7 @@\n \t\tthis.#now = options.now;\n \t\tthis.#whole = options.whole;\n \t\tthis.#shapes = options.shapes;\n+\t\tthis.#logLine = options.logLine;\n \t\t// For tests (#46): AVCS_TEXT_FROM_LOG=1 runs a project on a MemoryStore with its text read back from the store.\n \t\tconst testing =\n \t\t\t(globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env?.AVCS_TEXT_FROM_LOG ===\n@@ -2107,6 +2109,7 @@\n \t\t\tcollision: (agent, pair) => this.#collision(agent, pair),\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};\n \t\treturn this.#news;\n \t}"},{"path":"worker/project/test/news-lines.test.ts","added":61,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/news-lines.test.ts\n@@ -0,0 +1,61 @@\n+// abso 702: a publish's news for other agents writes a line as it starts and\n+// one as it ends, through ProjectOptions.logLine, so work that outlives its\n+// request still shows in the host's logs.\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { MemoryStore, Project } from \"../project.ts\";\n+\n+const START = {\n+\t\"src/parse.ts\": \"export function parsePattern(text: string): string {\\n  return text;\\n}\\n\",\n+\t\"src/match.ts\": 'import { parsePattern } from \"./parse.ts\";\\n\\nexport function run(p: string) {\\n  return p;\\n}\\n',\n+};\n+\n+function setup(lines: Record<string, string | number>[]) {\n+\tconst project = new Project(new MemoryStore(), { logLine: (line) => lines.push(line) });\n+\tproject.init(START, 0);\n+\tproject.sync(\"lib\");\n+\tproject.sync(\"user\");\n+\treturn project;\n+}\n+\n+test(\"a publish with another agent drafting writes a start line and an end line\", () => {\n+\tconst lines: Record<string, string | number>[] = [];\n+\tconst project = setup(lines);\n+\tproject.edit(\"user\", { file: \"src/match.ts\", old: \"  return p;\\n\", new: \"  return parsePattern(p);\\n\" }, 1);\n+\tproject.edit(\n+\t\t\"lib\",\n+\t\t{ file: \"src/parse.ts\", old: \"parsePattern(text: string)\", new: \"parsePattern(text: string, flags = '')\" },\n+\t\t2,\n+\t);\n+\tassert.equal(project.publish(\"lib\", \"parsePattern takes flags\", 3).ok, true);\n+\n+\tconst news = lines.filter((l) => l.work === \"publishNews\");\n+\tassert.deepEqual(\n+\t\tnews.map((l) => l.step),\n+\t\t[\"start\", \"end\"],\n+\t);\n+\tassert.equal(news[0]!.publisher, \"lib\");\n+\tassert.equal(news[1]!.drafts, 1);\n+\tassert.equal(news[1]!.files, 1);\n+\tassert.equal(news[1]!.changedNames, 1);\n+\tassert.equal(news[1]!.news, 1);\n+});\n+\n+test(\"a publish with nobody else drafting writes nothing\", () => {\n+\tconst lines: Record<string, string | number>[] = [];\n+\tconst project = setup(lines);\n+\tproject.edit(\"lib\", { file: \"src/parse.ts\", old: \"  return text;\\n\", new: \"  return text.trim();\\n\" }, 1);\n+\tassert.equal(project.publish(\"lib\", \"trim\", 2).ok, true);\n+\tassert.deepEqual(lines, []);\n+});\n+\n+test(\"without a logLine option, a publish still works\", () => {\n+\tconst project = new Project(new MemoryStore());\n+\tproject.init(START, 0);\n+\tproject.sync(\"lib\");\n+\tproject.sync(\"user\");\n+\tproject.edit(\"user\", { file: \"src/match.ts\", old: \"  return p;\\n\", new: \"  return parsePattern(p);\\n\" }, 1);\n+\tproject.edit(\"lib\", { file: \"src/parse.ts\", old: \"  return text;\\n\", new: \"  return text.trim();\\n\" }, 2);\n+\tassert.equal(project.publish(\"lib\", \"trim\", 3).ok, true);\n+});"}],"ci":null}