{"draft":null,"from":116,"to":318,"files":[{"path":"src/engine/test/state-source.test.ts","added":423,"removed":1,"diff":"--- a/src/engine/test/state-source.test.ts\n+++ b/src/engine/test/state-source.test.ts\n@@ -1,10 +1,227 @@\n import assert from \"node:assert/strict\";\n import { test } from \"node:test\";\n import { checkDraft, Graph, View } from \"../index.ts\";\n-import { CachedStateStorage, storedNumbers } from \"../state-source.ts\";\n+import { CachedStateStorage, StableOverlaySet, storedLists, storedNumbers } from \"../state-source.ts\";\n import { lines, Repo } from \"./helpers.ts\";\n import { SqlState } from \"./storage-helper.ts\";\n \n+test(\"counter writes avoid rereads while respecting failed writes, rollback and cache bounds\", () => {\n+\tconst source = new SqlState();\n+\ttry {\n+\t\tconst cache = new CachedStateStorage(source, 512, 2);\n+\t\tconst before = source.reads;\n+\t\tfor (let n = 0; n < 100; n++) {\n+\t\t\tcache.write(\"counter\", \"next\", n);\n+\t\t\tassert.equal(cache.read(\"counter\", \"next\"), n);\n+\t\t\tassert.ok(cache.retainedBytes <= 512);\n+\t\t\tassert.ok(cache.retainedEntries <= 2);\n+\t\t}\n+\t\tassert.equal(source.reads, before);\n+\t\tsource.failWrite = source.writes + 1;\n+\t\tassert.throws(() => cache.write(\"counter\", \"next\", 100), /injected/);\n+\t\tassert.equal(cache.read(\"counter\", \"next\"), 99);\n+\t\tsource.failWrite = Infinity;\n+\t\tassert.throws(\n+\t\t\t() =>\n+\t\t\t\tcache.transaction(() => {\n+\t\t\t\t\tcache.write(\"counter\", \"next\", 101);\n+\t\t\t\t\tassert.equal(cache.read(\"counter\", \"next\"), 101);\n+\t\t\t\t\tthrow Error(\"counter rollback\");\n+\t\t\t\t}),\n+\t\t\t/counter rollback/,\n+\t\t);\n+\t\tassert.equal(cache.retainedEntries, 0);\n+\t\tassert.equal(cache.read(\"counter\", \"next\"), 99);\n+\t\tfor (let n = 0; n < 20; n++) cache.write(\"counter\", String(n), n);\n+\t\tassert.ok(cache.retainedBytes <= 512);\n+\t\tassert.ok(cache.retainedEntries <= 2);\n+\t\tassert.equal(cache.read(\"counter\", \"0\"), 0);\n+\t\tconst disabled = new CachedStateStorage(source, 0, 0);\n+\t\tdisabled.write(\"counter\", \"next\", 102);\n+\t\tassert.equal(disabled.retainedEntries, 0);\n+\t\tassert.equal(disabled.read(\"counter\", \"next\"), 102);\n+\t\tcache.write(\"counter\", \"negative-zero\", -0);\n+\t\tassert.equal(Object.is(cache.read(\"counter\", \"negative-zero\"), source.read(\"counter\", \"negative-zero\")), true);\n+\t} finally {\n+\t\tsource.db.close();\n+\t}\n+});\n+\n+// The line-by-line layout, which a graph adopted before packed file history still uses (packFiles: false).\n+test(\"current visibility stops at the first included deletion while history retains every deleter\", () => {\n+\tclass ObservedStorage extends SqlState {\n+\t\tpageReads = 0;\n+\t\toverride read(collection: string, key: string): unknown {\n+\t\t\tif (collection === \"more-deleters:pages\") this.pageReads++;\n+\t\t\treturn super.read(collection, key);\n+\t\t}\n+\t}\n+\tconst storage = new ObservedStorage();\n+\ttry {\n+\t\tconst oracle = Repo.init({ \"a.txt\": \"gone\\nlive\\n\" });\n+\t\tconst deletion = oracle.draft({ edits: [{ file: \"a.txt\", old: \"gone\\n\", new: \"\" }] });\n+\t\tconst graph = new Graph({ storage, packFiles: false });\n+\t\tgraph.add(oracle.graph.atom(\"a0\"));\n+\t\tconst ids = [\"a0\"];\n+\t\tfor (let seq = 1; seq <= 514; seq++) {\n+\t\t\tconst atom = { ...deletion, id: `a${seq}`, seq };\n+\t\t\tgraph.add(atom);\n+\t\t\toracle.graph.add(atom);\n+\t\t\tids.push(atom.id);\n+\t\t}\n+\t\tconst reopened = new Graph({ storage, packFiles: false });\n+\t\tconst membership = new StableOverlaySet(ids);\n+\t\tconst view = new View(reopened, membership);\n+\t\tstorage.pageReads = 0;\n+\t\tassert.equal(view.text(\"a.txt\"), \"live\\n\");\n+\t\tassert.equal(storage.pageReads, 0, \"current visibility needs no later deleters after the first match\");\n+\t\tassert.deepEqual(view.sequence(\"a.txt\"), new View(oracle.graph, membership).sequence(\"a.txt\"));\n+\t\tassert.equal(view.sequence(\"a.txt\")[0]!.deletedBy.length, 514);\n+\t\tassert.equal(storage.pageReads, 3);\n+\t\tassert.deepEqual(reopened.deletersOf(\"a0.0\"), oracle.graph.deletersOf(\"a0.0\"));\n+\t\tconst lastOnly = new View(reopened, new StableOverlaySet([\"a0\", \"a514\"]));\n+\t\tassert.equal(lastOnly.text(\"a.txt\"), \"live\\n\", \"excluded early deletions must not hide a later included one\");\n+\t} finally {\n+\t\tstorage.db.close();\n+\t}\n+});\n+\n+test(\"relocation indexes stream one fixed page before yielding and preserve order\", () => {\n+\tclass ObservedStorage extends SqlState {\n+\t\tpageReads = 0;\n+\t\tlargestPage = 0;\n+\t\toverride read(collection: string, key: string): unknown {\n+\t\t\tif (collection.startsWith(\"relocat\") && collection.endsWith(\":pages\")) this.pageReads++;\n+\t\t\treturn super.read(collection, key);\n+\t\t}\n+\t\toverride write(collection: string, key: string, value: unknown): void {\n+\t\t\tif (collection.startsWith(\"relocat\") && collection.endsWith(\":pages\")) {\n+\t\t\t\tassert.ok(Array.isArray(value));\n+\t\t\t\tthis.largestPage = Math.max(this.largestPage, value.length);\n+\t\t\t}\n+\t\t\tsuper.write(collection, key, value);\n+\t\t}\n+\t}\n+\tconst storage = new ObservedStorage();\n+\ttry {\n+\t\tconst oracle = Repo.init({ \"a.txt\": \"one\\n\", \"b.txt\": \"\" });\n+\t\tconst move = oracle.draft({ move: { file: \"a.txt\", start: 0, end: 1, to: \"b.txt\", at: 0 } });\n+\t\tconst graph = new Graph({ storage });\n+\t\tgraph.add(oracle.graph.atom(\"a0\"));\n+\t\tfor (let seq = 1; seq <= 513; seq++) {\n+\t\t\tconst atom = { ...move, id: `a${seq}`, seq };\n+\t\t\tgraph.add(atom);\n+\t\t\toracle.graph.add(atom);\n+\t\t}\n+\t\tconst reopened = new Graph({ storage });\n+\t\tstorage.pageReads = 0;\n+\t\tconst iterator = reopened.eachRelocationOf(\"a0.0\");\n+\t\tassert.deepEqual(iterator.next().value, oracle.graph.relocationsOf(\"a0.0\")[0]);\n+\t\tassert.equal(storage.pageReads, 1, \"first result must decode only one page\");\n+\t\tassert.deepEqual(reopened.relocationsOf(\"a0.0\"), oracle.graph.relocationsOf(\"a0.0\"));\n+\t\tconst parent = move.moves![0]!.parent;\n+\t\tconst code = reopened.codeOf(parent)!;\n+\t\tassert.deepEqual(reopened.relocatedTo(parent), oracle.graph.relocatedTo(parent));\n+\t\tassert.deepEqual([...reopened.eachRelocatedToCode(code)], oracle.graph.relocatedToCode(code));\n+\t\tassert.equal(storage.largestPage, 256);\n+\t} finally {\n+\t\tstorage.db.close();\n+\t}\n+});\n+\n+test(\"hot claim indexes stream bounded pages after reopening\", (t) => {\n+\tconst oracle = Repo.init({ \"a.txt\": lines(\"one\", \"two\") });\n+\tconst draft = oracle.draft({ edits: [{ file: \"a.txt\", old: \"one\", new: \"ONE\" }] });\n+\tconst source = new SqlState();\n+\ttry {\n+\t\tconst graph = new Graph({ storage: source });\n+\t\tgraph.add(oracle.graph.atom(\"a0\"));\n+\t\tfor (let i = 0; i < 513; i++) {\n+\t\t\tconst atom = { ...draft, id: `a${i + 1}`, seq: i + 1 };\n+\t\t\tgraph.add(atom);\n+\t\t\toracle.graph.add(atom);\n+\t\t}\n+\t\tconst reopened = new Graph({ storage: source });\n+\t\tconst read = source.read.bind(source);\n+\t\tlet pagesRead = 0;\n+\t\tt.mock.method(source, \"read\", (collection: string, key: string) => {\n+\t\t\tif (collection === \"writers:pages\") pagesRead++;\n+\t\t\treturn read(collection, key);\n+\t\t});\n+\t\tconst iterator = reopened.eachWriterOf(\"L:a0.0\");\n+\t\tassert.equal(iterator.next().value, \"a1\");\n+\t\tassert.equal(pagesRead, 1, \"first claimant reads one claim page, not the entire hot-key history\");\n+\t\tassert.deepEqual(reopened.writersOf(\"L:a0.0\"), oracle.graph.writersOf(\"L:a0.0\"));\n+\t\tassert.deepEqual([...reopened.eachDependentOf(\"a0\")], oracle.graph.dependentsOf(\"a0\"));\n+\t\tfor (const name of [\"writers\", \"readers\", \"holders\", \"dependents\", \"resolvers\"]) {\n+\t\t\tassert.equal([...source.entries(name)].length, 0, \"no whole-list claim rows remain\");\n+\t\t\tfor (const [, page] of source.entries(`${name}:pages`)) assert.ok((page as string[]).length <= 256);\n+\t\t}\n+\t\tconst key = JSON.stringify([\"number\", 0]);\n+\t\tsource.write(\"legacy-claims\", key, [\"old\"]);\n+\t\tassert.throws(\n+\t\t\t() => [...storedLists(source, \"legacy-claims\", (value) => value).values(key)],\n+\t\t\t/canonical-log adoption/,\n+\t\t);\n+\t} finally {\n+\t\tsource.db.close();\n+\t}\n+});\n+\n+test(\"stable views stream movers instead of allocating a filtered history array\", (t) => {\n+\tconst oracle = Repo.init({ \"a.txt\": lines(\"one\", \"two\"), \"b.txt\": \"\" });\n+\toracle.edit({ move: { file: \"a.txt\", start: 0, end: 1, to: \"b.txt\", at: 0 } });\n+\tconst expected = oracle.files();\n+\tconst movers = oracle.graph.movers();\n+\tt.mock.method(\n+\t\toracle.graph,\n+\t\t\"movers\",\n+\t\t() =>\n+\t\t\tnew Proxy(movers, {\n+\t\t\t\tget(target, key, receiver) {\n+\t\t\t\t\tif (key === \"filter\") throw new Error(\"whole mover history copied\");\n+\t\t\t\t\treturn Reflect.get(target, key, receiver);\n+\t\t\t\t},\n+\t\t\t}),\n+\t);\n+\tconst view = new View(oracle.graph, new StableOverlaySet(oracle.shared));\n+\tassert.equal(view.hasMoves(), true);\n+\tassert.deepEqual(view.files(), expected);\n+});\n+\n+test(\"per-file list pages append and reopen without reading the full historical list\", () => {\n+\tconst source = new SqlState();\n+\ttry {\n+\t\tconst storage = new CachedStateStorage(source);\n+\t\tconst lists = storedLists<string>(storage, \"files\");\n+\t\tfor (let i = 0; i < 1025; i++) storage.transaction(() => lists.append(\"a.txt\", `a${i}`));\n+\t\tassert.equal(lists.length(\"a.txt\"), 1025);\n+\t\tassert.deepEqual([...lists.keys()], [\"a.txt\"]);\n+\t\tstorage.clear();\n+\t\tconst before = source.reads;\n+\t\tstorage.transaction(() => lists.append(\"a.txt\", \"a1025\"));\n+\t\tassert.ok(source.reads - before <= 2, \"append reads only one page and its length\");\n+\t\tassert.throws(\n+\t\t\t() =>\n+\t\t\t\tstorage.transaction(() => {\n+\t\t\t\t\tlists.append(\"a.txt\", \"rolled-back\");\n+\t\t\t\t\tthrow new Error(\"rollback\");\n+\t\t\t\t}),\n+\t\t\t/rollback/,\n+\t\t);\n+\t\tconst reopened = storedLists<string>(new CachedStateStorage(source), \"files\");\n+\t\tassert.deepEqual(\n+\t\t\t[...reopened.values(\"a.txt\")],\n+\t\t\tArray.from({ length: 1026 }, (_, i) => `a${i}`),\n+\t\t);\n+\t\tfor (const [, page] of source.entries(\"files:pages\")) assert.ok((page as string[]).length <= 256);\n+\t\tsource.write(\"legacy\", \"a.txt\", [\"a0\"]);\n+\t\tassert.throws(() => [...storedLists(source, \"legacy\").keys()], /canonical-log adoption/);\n+\t} finally {\n+\t\tsource.db.close();\n+\t}\n+});\n+\n test(\"numeric pages cross boundaries, reopen, mutate and roll back without retaining history\", () => {\n \tconst source = new SqlState();\n \tconst storage = new CachedStateStorage(source);\n@@ -141,3 +358,208 @@\n \tassert.equal(new Graph({ storage }).label(\"child\")?.base, \"a0\");\n \tstorage.db.close();\n });\n+\n+test(\"together links stream bounded pages in both directions after storage reopen\", () => {\n+\tclass ObservedStorage extends SqlState {\n+\t\tpageReads = 0;\n+\t\tlargestPage = 0;\n+\t\toverride read(collection: string, key: string): unknown {\n+\t\t\tif (collection === \"together:pages\") this.pageReads++;\n+\t\t\treturn super.read(collection, key);\n+\t\t}\n+\t\toverride write(collection: string, key: string, value: unknown): void {\n+\t\t\tif (collection === \"together:pages\") {\n+\t\t\t\tassert.ok(Array.isArray(value));\n+\t\t\t\tthis.largestPage = Math.max(this.largestPage, value.length);\n+\t\t\t}\n+\t\t\tsuper.write(collection, key, value);\n+\t\t}\n+\t}\n+\tconst storage = new ObservedStorage();\n+\ttry {\n+\t\tconst oracle = Repo.init({ \"a.txt\": \"one\\n\" });\n+\t\tconst draft = oracle.draft({ edits: [{ file: \"a.txt\", old: \"one\", new: \"ONE\" }] });\n+\t\tconst graph = new Graph({ storage });\n+\t\tgraph.add(oracle.graph.atom(\"a0\"));\n+\t\tfor (let seq = 1; seq <= 513; seq++) {\n+\t\t\tconst atom = {\n+\t\t\t\t...draft,\n+\t\t\t\tid: `a${seq}`,\n+\t\t\t\tseq,\n+\t\t\t\treasons: [{ to: \"a0\", kind: \"together\" as const, text: `reason ${seq}` }],\n+\t\t\t};\n+\t\t\tgraph.add(atom);\n+\t\t\toracle.graph.add(atom);\n+\t\t}\n+\t\tconst reopened = new Graph({ storage });\n+\t\tstorage.pageReads = 0;\n+\t\tconst iterator = reopened.eachTogetherLink(\"a0\");\n+\t\tassert.deepEqual(iterator.next().value, oracle.graph.togetherLinks(\"a0\")[0]);\n+\t\tassert.equal(storage.pageReads, 1);\n+\t\tstorage.pageReads = 0;\n+\t\tassert.deepEqual(reopened.togetherLinks(\"a0\"), oracle.graph.togetherLinks(\"a0\"));\n+\t\tassert.equal(storage.pageReads, 3);\n+\t\tassert.deepEqual(reopened.togetherLinks(\"a513\"), oracle.graph.togetherLinks(\"a513\"));\n+\t\tassert.equal(storage.largestPage, 256);\n+\t} finally {\n+\t\tstorage.db.close();\n+\t}\n+});\n+\n+test(\"child indexes stream bounded pages before filtering historical siblings\", () => {\n+\tclass ObservedStorage extends SqlState {\n+\t\tpageReads = 0;\n+\t\tlargestPage = 0;\n+\t\toverride read(collection: string, key: string): unknown {\n+\t\t\tif (collection === \"run-starts:pages\") this.pageReads++;\n+\t\t\treturn super.read(collection, key);\n+\t\t}\n+\t\toverride write(collection: string, key: string, value: unknown): void {\n+\t\t\tif (collection === \"run-starts:pages\") {\n+\t\t\t\tassert.ok(Array.isArray(value));\n+\t\t\t\tthis.largestPage = Math.max(this.largestPage, value.length);\n+\t\t\t}\n+\t\t\tsuper.write(collection, key, value);\n+\t\t}\n+\t}\n+\tconst storage = new ObservedStorage();\n+\ttry {\n+\t\tconst oracle = Repo.init({ \"a.txt\": \"one\\ntwo\\n\" });\n+\t\tconst draft = oracle.draft({ edits: [{ file: \"a.txt\", old: \"one\", new: \"ONE\" }] });\n+\t\tconst graph = new Graph({ storage });\n+\t\tgraph.add(oracle.graph.atom(\"a0\"));\n+\t\tfor (let seq = 1; seq <= 513; seq++) {\n+\t\t\tconst atom = { ...draft, id: `a${seq}`, seq };\n+\t\t\tgraph.add(atom);\n+\t\t\toracle.graph.add(atom);\n+\t\t}\n+\t\tconst reopened = new Graph({ storage });\n+\t\tconst parent = draft.inserts[0]!.parent;\n+\t\tconst code = reopened.codeOf(parent)!;\n+\t\tstorage.pageReads = 0;\n+\t\tconst iterator = reopened.eachChildN(code);\n+\t\tconst first = iterator.next().value!;\n+\t\tassert.equal(first, reopened.lineN(oracle.graph.childrenOf(parent)[0]!));\n+\t\tassert.ok(storage.pageReads <= 1);\n+\t\tif (storage.pageReads === 0) {\n+\t\t\titerator.next();\n+\t\t\tassert.equal(storage.pageReads, 1, \"the implicit child needs no page; the next sibling needs one\");\n+\t\t}\n+\t\tassert.deepEqual(reopened.childrenOf(parent), oracle.graph.childrenOf(parent));\n+\t\tassert.deepEqual(\n+\t\t\treopened.childrenOf(\"a0.0\"),\n+\t\t\toracle.graph.childrenOf(\"a0.0\"),\n+\t\t\t\"implicit same-run child order is retained\",\n+\t\t);\n+\t\tassert.equal(storage.largestPage, 256);\n+\t\tconst membership = new StableOverlaySet([\"a0\"]);\n+\t\tassert.equal(new View(reopened, membership).text(\"a.txt\"), \"one\\ntwo\\n\");\n+\t\tassert.deepEqual(\n+\t\t\tnew View(reopened, membership).sequence(\"a.txt\"),\n+\t\t\tnew View(oracle.graph, membership).sequence(\"a.txt\"),\n+\t\t);\n+\t} finally {\n+\t\tstorage.db.close();\n+\t}\n+});\n+\n+test(\"persistent layout uses ordered successors without retaining deep or wide history frontiers\", () => {\n+\tfor (const shape of [\"deep\", \"wide\"] as const) {\n+\t\tconst storage = new SqlState();\n+\t\ttry {\n+\t\t\tconst oracle = Repo.init({\n+\t\t\t\t\"a.txt\": shape === \"deep\" ? Array.from({ length: 1024 }, (_, n) => `line ${n}\\n`).join(\"\") : \"base\\n\",\n+\t\t\t});\n+\t\t\tif (shape === \"wide\") {\n+\t\t\t\tconst draft = oracle.draft({ edits: [{ file: \"a.txt\", old: \"base\", new: \"branch\" }] });\n+\t\t\t\tfor (let seq = 1; seq <= 256; seq++) {\n+\t\t\t\t\tconst atom = { ...draft, id: `a${seq}`, seq };\n+\t\t\t\t\toracle.graph.add(atom);\n+\t\t\t\t\toracle.shared.add(atom.id);\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tconst before = oracle.view().text(\"a.txt\");\n+\t\t\toracle.edit({ edits: [{ file: \"a.txt\", old: before, new: \"live\\n\" }] });\n+\t\t\tconst graph = new Graph({ storage, packFiles: false });\n+\t\t\tfor (const id of oracle.shared) graph.add(oracle.graph.atom(id));\n+\t\t\tconst reopened = new Graph({ storage, packFiles: false });\n+\t\t\treopened.eachChildN = () => {\n+\t\t\t\tthrow Error(\"unordered child collection forbidden\");\n+\t\t\t};\n+\t\t\treopened.childrenN = () => {\n+\t\t\t\tthrow Error(\"materialized child collection forbidden\");\n+\t\t\t};\n+\t\t\tconst original = reopened.orderedChildrenN.bind(reopened);\n+\t\t\tlet active = 0,\n+\t\t\t\tmaximum = 0;\n+\t\t\treopened.orderedChildrenN = function* (parent: number, after?: number) {\n+\t\t\t\tactive++;\n+\t\t\t\tmaximum = Math.max(maximum, active);\n+\t\t\t\ttry {\n+\t\t\t\t\tyield* original(parent, after);\n+\t\t\t\t} finally {\n+\t\t\t\t\tactive--;\n+\t\t\t\t}\n+\t\t\t};\n+\t\t\tconst view = new View(reopened, new StableOverlaySet(oracle.shared));\n+\t\t\tassert.equal(view.text(\"a.txt\"), \"live\\n\");\n+\t\t\tassert.equal(active, 0);\n+\t\t\tassert.equal(maximum, 1, \"no ordered iterator retained per historical ancestor\");\n+\t\t\tassert.deepEqual(view.sequence(\"a.txt\"), oracle.view().sequence(\"a.txt\"));\n+\t\t} finally {\n+\t\t\tstorage.db.close();\n+\t\t}\n+\t}\n+});\n+\n+test(\"implicit ordered successors avoid priority reads but retain index validation\", () => {\n+\tclass ObservedStorage extends SqlState {\n+\t\tpriorityReads = 0;\n+\t\toverride read(collection: string, key: string): unknown {\n+\t\t\tif (collection === \"lamport\" || collection.startsWith(\"replacing:\")) this.priorityReads++;\n+\t\t\treturn super.read(collection, key);\n+\t\t}\n+\t}\n+\tconst storage = new ObservedStorage();\n+\ttry {\n+\t\tconst oracle = Repo.init({ \"a.txt\": \"one\\ntwo\\nthree\\n\" });\n+\t\tconst graph = new Graph({ storage });\n+\t\tgraph.add(oracle.graph.atom(\"a0\"));\n+\t\tstorage.priorityReads = 0;\n+\t\tassert.deepEqual([...graph.orderedChildrenN(0)], [1]);\n+\t\tassert.deepEqual([...graph.orderedChildrenN(0, 1)], []);\n+\t\tassert.deepEqual([...graph.orderedChildrenN(2)], []);\n+\t\tassert.equal(storage.priorityReads, 0, \"single-child traversal does not decode sort priority\");\n+\t\tstorage.remove(\"ordered-children\", \"format\");\n+\t\tassert.throws(() => [...graph.orderedChildrenN(0)], /fresh adoption/);\n+\t} finally {\n+\t\tstorage.db.close();\n+\t}\n+});\n+\n+test(\"ordered layout refuses missing format or child metadata instead of dropping history\", () => {\n+\tconst storage = new SqlState();\n+\ttry {\n+\t\tconst oracle = Repo.init({ \"a.txt\": \"one\\n\" });\n+\t\tconst graph = new Graph({ storage, packFiles: false });\n+\t\tgraph.add(oracle.graph.atom(\"a0\"));\n+\t\tstorage.remove(\"ordered-children\", \"format\");\n+\t\tassert.throws(\n+\t\t\t() => new View(new Graph({ storage, packFiles: false }), new StableOverlaySet([\"a0\"])).text(\"a.txt\"),\n+\t\t\t/fresh adoption/,\n+\t\t);\n+\t\tassert.throws(\n+\t\t\t() =>\n+\t\t\t\tnew Graph({ storage, packFiles: false }).add(\n+\t\t\t\t\toracle.draft({ edits: [{ file: \"a.txt\", old: \"one\", new: \"two\" }] }),\n+\t\t\t\t),\n+\t\t\t/fresh adoption/,\n+\t\t);\n+\t\tstorage.write(\"ordered-children\", \"format\", 2);\n+\t\tconst parent = graph.startCodeOf(\"a.txt\")!;\n+\t\tstorage.remove(\"ordered-children\", JSON.stringify([String(parent), \"meta\"]));\n+\t\tassert.throws(() => [...graph.orderedChildrenN(parent)], /missing ordered index metadata/);\n+\t} finally {\n+\t\tstorage.db.close();\n+\t}\n+});"}],"unmatched":[]}