{"draft":null,"from":311,"to":318,"files":[{"path":"src/engine/graph.ts","added":53,"removed":52,"diff":"--- a/src/engine/graph.ts\n+++ b/src/engine/graph.ts\n@@ -1524,43 +1524,39 @@\n \t * the search never descends below the target's lamport.\n \t */\n \t#reaches(from: Iterable<AtomId>, target: AtomId): boolean {\n-\t\tconst floor = this.#lamportAt(this.#seq(target));\n-\t\tif (this.#storage) {\n-\t\t\treturn this.withProjectionScratch((scratch) => {\n-\t\t\t\tlet length = 0;\n-\t\t\t\tconst push = (id: AtomId): void => {\n-\t\t\t\t\tif (scratch.read(\"seen\", id)) return;\n-\t\t\t\t\tscratch.write(\"seen\", id, true);\n-\t\t\t\t\tscratch.write(\"stack\", String(length++), id);\n-\t\t\t\t};\n-\t\t\t\tfor (const id of from) {\n-\t\t\t\t\tif (id === target) return true;\n-\t\t\t\t\tif (this.#lamportAt(this.#seq(id)) > floor) push(id);\n-\t\t\t\t}\n-\t\t\t\twhile (length > 0) {\n-\t\t\t\t\tconst key = String(--length);\n-\t\t\t\t\tconst current = scratch.read(\"stack\", key) as AtomId;\n-\t\t\t\t\tscratch.remove(\"stack\", key);\n-\t\t\t\t\tif (this.#lamportAt(this.#seq(current)) <= floor) continue;\n-\t\t\t\t\tfor (const dependency of this.atom(current).deps) {\n-\t\t\t\t\t\tif (dependency === target) return true;\n-\t\t\t\t\t\tpush(dependency);\n-\t\t\t\t\t}\n-\t\t\t\t}\n-\t\t\t\treturn false;\n-\t\t\t});\n+\t\treturn this.#reachable(from, new Set([target])).has(target);\n+\t}\n+\n+\t/**\n+\t * Which of `targets` are reachable along deps from any of `from` (themselves included), in one walk: it never\n+\t * descends below the lowest target's lamport, and stops once every target is found (abso 714, piece 4: record\n+\t * walked once per line writer).\n+\t * The walk's seen marks and stack are in memory, by atom number: one byte and four bytes an atom at most, so about\n+\t * 62 KB on abso's 12,454 atoms and 50 MB at 10 million, under a Worker's 128 MB. They were scratch rows in storage\n+\t * (abso-core 139, bounding memory with the graph), which cost a read and a write per atom visited: on abso's Oct 14\n+\t * tables, 41,000 of a 1470-shaped record's 77,767 statements.\n+\t */\n+\t#reachable(from: Iterable<AtomId>, targets: ReadonlySet<AtomId>): Set<AtomId> {\n+\t\tconst found = new Set<AtomId>();\n+\t\tlet floor = Number.POSITIVE_INFINITY;\n+\t\tfor (const target of targets) floor = Math.min(floor, this.#lamportAt(this.#seq(target)));\n+\t\tconst seen = new Uint8Array(this.#atoms.length);\n+\t\tconst stack = new Int32Array(this.#atoms.length);\n+\t\tlet length = 0;\n+\t\tconst visit = (id: AtomId): void => {\n+\t\t\tif (targets.has(id)) found.add(id);\n+\t\t\tconst seq = this.#seq(id);\n+\t\t\tif (seen[seq]) return;\n+\t\t\tseen[seq] = 1;\n+\t\t\tstack[length++] = seq;\n+\t\t};\n+\t\tfor (const id of from) visit(id);\n+\t\twhile (length > 0 && found.size < targets.size) {\n+\t\t\tconst seq = stack[--length]!;\n+\t\t\tif (this.#lamportAt(seq) <= floor) continue;\n+\t\t\tfor (const dependency of this.atom(atomId(seq)).deps) visit(dependency);\n \t\t}\n-\t\tconst seen = new Set<AtomId>();\n-\t\tconst stack = [...from];\n-\t\twhile (stack.length > 0) {\n-\t\t\tconst cur = stack.pop()!;\n-\t\t\tif (cur === target) return true;\n-\t\t\tif (seen.has(cur)) continue;\n-\t\t\tseen.add(cur);\n-\t\t\tif (this.#lamportAt(this.#seq(cur)) <= floor) continue;\n-\t\t\tfor (const d of this.atom(cur).deps) if (!seen.has(d)) stack.push(d);\n-\t\t}\n-\t\treturn false;\n+\t\treturn found;\n \t}\n \n \t/**\n@@ -1610,23 +1606,28 @@\n \t\tfor (const r of atom.reasons) if (!this.has(r.to)) bad(`reason points at unknown atom ${r.to}`);\n \n \t\t// Everything it touches must come from its closure. Derived deps name the\n-\t\t// writers directly, so this is usually one lookup per writer.\n-\t\tconst memoryBelow = scratch ? undefined : new Map<AtomId, boolean>();\n-\t\tconst below = {\n-\t\t\tget: (key: AtomId) => (scratch ? (scratch.read(\"below\", key) as boolean | undefined) : memoryBelow!.get(key)),\n-\t\t\tset: (key: AtomId, value: boolean) => {\n-\t\t\t\tif (scratch) scratch.write(\"below\", key, value);\n-\t\t\t\telse memoryBelow!.set(key, value);\n-\t\t\t},\n-\t\t};\n-\t\tconst inClosure = (writer: AtomId): boolean => {\n-\t\t\tlet hit = below.get(writer);\n-\t\t\tif (hit === undefined) {\n-\t\t\t\thit = deps.has(writer) || this.#reaches(atom.deps, writer);\n-\t\t\t\tbelow.set(writer, hit);\n+\t\t// writers directly, so this is usually one lookup per writer. The writers\n+\t\t// that aren't deps are walked for together, once (abso 714, piece 4).\n+\t\tconst touched: LineId[] = [];\n+\t\tfor (const run of atom.inserts) if (!isStartNode(run.parent)) touched.push(run.parent);\n+\t\tfor (const m of atom.moves ?? []) {\n+\t\t\ttouched.push(m.line);\n+\t\t\tif (!isStartNode(m.parent)) touched.push(m.parent);\n+\t\t}\n+\t\ttouched.push(...atom.deletes);\n+\t\tfor (const list of [atom.writes, atom.reads, atom.holds])\n+\t\t\tfor (const key of list) {\n+\t\t\t\tconst parsed = parseKey(key);\n+\t\t\t\tif (parsed.kind === \"line\" || ((parsed.kind === \"gap\" || parsed.kind === \"pos\") && !isStartNode(parsed.node)))\n+\t\t\t\t\ttouched.push(parsed.node);\n \t\t\t}\n-\t\t\treturn hit;\n-\t\t};\n+\t\tconst beyond = new Set<AtomId>();\n+\t\tfor (const line of touched) {\n+\t\t\tconst writer = this.lineAtom(line);\n+\t\t\tif (writer !== undefined && !deps.has(writer)) beyond.add(writer);\n+\t\t}\n+\t\tconst reached = beyond.size > 0 ? this.#reachable(atom.deps, beyond) : beyond;\n+\t\tconst inClosure = (writer: AtomId): boolean => deps.has(writer) || reached.has(writer);\n \t\tconst checkLine = (line: LineId, what: string): void => {\n \t\t\tconst writer = this.lineAtom(line);\n \t\t\tif (writer === undefined) return bad(`${what} names unknown line ${line}`);"},{"path":"src/engine/view.ts","added":19,"removed":10,"diff":"--- a/src/engine/view.ts\n+++ b/src/engine/view.ts\n@@ -10,7 +10,7 @@\n // made when a caller asks for them, and the latest asked for is kept.\n \n import type { Graph, RelocationInfo } from \"./graph.ts\";\n-import { isStartNode, lineId, seqOf } from \"./keys.ts\";\n+import { atomId, isStartNode, lineId, seqOf } from \"./keys.ts\";\n import { resolveScratchMoves, scratchLayoutNodes } from \"./relocation-scratch.ts\";\n import { isClosedSet, StableSet } from \"./state-source.ts\";\n import { joinLines } from \"./text.ts\";\n@@ -1095,7 +1095,14 @@\n \t}\n \n \t*lineChunks(path: string): IterableIterator<() => Iterable<string>> {\n-\t\tfor (const n of this.#file(path).vis) yield () => this.graph.textChunks(n);\n+\t\t// The texts the packed layout already holds, read a page at a time (abso Capacity, 714): a record's diff read each\n+\t\t// line's own row, 11,873 statements for abso's index.ts. Only a line too long to pack is read in chunks.\n+\t\tconst { vis, visText } = this.#file(path);\n+\t\tfor (let i = 0; i < vis.length; i++) {\n+\t\t\tconst packed = visText?.[i];\n+\t\t\tif (packed != null) yield () => [packed];\n+\t\t\telse yield () => this.graph.textChunks(vis[i]!);\n+\t\t}\n \t}\n \n \t/** Visible lines without retaining their text in the view cache. */\n@@ -1105,7 +1112,7 @@\n \t\t\tyield {\n \t\t\t\tid: graph.lineIdOf(n),\n \t\t\t\ttext: graph.textOf(n),\n-\t\t\t\tatom: graph.idOfSeq(graph.writerSeqOf(n)),\n+\t\t\t\tatom: atomId(graph.writerSeqOf(n)),\n \t\t\t};\n \t}\n \n@@ -1119,12 +1126,12 @@\n \t\t\tconst n = vis[i]!;\n \t\t\tconst packed = visText?.[i];\n \t\t\tlines[i] = {\n-\t\t\t\tid: visWriter && visK ? lineId(graph.idOfSeq(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),\n+\t\t\t\tid: visWriter && visK ? lineId(atomId(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),\n \t\t\t\ttextChunks: () => graph.textChunks(n),\n \t\t\t\tget text() {\n \t\t\t\t\treturn packed ?? graph.textOf(n);\n \t\t\t\t},\n-\t\t\t\tatom: graph.idOfSeq(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),\n+\t\t\t\tatom: atomId(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),\n \t\t\t};\n \t\t}\n \t\treturn lines;\n@@ -1136,12 +1143,14 @@\n \t\tconst graph = this.graph;\n \t\tconst { vis, visText, visWriter, visK } = this.#file(path);\n \t\tconst lines: VisibleLine[] = new Array(vis.length);\n+\t\t// Writer seqs come from the graph's own layout, so they're named with atomId, not checked by idOfSeq (abso 738):\n+\t\t// on a stored graph its check read the atom count once a line, about 0.9 s of a warm draft-state on abso.\n \t\tfor (let i = 0; i < vis.length; i++) {\n \t\t\tconst n = vis[i]!;\n \t\t\tlines[i] = {\n-\t\t\t\tid: visWriter && visK ? lineId(graph.idOfSeq(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),\n+\t\t\t\tid: visWriter && visK ? lineId(atomId(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),\n \t\t\t\ttext: visText?.[i] ?? graph.textOf(n),\n-\t\t\t\tatom: graph.idOfSeq(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),\n+\t\t\t\tatom: atomId(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),\n \t\t\t};\n \t\t}\n \t\tthis.#linesCache = { path, lines };\n@@ -1163,13 +1172,13 @@\n \t\t\tconst writer = seqWriter ? seqWriter[i]! : graph.writerSeqOf(n);\n \t\t\tlet text: string | undefined;\n \t\t\tout[i] = {\n-\t\t\t\tid: seqWriter && seqK ? lineId(graph.idOfSeq(writer), seqK[i]!) : graph.lineIdOf(n),\n+\t\t\t\tid: seqWriter && seqK ? lineId(atomId(writer), seqK[i]!) : graph.lineIdOf(n),\n \t\t\t\tget text() {\n \t\t\t\t\ttext ??= graph.textOf(n);\n \t\t\t\t\treturn text;\n \t\t\t\t},\n-\t\t\t\tatom: graph.idOfSeq(writer),\n-\t\t\t\tdeletedBy: by ? by.map((s) => graph.idOfSeq(s)) : NONE,\n+\t\t\t\tatom: atomId(writer),\n+\t\t\t\tdeletedBy: by ? by.map((s) => atomId(s)) : NONE,\n \t\t\t\tvisible: by === undefined,\n \t\t\t};\n \t\t}"},{"path":"worker/project/collisions.ts","added":7,"removed":5,"diff":"--- a/worker/project/collisions.ts\n+++ b/worker/project/collisions.ts\n@@ -68,7 +68,7 @@\n \t\t}\n \t\tfor (const key of claimsOf(atom)) streams.push(g.eachWriterOf(key));\n \t\tconst theirs: AtomId[] = [];\n-\t\tfor (const id of orderedClaimants(g, streams)) if (against.has(id)) theirs.push(id);\n+\t\tfor (const id of orderedClaimants(streams)) if (against.has(id)) theirs.push(id);\n \t\tout.set(yours, theirs);\n \t}\n \treturn out;\n@@ -136,7 +136,7 @@\n \n /** Claim indexes append in canonical seq order. Merge one cursor per current\n  * atom key, retaining no candidate set proportional to historical claims. */\n-function* orderedClaimants(g: Graph, streams: IterableIterator<AtomId>[]): IterableIterator<AtomId> {\n+function* orderedClaimants(streams: IterableIterator<AtomId>[]): IterableIterator<AtomId> {\n \ttry {\n \t\ttype Head = { id: AtomId; seq: number; stream: number };\n \t\tconst heap: Head[] = [];\n@@ -152,9 +152,11 @@\n \t\t\t}\n \t\t\theap[at] = head;\n \t\t};\n+\t\t// Each claimant's seq from its id, as the graph reads it (abso 738): loading the stored atom for it read a row a\n+\t\t// claimant, most of a warm draft-state's pairing on abso.\n \t\tconst advance = (stream: number) => {\n \t\t\tconst next = streams[stream]!.next();\n-\t\t\tif (!next.done) push({ id: next.value, seq: g.atom(next.value).seq, stream });\n+\t\t\tif (!next.done) push({ id: next.value, seq: seqOf(next.value), stream });\n \t\t};\n \t\tfor (let stream = 0; stream < streams.length; stream++) advance(stream);\n \t\tlet previous = -1;\n@@ -190,8 +192,8 @@\n \t\tlet a = left.next();\n \t\tlet b = right.next();\n \t\twhile (!a.done && !b.done) {\n-\t\t\tconst x = g.atom(a.value).seq;\n-\t\t\tconst y = g.atom(b.value).seq;\n+\t\t\tconst x = seqOf(a.value);\n+\t\t\tconst y = seqOf(b.value);\n \t\t\tif (x === y && settled.has(a.value)) return true;\n \t\t\tif (x <= y) a = left.next();\n \t\t\tif (y <= x) b = right.next();"},{"path":"worker/project/definition-rule.ts","added":68,"removed":35,"diff":"--- a/worker/project/definition-rule.ts\n+++ b/worker/project/definition-rule.ts\n@@ -7,7 +7,7 @@\n import { type AtomId, type Graph, joinLines, type LineId, type ReadView } from \"../../src/engine/index.ts\";\n import { type Origin, touchedFiles } from \"./collisions.ts\";\n import { type Definition, definitionsIn, importsOf, usedNames } from \"./definitions.ts\";\n-import { definitionsBytes, type KeptParts, usesBytes } from \"./kept-parts.ts\";\n+import { definitionsBytes, filesBytes, type KeptParts, usesBytes } from \"./kept-parts.ts\";\n import { codeOfLines, declaredIn, holdsNoCode } from \"./names.ts\";\n import { definitionText } from \"./news.ts\";\n import type { Collision } from \"./project.ts\";\n@@ -37,7 +37,7 @@\n \treadonly parent: string;\n }\n \n-/** Definitions in the files newer work touched, before it and with it. */\n+/** Definitions in one file newer work touched, before it and with it. */\n interface Changed {\n \treadonly baseDefs: ReturnType<typeof definitionsIn>;\n \treadonly nowDefs: ReturnType<typeof definitionsIn>;\n@@ -52,8 +52,11 @@\n \treadonly #replacedCache = new Map<string, ReadonlySet<string>>();\n \t/** A draft's uses, kept while it is asked about with the same views: draft collisions ask once per other agent. */\n \treadonly #usesCache = new WeakMap<ReadonlySet<AtomId>, { view: ReadView; base: ReadView; uses: Uses }>();\n-\t/** The newer work's definitions before and after, kept while it is asked about with the same views. */\n-\treadonly #changedCache = new WeakMap<ReadonlySet<AtomId>, { base: ReadView; now: ReadView; defs: Changed }>();\n+\t/** The files the newer work touched, kept while it is asked about with the same views. */\n+\treadonly #touchedCache = new WeakMap<\n+\t\tReadonlySet<AtomId>,\n+\t\t{ base: ReadView; now: ReadView; files: ReadonlySet<string> }\n+\t>();\n \n \tconstructor(graph: Graph, origin: (atom: AtomId, spaceName: string) => Origin) {\n \t\tthis.#graph = graph;\n@@ -122,6 +125,11 @@\n \t\tspaceName: string,\n \t\tkept?: { parts: KeptParts; uses: string; changed: string },\n \t\tnames?: ReadonlySet<string>,\n+\t\t/**\n+\t\t * The files the newer work changed, when the caller knows them without placing its lines (land and draft-state:\n+\t\t * shared's kept version files, abso 738); undefined, or one that answers undefined, and they're worked out here.\n+\t\t */\n+\t\tchangedFiles?: () => ReadonlySet<string> | undefined,\n \t): DefinitionCollision[] {\n \t\tif (draft.size === 0 || newer.size === 0) return [];\n \t\tconst uses = kept\n@@ -131,31 +139,56 @@\n \t\t// Only these names can collide (a publish's news, news.ts): a draft that uses none of them has none, and the\n \t\t// definitions changed since its base needn't be worked out.\n \t\tif (names && ![...uses.keys()].some((name) => names.has(name))) return [];\n-\t\tconst nowOf = () => (typeof nowView === \"function\" ? nowView() : nowView);\n-\t\tconst { baseDefs, nowDefs } = kept\n-\t\t\t? kept.parts.get(\n-\t\t\t\t\t`changed ${kept.changed}`,\n-\t\t\t\t\t() => this.#changed(newer, baseView, nowOf()),\n-\t\t\t\t\t(c) => definitionsBytes(c.baseDefs) + definitionsBytes(c.nowDefs),\n-\t\t\t\t)\n-\t\t\t: this.#changedFor(newer, baseView, nowOf());\n-\t\tconst out: DefinitionCollision[] = [];\n-\t\tfor (const [name, where] of [...uses].sort(([a], [b]) => (a < b ? -1 : 1))) {\n-\t\t\t// Which definitions the uses mean: the file each use imports the name\n-\t\t\t// from, or its own file when it defines the name at the top level. A\n-\t\t\t// use with neither (a local, a parameter, a global, a name another\n-\t\t\t// language brings in some other way) means none: the rule only speaks\n-\t\t\t// when it knows which definition a use means.\n+\t\t// Which definitions the uses mean: the file each use imports the name\n+\t\t// from, or its own file when it defines the name at the top level. A\n+\t\t// use with neither (a local, a parameter, a global, a name another\n+\t\t// language brings in some other way) means none: the rule only speaks\n+\t\t// when it knows which definition a use means.\n+\t\tconst scopes = new Map<string, ReadonlySet<string>>();\n+\t\tfor (const [name, where] of uses) {\n \t\t\tconst scope = new Set<string>();\n \t\t\tfor (const w of new Set(where.map((x) => x.file))) {\n \t\t\t\tconst from = importsOf(view, w).get(name) ?? (definitionsIn(view, [w]).has(name) ? w : undefined);\n \t\t\t\tif (from !== undefined) scope.add(from);\n \t\t\t}\n-\t\t\tif (scope.size === 0) continue;\n-\t\t\tconst inScope = (d: Definition): boolean => scope.has(d.file);\n-\t\t\tconst before = baseDefs.get(name)?.filter(inScope);\n-\t\t\tif (!before?.length) continue; // not defined in what the drafter saw: nothing it relies on\n-\t\t\tconst after = (nowDefs.get(name) ?? []).filter(inScope);\n+\t\t\tif (scope.size > 0) scopes.set(name, scope);\n+\t\t}\n+\t\tif (scopes.size === 0) return [];\n+\t\tconst nowOf = () => (typeof nowView === \"function\" ? nowView() : nowView);\n+\t\t// Only a file the newer work touched can hold a changed definition, and only one a use means can matter: just those\n+\t\t// files are laid out, before and with the newer work (abso 738). Laying out every file the newer work touched cost\n+\t\t// codex-prose-authorship-610's draft-state 494 files a view where its uses reach 7.\n+\t\tconst touched =\n+\t\t\tchangedFiles?.() ??\n+\t\t\t(kept\n+\t\t\t\t? kept.parts.get(`touched ${kept.changed}`, () => this.#touched(newer, baseView, nowOf()), filesBytes)\n+\t\t\t\t: this.#touchedFor(newer, baseView, nowOf()));\n+\t\tconst changed = new Map<string, Changed>();\n+\t\tconst changedIn = (file: string): Changed => {\n+\t\t\tlet c = changed.get(file);\n+\t\t\tif (!c) {\n+\t\t\t\tconst make = (): Changed => ({\n+\t\t\t\t\tbaseDefs: definitionsIn(baseView, [file]),\n+\t\t\t\t\tnowDefs: definitionsIn(nowOf(), [file]),\n+\t\t\t\t});\n+\t\t\t\tc = kept\n+\t\t\t\t\t? kept.parts.get(\n+\t\t\t\t\t\t\t`changed ${kept.changed} ${file}`,\n+\t\t\t\t\t\t\tmake,\n+\t\t\t\t\t\t\t(d) => definitionsBytes(d.baseDefs) + definitionsBytes(d.nowDefs),\n+\t\t\t\t\t\t)\n+\t\t\t\t\t: make();\n+\t\t\t\tchanged.set(file, c);\n+\t\t\t}\n+\t\t\treturn c;\n+\t\t};\n+\t\tconst out: DefinitionCollision[] = [];\n+\t\tfor (const [name, scope] of [...scopes].sort(([a], [b]) => (a < b ? -1 : 1))) {\n+\t\t\t// In the order the newer work touched its files, as when every touched file was laid out.\n+\t\t\tconst files = [...touched].filter((f) => scope.has(f));\n+\t\t\tconst before = files.flatMap((f) => changedIn(f).baseDefs.get(name) ?? []);\n+\t\t\tif (!before.length) continue; // not defined in what the drafter saw: nothing it relies on\n+\t\t\tconst after = files.flatMap((f) => changedIn(f).nowDefs.get(name) ?? []);\n \t\t\tif (signature(before) === signature(after)) continue;\n \t\t\t// Who changed it: newer writers of the new definition's lines, or newer deleters of the old one's.\n \t\t\tconst by = new Set<AtomId>();\n@@ -166,6 +199,7 @@\n \t\t\tconst first = [...by].sort((p, q) => this.#graph.atom(p).seq - this.#graph.atom(q).seq)[0];\n \t\t\tif (first === undefined) continue;\n \t\t\tconst origin = this.#origin(first, spaceName);\n+\t\t\tconst where = uses.get(name)!;\n \t\t\tconst file = where[0]!.file;\n \t\t\tconst indexes = where.filter((w) => w.file === file).map((w) => w.index);\n \t\t\tconst lo = Math.min(...indexes);\n@@ -205,20 +239,19 @@\n \t\treturn kept.uses;\n \t}\n \n-\t/** The newer work's definitions before and after, kept while it is asked about with the same views. */\n-\t#changedFor(newer: ReadonlySet<AtomId>, baseView: ReadView, now: ReadView): Changed {\n-\t\tlet changed = this.#changedCache.get(newer);\n-\t\tif (!changed || changed.base !== baseView || changed.now !== now) {\n-\t\t\tchanged = { base: baseView, now, defs: this.#changed(newer, baseView, now) };\n-\t\t\tthis.#changedCache.set(newer, changed);\n+\t/** The files the newer work touched, kept while it is asked about with the same views. */\n+\t#touchedFor(newer: ReadonlySet<AtomId>, baseView: ReadView, now: ReadView): ReadonlySet<string> {\n+\t\tlet kept = this.#touchedCache.get(newer);\n+\t\tif (!kept || kept.base !== baseView || kept.now !== now) {\n+\t\t\tkept = { base: baseView, now, files: this.#touched(newer, baseView, now) };\n+\t\t\tthis.#touchedCache.set(newer, kept);\n \t\t}\n-\t\treturn changed.defs;\n+\t\treturn kept.files;\n \t}\n \n-\t/** Definitions in the files the newer work touched, before it and with it: only there can one have changed. */\n-\t#changed(newer: ReadonlySet<AtomId>, baseView: ReadView, now: ReadView): Changed {\n-\t\tconst touched = touchedFiles(this.#graph, newer, [baseView, now]);\n-\t\treturn { baseDefs: definitionsIn(baseView, touched), nowDefs: definitionsIn(now, touched) };\n+\t/** The files the newer work touched, before it and with it: only there can a definition have changed. */\n+\t#touched(newer: ReadonlySet<AtomId>, baseView: ReadView, now: ReadView): ReadonlySet<string> {\n+\t\treturn touchedFiles(this.#graph, newer, [baseView, now]);\n \t}\n \n \t/** The names the draft's lines use and don't declare, less those the lines they replaced already used. */"},{"path":"worker/project/kept-parts.ts","added":11,"removed":4,"diff":"--- a/worker/project/kept-parts.ts\n+++ b/worker/project/kept-parts.ts\n@@ -1,8 +1,8 @@\n // What draft collisions work out about each draft and each pair of drafts, kept between calls under a hard byte budget\n-// (abso Capacity, issue 664): the names a draft's new lines use, the definitions a draft's changes touch before and\n-// after, and the names a pair of drafts both define in a file. Keys name everything an entry depends on (shared's\n-// version, a draft's base and atoms), and a call drops every entry it didn't use, so a draft that changes, an agent that\n-// leaves and shared moving on all drop theirs at once.\n+// (abso Capacity, issue 664): the names a draft's new lines use, the files a draft's changes touch and the definitions\n+// in each before and after, and the names a pair of drafts both define in a file. Keys name everything an entry depends\n+// on (shared's version, a draft's base and atoms), and a call drops every entry it didn't use, so a draft that changes,\n+// an agent that leaves and shared moving on all drop theirs at once.\n \n import { stringBytes } from \"../../src/engine/view.ts\";\n import type { Definition } from \"./definitions.ts\";\n@@ -100,3 +100,10 @@\n \t\tn += MAP_ENTRY_BYTES + stringBytes(name) + ARRAY_HEADER_BYTES + where.length * (REFERENCE_BYTES + OBJECT_BYTES);\n \treturn n;\n }\n+\n+/** A set of paths (the files some work touched). */\n+export function filesBytes(files: ReadonlySet<string>): number {\n+\tlet n = MAP_HEADER_BYTES;\n+\tfor (const file of files) n += MAP_ENTRY_BYTES + stringBytes(file);\n+\treturn n;\n+}"},{"path":"worker/project/land.ts","added":16,"removed":1,"diff":"--- a/worker/project/land.ts\n+++ b/worker/project/land.ts\n@@ -29,6 +29,8 @@\n \tpairs(draft: readonly AtomId[], against: ReadonlySet<AtomId>, settled: ReadonlySet<AtomId>): Pair[];\n \tdescribe(pair: Pair, yoursView: ReadView, theirsView: ReadView, spaceName: string): Collision;\n \tdefinitionRule(): DefinitionRule;\n+\t/** The files a space's versions after `from`, up to `to`, changed, when each one's are kept; else undefined. */\n+\tchangedSince(space: Space, from: number, to: number): ReadonlySet<string> | undefined;\n \trefuse(\n \t\tagent: AgentState,\n \t\tspace: Space,\n@@ -93,11 +95,24 @@\n \t\t? host.viewAt(shared, sharedBaseOf(space), changes)\n \t\t: host.viewAt(space, space.versions.length - 1);\n \tconst describeLand = (p: Pair): Collision => host.describe(p, draftView, host.sharedView(), SHARED);\n+\t// Where shared changed since the draft's base, from the files each version since kept as it landed (abso 738): working\n+\t// it out from the newer atoms placed every line they wrote or deleted, about 30% of a warm draft-state read.\n+\tconst changed = () => host.changedSince(shared, sharedBaseOf(space), host.version());\n \tconst collisions = [\n \t\t...host.pairs(changes, newer, union).map(describeLand),\n \t\t...host\n \t\t\t.definitionRule()\n-\t\t\t.collisions(own, draftView, host.viewAt(shared, sharedBaseOf(space)), host.sharedView(), newer, SHARED)\n+\t\t\t.collisions(\n+\t\t\t\town,\n+\t\t\t\tdraftView,\n+\t\t\t\thost.viewAt(shared, sharedBaseOf(space)),\n+\t\t\t\thost.sharedView(),\n+\t\t\t\tnewer,\n+\t\t\t\tSHARED,\n+\t\t\t\tundefined,\n+\t\t\t\tundefined,\n+\t\t\t\tchanged,\n+\t\t\t)\n \t\t\t.map((d) => d.collision),\n \t];\n \treturn { collisions, newer, union };"},{"path":"worker/project/pathindex.ts","added":15,"removed":0,"diff":"--- a/worker/project/pathindex.ts\n+++ b/worker/project/pathindex.ts\n@@ -90,6 +90,21 @@\n \t\treturn files && [...files].sort();\n \t}\n \n+\t/**\n+\t * The files the versions after `from`, up to `to`, changed, from each version's kept row (abso 738): undefined when one\n+\t * has none, and the caller works them out from the atoms. Every file whose text differs between the two versions is\n+\t * in it, since some version between changed it.\n+\t */\n+\tkeptChangesSince(space: Space, from: number, to: number): ReadonlySet<string> | undefined {\n+\t\tconst out = new Set<string>();\n+\t\tfor (let v = from + 1; v <= to; v++) {\n+\t\t\tconst files = this.#keptFiles(space, v);\n+\t\t\tif (!files) return undefined;\n+\t\t\tfor (const f of files) out.add(f);\n+\t\t}\n+\t\treturn out;\n+\t}\n+\n \t/** keptPaths as a set, kept for the newest version asked: never changed once made, so a view can hold it. */\n \tkeptPathSet(space: Space, version: number): ReadonlySet<string> | undefined {\n \t\tlet fold = this.#keptPaths.get(space);"},{"path":"worker/project/project-api.ts","added":2,"removed":0,"diff":"--- a/worker/project/project-api.ts\n+++ b/worker/project/project-api.ts\n@@ -155,6 +155,8 @@\n \trefusals(agent?: string, limit?: number): unknown;\n \t/** A file as it was at a version (#27). */\n \tfileAt(path: string, version: number, draft: string | null, agent?: string): unknown;\n+\t/** fileAt for exactly this spelling, without the version's list of files (version-log.ts fileExactAt). */\n+\tfileExactAt?(path: string, version: number, draft: string | null): unknown;\n \t/** Every file that differs between two versions (#27). */\n \tcompare(from: number, to: number, draft: string | null, agent?: string, summary?: boolean): unknown;\n \t/** Version `version` of shared without the versions in `versions` (without.ts). */"},{"path":"worker/project/project.ts","added":14,"removed":1,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -222,6 +222,7 @@\n \tcompare as versionCompare,\n \tcompareSummary as versionCompareSummary,\n \tfileAt as versionFileAt,\n+\tfileExactAt as versionFileExactAt,\n \tlog as versionLog,\n \tribbon as versionRibbon,\n \tshow as versionShow,\n@@ -2008,6 +2009,11 @@\n \t\treturn versionFileAt(this.#logHost, ...args);\n \t}\n \n+\t/** fileAt for exactly this spelling, from the file's own lines: no list of the version's files (version-log.ts). */\n+\tfileExactAt(...args: Tail<Parameters<typeof versionFileExactAt>>): ReturnType<typeof versionFileExactAt> {\n+\t\treturn versionFileExactAt(this.#logHost, ...args);\n+\t}\n+\n \t/** Every file that differs between two versions of shared (or a named draft) (version-log.ts). */\n \tcompare(...args: Tail<Parameters<typeof versionCompare>>): ReturnType<typeof versionCompare> {\n \t\treturn versionCompare(this.#logHost, ...args);\n@@ -2493,6 +2499,9 @@\n \t\t\tpairs: (draft, against, settled) => this.#pairs(draft, against, settled),\n \t\t\tdescribe: (pair, yoursView, theirsView, spaceName) => this.#describe(pair, yoursView, theirsView, spaceName),\n \t\t\tdefinitionRule: () => this.#definitionRule,\n+\t\t\t// Only from a stored writer's kept rows, as keptPaths: a project in memory keeps none, and works them out.\n+\t\t\tchangedSince: (space, from, to) =>\n+\t\t\t\tthis.#writerStorage ? this.#paths.keptChangesSince(space, from, to) : undefined,\n \t\t\trefuse: (agent, space, via, time, collisions, entries) =>\n \t\t\t\tthis.#refuse(agent, space, via, time, collisions, entries),\n \t\t\trequireClosed: (tie, union) => this.#requireClosed(tie, union),\n@@ -3209,15 +3218,19 @@\n \t\tconst base = agent.mine.some((id) => at.has(id))\n \t\t\t? this.#view(differenceSet(at, new StableOverlaySet(agent.mine)))\n \t\t\t: this.#viewAt(space, agent.base);\n+\t\tconst to = version ?? last(space);\n \t\treturn this.#definitionRule.collisions(\n \t\t\tdraft,\n \t\t\tthis.#agentView(agent),\n \t\t\tbase,\n-\t\t\tthis.#viewAt(space, version ?? last(space)),\n+\t\t\tthis.#viewAt(space, to),\n \t\t\tnewer,\n \t\t\tspace.name,\n \t\t\tundefined,\n \t\t\tnames,\n+\t\t\t// Where the space changed since the agent's base, from each version's kept files on a stored writer, as land's\n+\t\t\t// (abso 714): walking every newer atom for them was 6.5 s of a publish 770 versions behind on abso.\n+\t\t\t() => (this.#writerStorage ? this.#paths.keptChangesSince(space, agent.base, to) : undefined),\n \t\t);\n \t}\n }"},{"path":"worker/project/spelling.ts","added":4,"removed":2,"diff":"--- a/worker/project/spelling.ts\n+++ b/worker/project/spelling.ts\n@@ -73,7 +73,9 @@\n export function spellingOf(view: ReadView, path: string): string {\n \tif (view.hasFile(path)) return path;\n \tconst key = pathKey(path);\n-\t// Known paths first, by key, then only those laid out (#46).\n-\tconst twins = view.knownPaths().filter((p) => pathKey(p) === key && view.hasFile(p));\n+\t// Every path the graph has ever had, by key, then only those the view has a file at (#46). Not the view's known paths\n+\t// (abso Capacity, 714): those read every atom's membership and file list, 36,360 statements of a record on abso, as\n+\t// clashIn found. A path the view never had has no file in it, so the answers are the same.\n+\tconst twins = [...view.graph.knownFiles()].filter((p) => pathKey(p) === key && view.hasFile(p));\n \treturn twins.length === 1 ? twins[0]! : path;\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/version-log.ts","added":29,"removed":0,"diff":"--- a/worker/project/version-log.ts\n+++ b/worker/project/version-log.ts\n@@ -244,6 +244,35 @@\n \t};\n }\n \n+/**\n+ * fileAt for exactly this spelling, from the file's own lines (abso Capacity, 2026-10-17): no spelling lookup and no\n+ * list of the version's files. fileAt's hasFile answers from the version's whole path list, folded from version 0\n+ * when nothing's kept, and a spelling it doesn't find reads every known path. A name nothing ever wrote is one read.\n+ * The pipeline's project files (abso.yml and the like) are read this way on every tick.\n+ */\n+export function fileExactAt(\n+\thost: LogHost,\n+\tpath: string,\n+\tversion: number,\n+\toptions: { draft?: string | null; agent?: string } = {},\n+): { path: string; version: number; text: string | null; blob?: string } {\n+\thost.needInit();\n+\tcheckReadPath(path);\n+\tconst space = host.spaceFor(options);\n+\thost.checkVersion(space, version);\n+\tif (!host.graph.hasAtomsIn(path)) return { path, version, text: null };\n+\tconst view = host.viewAt(space, version);\n+\tconst attrs = view.attrs(path);\n+\t// hasFile's own test, without its path list: kept while empty, a link, a binary, or a visible line.\n+\tconst exists = attrs.exists || attrs.link !== null || attrs.blob !== null || view.lines(path).length > 0;\n+\treturn {\n+\t\tpath,\n+\t\tversion,\n+\t\ttext: exists ? view.text(path) : null,\n+\t\t...(attrs.blob !== null ? { blob: attrs.blob } : {}),\n+\t};\n+}\n+\n /** The files that may differ between two versions, and both views: compare's and compareSummary's ground. */\n function compared(\n \thost: LogHost,"}],"unmatched":[]}