{"draft":null,"from":116,"to":318,"files":[{"path":"src/engine/test/view.test.ts","added":33,"removed":1,"diff":"--- a/src/engine/test/view.test.ts\n+++ b/src/engine/test/view.test.ts\n@@ -8,6 +8,37 @@\n import { lines, Repo } from \"./helpers.ts\";\n \n describe(\"View\", () => {\n+\tit(\"bounds file-location memo growth across long ancestry walks with moves\", () => {\n+\t\tconst retained = (count: number) => {\n+\t\t\tconst repo = Repo.init({ \"long.txt\": \"line\\n\".repeat(count), \"a.txt\": \"move\\n\", \"b.txt\": \"base\\n\" });\n+\t\t\trepo.edit({ move: { file: \"a.txt\", start: 0, end: 1, to: \"b.txt\", at: 1 } });\n+\t\t\tconst view = new View(repo.graph, new StableOverlaySet<AtomId>([\"a0\", \"a1\"]));\n+\t\t\tconst oracle = repo.view();\n+\t\t\t// Resolve the deepest ancestry first, then force repeated cache eviction.\n+\t\t\tconst sequence = oracle.sequence(\"long.txt\");\n+\t\t\tassert.equal(sequence.length, count);\n+\t\t\tassert.equal(view.fileOf(sequence[count - 1]!.id), \"long.txt\");\n+\t\t\tfor (const line of sequence) assert.equal(view.fileOf(line.id), \"long.txt\");\n+\t\t\tfor (const line of oracle.lines(\"b.txt\")) assert.equal(view.fileOf(line.id), \"b.txt\");\n+\t\t\tassert.equal(view.fileOf(sequence[count - 1]!.id), \"long.txt\");\n+\t\t\treturn view.weight();\n+\t\t};\n+\t\tassert.equal(retained(2048), retained(512), \"file-location retained state must not grow with ancestry depth\");\n+\t});\n+\tit(\"current indexed paths do not retain deleted historical file layouts\", () => {\n+\t\tconst retained = (count: number) => {\n+\t\t\tconst files: Record<string, string> = { \"live.txt\": \"live\\n\" };\n+\t\t\tfor (let i = 0; i < count; i++) files[`old-${i}.txt`] = \"gone\\n\";\n+\t\t\tconst repo = Repo.init(files);\n+\t\t\trepo.edit({ edits: Array.from({ length: count }, (_, i) => ({ file: `old-${i}.txt`, old: \"gone\\n\", new: \"\" })) });\n+\t\t\tconst view = new View(repo.graph, new StableOverlaySet<AtomId>([\"a0\", \"a1\"]));\n+\t\t\tassert.deepEqual(view.files(), { \"live.txt\": \"live\\n\" });\n+\t\t\tconst weight = view.weight();\n+\t\t\tassert.equal(view.knownPaths().length, count + 1, \"explicit historical enumeration is preserved\");\n+\t\t\treturn weight;\n+\t\t};\n+\t\tassert.equal(retained(200), retained(20), \"deleted path count must not grow current-view retained state\");\n+\t});\n \tit(\"reuses indexed membership across a long run of lines without a history-sized memo\", () => {\n \t\tconst repo = Repo.init({ \"long.txt\": \"line\\n\".repeat(1000) });\n \t\tclass CountingSet extends StableOverlaySet<AtomId> {\n@@ -103,8 +134,9 @@\n \t\tassert.equal(repo.text(\"f.txt\"), lines(\"top\", \"r\", \"q\", \"p\", \"bottom\"));\n \t\tassert.deepEqual(\n \t\t\tr.deps,\n-\t\t\t[\"a0\", p.id, q.id].sort((a, b) => Number(a.slice(1)) - Number(b.slice(1))),\n+\t\t\t[p.id, q.id].sort((a, b) => Number(a.slice(1)) - Number(b.slice(1))),\n \t\t);\n+\t\tassert.deepEqual(repo.graph.closureOf(r.deps), repo.graph.closureOf([\"a0\", p.id, q.id]));\n \t});\n \n \tit(\"puts a line's replacements ahead of the lines inserted after it, whatever their priority\", () => {"}],"unmatched":[]}