{"draft":null,"from":281,"to":318,"files":[{"path":"worker/project/test/express-moves-early.test.ts","added":55,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/express-moves-early.test.ts\n@@ -0,0 +1,55 @@\n+// Moves before laying out files (abso 714, piece 3): expressMoves looks at the draft's own written and deleted lines\n+// first, and lays out no file when none of its written lines with real content has a deleted line's text. moves.test.ts\n+// covers the moves themselves.\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import type { Graph } from \"../../../src/engine/index.ts\";\n+import { type ExpressMovesHost, expressMoves } from \"../express-moves.ts\";\n+import type { AgentState } from \"../project-types.ts\";\n+\n+/** A draft of two atoms: \"del\" deletes one line, \"add\" writes the others. Any view laid out throws. */\n+function host(deleted: string, written: string[]): ExpressMovesHost {\n+\tconst texts = [deleted, ...written];\n+\tconst graph = {\n+\t\tdeletedLines: (id: string) => (id === \"del\" ? [\"line-0\"] : []),\n+\t\t*eachInsertedLine(id: string) {\n+\t\t\tif (id === \"add\") for (let k = 1; k < texts.length; k++) yield `line-${k}`;\n+\t\t},\n+\t\tlineN: (line: string) => Number(line.slice(\"line-\".length)),\n+\t\t*textChunks(n: number) {\n+\t\t\tyield texts[n]!;\n+\t\t},\n+\t\ttextOf: (n: number) => texts[n]!,\n+\t} as unknown as Graph;\n+\tconst laidOut = (): never => {\n+\t\tthrow new Error(\"laid out\");\n+\t};\n+\treturn {\n+\t\tgraph,\n+\t\tdraft: () => [\"del\", \"add\"],\n+\t\tagentView: laidOut,\n+\t\tbeforeDraft: laidOut,\n+\t\tview: laidOut,\n+\t\tapply: laidOut,\n+\t\taddDraft: laidOut,\n+\t\trecordFile: laidOut,\n+\t};\n+}\n+\n+const agent = { name: \"ann\" } as AgentState;\n+\n+test(\"an edit that only changes lines lays out no file\", () => {\n+\texpressMoves(host(\"  return pi * r * r;\", [\"  return Math.PI * r * r;\"]), agent, 1, []);\n+});\n+\n+test(\"a deleted text written again with only brackets or blanks in common lays out no file\", () => {\n+\texpressMoves(host(\"}\", [\"  const tree = parse(p);\", \"}\", \"\"]), agent, 1, []);\n+});\n+\n+test(\"a written line with real content that the draft also deleted goes on to the files\", () => {\n+\tassert.throws(\n+\t\t() => expressMoves(host(\"  return pi * r * r;\", [\"\", \"  return pi * r * r;\"]), agent, 1, []),\n+\t\t/laid out/,\n+\t);\n+});"},{"path":"worker/project/test/file-exact-at.test.ts","added":49,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/file-exact-at.test.ts\n@@ -0,0 +1,49 @@\n+// fileExactAt (version-log.ts, abso Capacity, 2026-10-17): the same answer as fileAt for exactly that spelling, at\n+// every version, read from the file's own lines without the version's list of files. abso's worker/test/\n+// project-files.test.ts checks it on the disk engine, where the list is what costs.\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { MemoryStore, Project } from \"../project.ts\";\n+\n+/** Files added, edited, emptied, made binary and taken out, beside others, over six versions. */\n+function history(): Project {\n+\tconst p = new Project(new MemoryStore(), { hasBlob: () => true });\n+\tp.init({ \"README.md\": \"hi\\n\", \"abso.json\": '{ \"check\": \"true\" }\\n', \"src/a.ts\": \"a\\n\" }, 0);\n+\tp.record(\"ann\", { \"abso.yml\": \"pipelines:\\n  ci:\\n    on: [push]\\n\", \"docs/abso.yml\": \"not this one\\n\" }, 1);\n+\tp.publish(\"ann\", \"a pipeline\", 2);\n+\tp.record(\"ann\", { \"abso.json\": '{ \"check\": \"false\" }\\n', \"empty.txt\": \"\" }, 3, {}, { \"abso.yaml\": \"b\".repeat(64) });\n+\tp.publish(\"ann\", \"a binary, and an empty file\", 4);\n+\tp.record(\"ann\", { \"abso.yml\": null, \"avcs.json\": \"{}\\n\", \"src/a.ts\": \"\" }, 5);\n+\tp.publish(\"ann\", \"the pipeline gone, a file emptied\", 6);\n+\treturn p;\n+}\n+\n+const PATHS = [\n+\t\"abso.yml\",\n+\t\"abso.yaml\",\n+\t\"abso.json\",\n+\t\"avcs.json\",\n+\t\"docs/abso.yml\",\n+\t\"empty.txt\",\n+\t\"src/a.ts\",\n+\t\"README.md\",\n+\t\"never.txt\",\n+];\n+\n+test(\"fileExactAt answers what fileAt answers for the same spelling, at every version\", () => {\n+\tconst p = history();\n+\tconst last = p.version;\n+\tassert.ok(last >= 3);\n+\tfor (let v = 0; v <= last; v++)\n+\t\tfor (const path of PATHS) assert.deepEqual(p.fileExactAt(path, v), p.fileAt(path, v), `${path} at ${v}`);\n+});\n+\n+test(\"a name nothing ever wrote is null, and another spelling is that spelling, not the stored one\", () => {\n+\tconst p = history();\n+\tconst last = p.version;\n+\tassert.deepEqual(p.fileExactAt(\"never.txt\", last), { path: \"never.txt\", version: last, text: null });\n+\t// fileAt reads the stored spelling for any spelling (#41); fileExactAt reads only the one asked.\n+\tassert.equal((p.fileAt(\"ABSO.json\", last) as { text: string | null }).text, '{ \"check\": \"false\" }\\n');\n+\tassert.deepEqual(p.fileExactAt(\"ABSO.json\", last), { path: \"ABSO.json\", version: last, text: null });\n+});"},{"path":"worker/project/test/known-paths.test.ts","added":17,"removed":0,"diff":"--- a/worker/project/test/known-paths.test.ts\n+++ b/worker/project/test/known-paths.test.ts\n@@ -105,3 +105,20 @@\n \t] as const)\n \t\tassert.deepEqual(project.pathsAt(version).files, oracle.draftOf(agent)!.view.paths(), `paths at ${version}`);\n });\n+\n+test(\"an agent's files on a writer, from its base version's kept list when it has nothing of its own, as the in-memory project says\", () => {\n+\t// abso - Performance (abso 711): a status for an agent behind shared listed its files by laying out every known file.\n+\tconst oracle = new Project(new MemoryStore());\n+\tconst project = writer();\n+\thistory(oracle);\n+\thistory(project);\n+\t// v0 and v1 are behind shared with nothing of their own, v2 is at shared, and bob, cy, dee and eve have drafts.\n+\tfor (const agent of [\"v0\", \"v1\", \"v2\", \"bob\", \"cy\", \"dee\", \"eve\"]) {\n+\t\tassert.deepEqual(project.agentPaths(agent), oracle.agentPaths(agent), agent);\n+\t\tassert.deepEqual(project.pathsOf(agent), oracle.pathsOf(agent), `${agent} for a reader`);\n+\t}\n+\tassert.deepEqual(project.agentPaths(\"v0\").files, project.pathsAt(0).files);\n+\tassert.equal(project.agentPaths(\"v0\").files.includes(\"src/gone.ts\"), true);\n+\tassert.equal(project.agentPaths(\"v1\").files.includes(\"src/gone.ts\"), false);\n+\tassert.equal(project.agentPaths(\"eve\").files.includes(\"src/draft-new.ts\"), true);\n+});"},{"path":"worker/project/test/news-lines.test.ts","added":60,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/news-lines.test.ts\n@@ -0,0 +1,60 @@\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]!.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+});"},{"path":"worker/project/test/news-written.test.ts","added":56,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/news-written.test.ts\n@@ -0,0 +1,56 @@\n+// A host learns each write's news as the write appends it (newsWritten), and can read an agent's waiting news without\n+// taking it (peekNews), so a listener can be woken for exactly the agents that got news and caught up on connect.\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { MemoryStore, type NewsWritten, Project } from \"../project.ts\";\n+\n+function setup() {\n+\tconst store = new MemoryStore();\n+\tconst written: NewsWritten[][] = [];\n+\tconst project = new Project(store, { newsWritten: (items) => written.push([...items]) });\n+\tproject.init({ \"a.txt\": \"a\\n\" }, 0);\n+\tfor (const a of [\"builder1\", \"builder2\", \"builder3\"]) project.sync(a);\n+\twritten.length = 0;\n+\treturn { project, store, written };\n+}\n+\n+test(\"a write's news is told once, per item, with its agent, text and place in the log\", () => {\n+\tconst { project, store, written } = setup();\n+\tproject.announce(\"builder1\", \"Ship it\", [\"builder2\", \"builder3\"], 1);\n+\tassert.equal(written.length, 1, \"one call for the write\");\n+\tconst items = written[0]!;\n+\tassert.deepEqual(\n+\t\titems.map((i) => i.agent),\n+\t\t[\"builder2\", \"builder3\"],\n+\t);\n+\tfor (const item of items) {\n+\t\tassert.match(item.text, /Announcement from builder1.*Ship it/);\n+\t\tassert.equal(store.entries[item.seq]?.type, \"news\", \"seq is the entry's place in the log\");\n+\t}\n+\tassert.ok(items[1]!.seq > items[0]!.seq);\n+});\n+\n+test(\"writes with no news, and taking news (heard), tell nothing\", () => {\n+\tconst { project, written } = setup();\n+\tproject.announce(\"builder1\", \"Ship it\", [\"builder2\"], 1);\n+\twritten.length = 0;\n+\tproject.news(\"builder2\");\n+\tproject.sync(\"builder3\");\n+\tassert.deepEqual(written, []);\n+});\n+\n+test(\"peekNews reads waiting news and takes nothing; hasAgent reads only\", () => {\n+\tconst { project, store } = setup();\n+\tproject.announce(\"builder1\", \"Ship it\", [\"builder2\"], 1);\n+\tconst length = store.entries.length;\n+\tconst peeked = project.peekNews(\"builder2\");\n+\tassert.equal(peeked.length, 1);\n+\tassert.match(peeked[0]!.text, /Ship it/);\n+\tassert.deepEqual(project.peekNews(\"builder2\"), peeked, \"still there\");\n+\tassert.deepEqual(project.peekNews(\"nobody\"), [], \"no agent: none, and none made\");\n+\tassert.equal(project.hasAgent(\"builder2\"), true);\n+\tassert.equal(project.hasAgent(\"nobody\"), false);\n+\tassert.equal(store.entries.length, length, \"nothing written\");\n+\tassert.equal(project.news(\"builder2\").news.length, 1, \"the take still finds it\");\n+});"},{"path":"worker/project/test/owed-definition-news.test.ts","added":190,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/owed-definition-news.test.ts\n@@ -0,0 +1,190 @@\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\": [\n+\t\t'import { parsePattern } from \"./parse.ts\";',\n+\t\t\"\",\n+\t\t\"export function run(p: string) {\",\n+\t\t\"  return p;\",\n+\t\t\"}\",\n+\t].join(\"\\n\"),\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(\n+\t\t\"bob\",\n+\t\t{ file: \"src/match.ts\", old: \"  return p;\\n\", new: \"  const tree = parsePattern(p);\\n  return tree;\\n\" },\n+\t\t1,\n+\t);\n+\tproject.edit(\n+\t\t\"ann\",\n+\t\t{\n+\t\t\tfile: \"src/parse.ts\",\n+\t\t\told: \"parsePattern(text: string): Node\",\n+\t\t\tnew: \"parsePattern(text: string, flags: string): Node\",\n+\t\t},\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\", all: true }]);\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+});\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+});\n+\n+test(\"everything a publish tells other agents is owed and told after it, the same news (abso 714)\", () => {\n+\t// bob's draft calls parsePattern (definition news), dee's changes the line ann's publish changes (same-lines news),\n+\t// and cat's touches nothing of it (no news).\n+\tconst scenario = (project: Project) => {\n+\t\tdrafts(project);\n+\t\tproject.sync(\"dee\");\n+\t\tproject.edit(\n+\t\t\t\"dee\",\n+\t\t\t{ file: \"src/parse.ts\", old: \"parsePattern(text: string): Node\", new: \"parsePattern(input: string): Node\" },\n+\t\t\t5,\n+\t\t);\n+\t};\n+\tconst told = new Project(new MemoryStore());\n+\tscenario(told);\n+\tconst toldAnswer = told.publish(\"ann\", \"parsePattern takes flags\", 6);\n+\tconst expected = Object.fromEntries([\"bob\", \"cat\", \"dee\"].map((a) => [a, told.news(a).news.toSorted()]));\n+\tassert.ok(expected.bob!.length > 0 && expected.dee!.length > 0, \"the scenario has both kinds of news\");\n+\n+\tconst owing = new Project(new MemoryStore());\n+\towing.owesDefinitionNews = true;\n+\tscenario(owing);\n+\tassert.deepEqual(owing.publish(\"ann\", \"parsePattern takes flags\", 6), toldAnswer, \"the publisher's answer\");\n+\tconst [owed] = owing.takeOwedDefinitionNews();\n+\tassert.equal(owed!.all, true);\n+\tfor (const a of [\"bob\", \"cat\", \"dee\"])\n+\t\tassert.deepEqual(owing.news(a).news, [], `${a} is told nothing in the publish`);\n+\tconst names = owing.owedNewsNames(owed!);\n+\tassert.deepEqual(names, [\"parsePattern\"]);\n+\t// One agent at a time, as the host works it out.\n+\tfor (const agent of owing.owedAgents(owed!)) owing.deliverOwedNews(owing.newsOwed({ ...owed!, names }, [agent]));\n+\tfor (const a of [\"bob\", \"cat\", \"dee\"]) assert.deepEqual(owing.news(a).news.toSorted(), expected[a], a);\n+\t// Twice tells nothing more.\n+\tassert.deepEqual(owing.newsOwed({ ...owed!, names }), []);\n+});\n+\n+test(\"a publish that no other draft can collide with owes nothing\", () => {\n+\tconst owing = new Project(new MemoryStore());\n+\towing.owesDefinitionNews = true;\n+\towing.init({ \"a.txt\": \"one\\n\" }, 0);\n+\towing.sync(\"ann\");\n+\towing.edit(\"ann\", { file: \"a.txt\", old: \"one\", new: \"two\" }, 1);\n+\towing.publish(\"ann\", \"alone\", 2);\n+\tassert.deepEqual(owing.takeOwedDefinitionNews(), []);\n+});"},{"path":"worker/project/test/shared-additions.test.ts","added":49,"removed":0,"diff":"--- a/worker/project/test/shared-additions.test.ts\n+++ b/worker/project/test/shared-additions.test.ts\n@@ -36,3 +36,52 @@\n \t\tstorage.db.close();\n \t}\n });\n+\n+test(\"shared additions read each atom's version from the membership pages, and answer as its events do (abso - Performance, 714)\", (t) => {\n+\tconst storage = new SqlState();\n+\ttry {\n+\t\tconst membership = new Membership(storage),\n+\t\t\tspace = membership.shared;\n+\t\tconst ids = (from: number, to: number) => Array.from({ length: to - from }, (_, i) => `a${from + i}`);\n+\t\tconst add = (atoms: string[], dropped: string[] = []) =>\n+\t\t\taddVersion(space, { version: space.versions.length, agent: \"test\", message: \"version\", time: 0, atoms, dropped });\n+\t\t// Three pages of atoms; a5 and a400 dropped and a5 back, a601 added and dropped: their events are read.\n+\t\tadd(ids(0, 300));\n+\t\tadd(ids(300, 600));\n+\t\tadd([], [\"a5\", \"a400\"]);\n+\t\tadd([\"a5\", \"a600\"]);\n+\t\tadd([\"a601\"]);\n+\t\tadd([], [\"a601\"]);\n+\t\tconst last = space.versions.length - 1;\n+\t\tconst { membershipVersions: _pages, ...eventsOnly } = space;\n+\t\tconst read = storage.read.bind(storage);\n+\t\tlet eventReads = 0;\n+\t\tt.mock.method(storage, \"read\", (collection: string, key: string) => {\n+\t\t\tif (collection.startsWith('membership:\"\":events:')) eventReads++;\n+\t\t\treturn read(collection, key);\n+\t\t});\n+\t\tconst walk = (s: typeof space) => {\n+\t\t\teventReads = 0;\n+\t\t\tconst out: string[][] = [];\n+\t\t\tfor (let from = 0; from < last; from++)\n+\t\t\t\tfor (let to = from + 1; to <= last; to++)\n+\t\t\t\t\tout.push([...new SharedAdditions(s, from, membership.at(s, from), membership.at(s, to), to)]);\n+\t\t\treturn { out, eventReads };\n+\t\t};\n+\t\tconst paged = walk(space);\n+\t\tconst events = walk(eventsOnly);\n+\t\tassert.deepEqual(paged.out, events.out);\n+\t\tassert.ok(\n+\t\t\tpaged.eventReads < events.eventReads / 10,\n+\t\t\t`${paged.eventReads} event reads against ${events.eventReads}`,\n+\t\t);\n+\t\tassert.deepEqual([...new SharedAdditions(space, 1, membership.at(space, 1), membership.at(space, 3), 3)], [\"a600\"]);\n+\t\tassert.deepEqual(\n+\t\t\t[...new SharedAdditions(space, 2, membership.at(space, 2), membership.at(space, 3), 3)],\n+\t\t\t[\"a5\", \"a600\"],\n+\t\t);\n+\t\tassert.deepEqual([...new SharedAdditions(space, 3, membership.at(space, 3), membership.at(space, 5), 5)], []);\n+\t} finally {\n+\t\tstorage.db.close();\n+\t}\n+});"}],"unmatched":[]}