{"version":237,"agent":"capacity","message":"touchedBeyond, with named tests for 235's wrong draft diff (disk-first 2; abso Capacity).\n\n236 fixed the wrong diff Disk-first Testing found on typescript-rs with 235 (cloud-ts-01's diff showed lib.rs and passes.rs from its older base). This moves that fix into a named function with its own tests, as Agent VCS asked.\n\n- collisions.ts touchedBeyond(graph, below, mine, views): the files a view over below plus mine can lay out differently from below, or undefined when any of it moves lines. It counts mine and whatever mine depends on that below lacks, since a view's set is closed. Project.#agentView's shareFiles uses it.\n- touched-beyond.test.ts: a publish's tie writes no files, but it depends on the published change. Counted from version 0 its files include the changed file, which 235's count (the atoms alone) missed. A move beyond the base turns sharing off.\n- agent-views-shared.test.ts adds a merge-queue landing with a move, then more drafting in the moved-to file.\n\nChecks: typescript-rs adopted fresh, diff for cloud-ts-01 matches replay (it differs on 235). Every worker/project test (341 of 341) and every engine test; tsc and biome clean.","time":1792065333770,"timeIso":"2026-10-15T11:55:33.770Z","changes":4,"change":3698,"files":["worker/project/collisions.ts","worker/project/project.ts","worker/project/test/agent-views-shared.test.ts","worker/project/test/touched-beyond.test.ts"],"draft":null,"diff":[{"path":"worker/project/collisions.ts","added":24,"removed":0,"diff":"--- a/worker/project/collisions.ts\n+++ b/worker/project/collisions.ts\n@@ -293,6 +293,30 @@\n \treturn out;\n }\n \n+/**\n+ * The files a view over `below` plus `mine` can lay out differently from `below` (abso Capacity, View.shareFiles), or\n+ * undefined when any of it moves lines. A view's set is closed under dependencies, so it holds `mine` and whatever\n+ * `mine` depends on that `below` lacks; each of those can change a file, so all of them count. Counting `mine` alone\n+ * missed the files of work the draft depends on (Testing's typescript-rs diff for cloud-ts-01, core 235).\n+ */\n+export function touchedBeyond(\n+\tg: Graph,\n+\tbelow: ReadonlySet<AtomId>,\n+\tmine: Iterable<AtomId>,\n+\tviews: readonly ReadView[],\n+): Set<string> | undefined {\n+\tconst beyond = new Set<AtomId>();\n+\tconst stack = [...mine];\n+\twhile (stack.length) {\n+\t\tconst id = stack.pop()!;\n+\t\tif (beyond.has(id) || below.has(id)) continue;\n+\t\tbeyond.add(id);\n+\t\tfor (const dep of g.atom(id).deps) if (!beyond.has(dep) && !below.has(dep)) stack.push(dep);\n+\t}\n+\tfor (const id of beyond) if ((g.atom(id).moves?.length ?? 0) > 0) return undefined;\n+\treturn touchedFiles(g, beyond, views);\n+}\n+\n /** The atom's visible lines in a file of a view, or where it acted when none are left. */\n export function describeSide(view: ReadView, atom: AtomId, file: string, keys: readonly string[]): CollisionSide {\n \tconst visible = view.lines(file);"},{"path":"worker/project/project.ts","added":2,"removed":14,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -58,6 +58,7 @@\n \ttype Pair,\n \tpairsIn,\n \tstrandedFiles,\n+\ttouchedBeyond,\n \ttouchedFiles,\n } from \"./collisions.ts\";\n import { type DefinitionCollision, DefinitionRule } from \"./definition-rule.ts\";\n@@ -2748,20 +2749,7 @@\n \t\t\t\t// view holds beyond its base is the draft and whatever the draft depends on that the base lacks (the view's\n \t\t\t\t// set is closed): each of those can change a file, so all of them count.\n \t\t\t\tconst mine = agent.mine;\n-\t\t\t\tview.shareFiles(base, () => {\n-\t\t\t\t\tconst graph = this.#graph;\n-\t\t\t\t\tconst below = base.set;\n-\t\t\t\t\tconst beyond = new Set<AtomId>();\n-\t\t\t\t\tconst stack = [...mine];\n-\t\t\t\t\twhile (stack.length) {\n-\t\t\t\t\t\tconst id = stack.pop()!;\n-\t\t\t\t\t\tif (beyond.has(id) || below.has(id)) continue;\n-\t\t\t\t\t\tbeyond.add(id);\n-\t\t\t\t\t\tfor (const dep of graph.atom(id).deps) if (!beyond.has(dep) && !below.has(dep)) stack.push(dep);\n-\t\t\t\t\t}\n-\t\t\t\t\tfor (const id of beyond) if ((graph.atom(id).moves?.length ?? 0) > 0) return undefined;\n-\t\t\t\t\treturn this.#touchedFiles(beyond, [base, view]);\n-\t\t\t\t});\n+\t\t\t\tview.shareFiles(base, () => touchedBeyond(this.#graph, base.set, mine, [base, view]));\n \t\t\t}\n \t\t}\n \t\treturn view;"},{"path":"worker/project/test/agent-views-shared.test.ts","added":43,"removed":0,"diff":"--- a/worker/project/test/agent-views-shared.test.ts\n+++ b/worker/project/test/agent-views-shared.test.ts\n@@ -68,3 +68,46 @@\n \tassert.doesNotMatch(String(read(oracle, \"cy\")[\"src/geometry.ts\"]), /const pi/);\n \tassert.deepEqual(project.tree(\"\", { agent: \"cy\", authors: true }), oracle.tree(\"\", { agent: \"cy\", authors: true }));\n });\n+\n+// A push landed through the merge queue whose delete and write of the same text became a move, by an agent whose base\n+// stays older than the landing, then more drafting in the moved-to file: the diff and every file read as in memory.\n+// (Here the move is among the agent's own atoms, so nothing is shared; touched-beyond.test.ts covers work held only\n+// by dependency.)\n+function landedWithMoves(project: Project) {\n+\tlet t = 0;\n+\tproject.checkerReady = true;\n+\tproject.init(\n+\t\t{\n+\t\t\t\"avcs.json\": `${JSON.stringify({ queue: true })}\\n`,\n+\t\t\t\"src/shapes.ts\": `// shapes\\n${AREA}`,\n+\t\t\t\"src/geometry.ts\": \"// geometry\\n\",\n+\t\t\t\"notes.md\": \"notes\\n\",\n+\t\t},\n+\t\tt,\n+\t);\n+\tproject.sync(\"ann\");\n+\tproject.sync(\"bob\");\n+\tconst land = (agent: string, message: string) => {\n+\t\tconst queued = project.publish(agent, message, ++t);\n+\t\tassert.ok(queued.ok && \"queued\" in queued, JSON.stringify(queued));\n+\t\tproject.queueChecking(queued.queued);\n+\t\tproject.queueLand(queued.queued, ++t);\n+\t};\n+\tproject.record(\"bob\", { \"notes.md\": \"notes\\nbob\\n\" }, ++t);\n+\tland(\"bob\", \"Notes\");\n+\tproject.edit(\"ann\", { file: \"src/shapes.ts\", old: AREA, new: \"\" }, ++t);\n+\tproject.edit(\"ann\", { file: \"src/geometry.ts\", content: `// geometry\\n${AREA}` }, ++t);\n+\tproject.record(\"ann\", { \"README.md\": \"readme\\n\" }, ++t);\n+\tland(\"ann\", \"Move area, add a readme\");\n+\tproject.edit(\"ann\", { file: \"src/geometry.ts\", old: \"3.14\", new: \"Math.PI\" }, ++t);\n+\tproject.edit(\"ann\", { file: \"README.md\", content: \"readme\\nmore\\n\" }, ++t);\n+}\n+\n+test(\"a draft's diff takes nothing from its base that its landed work holds by dependency\", () => {\n+\tconst oracle = new Project(new MemoryStore());\n+\tconst project = writer();\n+\tlandedWithMoves(oracle);\n+\tlandedWithMoves(project);\n+\tassert.deepEqual(project.diffOf(\"ann\"), oracle.diffOf(\"ann\"));\n+\tassert.deepEqual(read(project, \"ann\"), read(oracle, \"ann\"));\n+});"},{"path":"worker/project/test/touched-beyond.test.ts","added":37,"removed":0,"diff":"--- /dev/null\n+++ b/worker/project/test/touched-beyond.test.ts\n@@ -0,0 +1,37 @@\n+// The files a draft's view can't take from its base (abso Capacity, touchedBeyond): everything the view holds beyond\n+// the base counts, not only the draft's own atoms. A view's set is closed under dependencies, so an atom the agent\n+// holds can bring in work the base lacks, as a publish's tie does. Core 235 counted the agent's atoms alone and showed\n+// such files at the older base (Testing's typescript-rs diff for cloud-ts-01).\n+\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { touchedBeyond, touchedFiles } from \"../collisions.ts\";\n+import { MemoryStore, Project } from \"../project.ts\";\n+\n+test(\"files changed by work the agent's atoms depend on count, not only the atoms' own\", () => {\n+\tconst project = new Project(new MemoryStore());\n+\tproject.init({ \"a.txt\": \"a\\n\", \"b.txt\": \"b\\n\" }, 0);\n+\tproject.record(\"ann\", { \"b.txt\": \"b\\nmore\\n\" }, 1);\n+\tassert.equal(project.publish(\"ann\", \"More b\", 2).ok, true);\n+\tconst graph = project.graph;\n+\tconst tie = graph.idOfSeq(graph.size - 1);\n+\tassert.deepEqual([...graph.filesOf(tie)], [], \"a tie writes no files itself\");\n+\tconst base = project.viewAt(0);\n+\tconst view = project.viewAt(1);\n+\t// Counted alone, the tie touches nothing, and b.txt would be taken from version 0.\n+\tassert.deepEqual([...touchedFiles(graph, [tie], [base, view])], []);\n+\tassert.deepEqual([...(touchedBeyond(graph, base.set, [tie], [base, view]) ?? [])], [\"b.txt\"]);\n+\t// Counted from version 1, which holds the change, nothing is beyond it.\n+\tassert.deepEqual([...(touchedBeyond(graph, view.set, [tie], [view]) ?? [])], []);\n+});\n+\n+test(\"nothing is shared when anything beyond the base moves lines\", () => {\n+\tconst project = new Project(new MemoryStore());\n+\tproject.init({ \"a.txt\": \"one\\ntwo\\nthree\\n\", \"b.txt\": \"b\\n\" }, 0);\n+\tproject.move(\"ann\", \"a.txt\", \"c.txt\", 1);\n+\tassert.equal(project.publish(\"ann\", \"Move a to c\", 2).ok, true);\n+\tconst graph = project.graph;\n+\tconst tie = graph.idOfSeq(graph.size - 1);\n+\tconst base = project.viewAt(0);\n+\tassert.equal(touchedBeyond(graph, base.set, [tie], [base, project.viewAt(1)]), undefined);\n+});"}],"ci":null}