{"draft":null,"from":142,"to":143,"files":[{"path":"src/engine/build.ts","added":14,"removed":9,"diff":"--- a/src/engine/build.ts\n+++ b/src/engine/build.ts\n@@ -23,6 +23,11 @@\n } from \"./types.ts\";\n import { View } from \"./view.ts\";\n \n+/** Exact read surface used to build atoms; membership requires point lookup only. */\n+export type AtomBuildView = Pick<View, \"graph\" | \"lines\" | \"sequence\" | \"sequenceIndex\" | \"parentOf\"> & {\n+\treadonly set: Pick<ReadonlySet<AtomId>, \"has\">;\n+};\n+\n /** Replace the one exact occurrence of `old` in `file` with `new`. */\n export interface TextEdit {\n \treadonly file: string;\n@@ -108,7 +113,7 @@\n  * the graph's next id; accept it with `graph.add(atom)` and put it in a set.\n  * Its dependencies are derived from what it touched in the view (see deriveDeps).\n  */\n-export function buildAtom(view: View, input: AtomInput): Atom {\n+export function buildAtom(view: AtomBuildView, input: AtomInput): Atom {\n \treturn build(view, input, false);\n }\n \n@@ -126,7 +131,7 @@\n \treturn build(view, { ...meta, edits, attrs }, true);\n }\n \n-function build(view: View, input: AtomInput, allowEmpty: boolean): Atom {\n+function build(view: AtomBuildView, input: AtomInput, allowEmpty: boolean): Atom {\n \tconst graph = view.graph;\n \tconst id = graph.nextId();\n \tif (typeof input.author !== \"string\" || typeof input.message !== \"string\") {\n@@ -275,7 +280,7 @@\n  * lines into each other collide in all but the rarest cases (the view breaks\n  * any loop that is left).\n  */\n-function planMove(view: View, move: MoveInput, writes: Set<Key>, reads: Set<Key>): Relocation[] {\n+function planMove(view: AtomBuildView, move: MoveInput, writes: Set<Key>, reads: Set<Key>): Relocation[] {\n \tfor (const path of [move.file, move.to]) {\n \t\tif (typeof path !== \"string\" || path === \"\" || /[\\n\\r]/.test(path))\n \t\t\tthrow new EngineError(\"bad-edit\", `bad file path ${JSON.stringify(path)}`);\n@@ -341,7 +346,7 @@\n  * the semantic contract. A missing tip still implies its required ancestors.\n  */\n function deriveDeps(\n-\tview: View,\n+\tview: AtomBuildView,\n \tparts: {\n \t\twrites: readonly Key[];\n \t\treads: readonly Key[];\n@@ -390,7 +395,7 @@\n \t});\n }\n \n-function rangeLines(view: View, range: LineRange): LineId[] {\n+function rangeLines(view: AtomBuildView, range: LineRange): LineId[] {\n \tconst visible = view.lines(range.file);\n \tif (\n \t\t!Number.isInteger(range.start) ||\n@@ -407,7 +412,7 @@\n \treturn visible.slice(range.start, range.end).map((l) => l.id);\n }\n \n-function uniqueAtoms(view: View, ids: readonly AtomId[], what: string): AtomId[] {\n+function uniqueAtoms(view: AtomBuildView, ids: readonly AtomId[], what: string): AtomId[] {\n \tconst out: AtomId[] = [];\n \tfor (const id of ids) {\n \t\tif (!view.graph.has(id)) throw new EngineError(\"unknown-atom\", `${what} names unknown atom ${id}`);\n@@ -419,7 +424,7 @@\n \n // Matching edits ---------------------------------------------------------------\n \n-function resolveRegions(view: View, edits: readonly EditInput[]): Region[] {\n+function resolveRegions(view: AtomBuildView, edits: readonly EditInput[]): Region[] {\n \tconst regions = edits.map((edit, order) => {\n \t\tconst mode = edit.mode ?? \"both\";\n \t\tif (!MODES.includes(mode)) throw new EngineError(\"bad-edit\", `mode must be one of ${MODES.join(\", \")}`);\n@@ -455,7 +460,7 @@\n  * whole lines. If the replacement would leave a line without its newline, the\n  * next line joins the region (that is what the plain-text edit does).\n  */\n-function matchText(view: View, edit: TextEdit, mode: Mode, order: number): Region {\n+function matchText(view: AtomBuildView, edit: TextEdit, mode: Mode, order: number): Region {\n \tif (typeof edit.old !== \"string\" || typeof edit.new !== \"string\") {\n \t\tthrow new EngineError(\"bad-edit\", \"a text edit needs old and new strings\");\n \t}\n@@ -514,7 +519,7 @@\n \treturn { file, start: startLine, end: endLine + 1, lines: splitLines(replacement), mode, order };\n }\n \n-function matchSplice(view: View, edit: SpliceEdit, mode: Mode, order: number): Region {\n+function matchSplice(view: AtomBuildView, edit: SpliceEdit, mode: Mode, order: number): Region {\n \tconst count = view.lines(edit.file).length;\n \tif (\n \t\t!Number.isInteger(edit.start) ||"}],"unmatched":[]}