{"draft":null,"from":2,"to":318,"files":[{"path":"src/engine/test/moves.test.ts","added":22,"removed":4,"diff":"--- a/src/engine/test/moves.test.ts\n+++ b/src/engine/test/moves.test.ts\n@@ -5,11 +5,13 @@\n \n import assert from \"node:assert/strict\";\n import { describe, it } from \"node:test\";\n-import { type Atom, type AtomId, conflicts } from \"../index.ts\";\n+import { type Atom, type AtomId, conflicts, Graph, View } from \"../index.ts\";\n+import { StableOverlaySet } from \"../state-source.ts\";\n import { lines, Repo, Rng } from \"./helpers.ts\";\n+import { SqlState } from \"./storage-helper.ts\";\n \n-const BASE_SEED = Number(process.env[\"PROP_SEED\"] ?? 20261004);\n-const CASES = Number(process.env[\"PROP_CASES\"] ?? 200);\n+const BASE_SEED = Number(process.env.PROP_SEED ?? 20261004);\n+const CASES = Number(process.env.PROP_CASES ?? 200);\n \n const FN = [\"function area(r) {\", \"  const pi = 3.14;\", \"  return pi * r * r;\", \"}\"];\n const START = {\n@@ -133,7 +135,7 @@\n \t\tconst repo = Repo.init(START);\n \t\tconcurrently(\n \t\t\trepo,\n-\t\t\t(base) => repo.draft({ edits: [{ file: \"shapes.js\", old: FN.join(\"\\n\") + \"\\n\", new: \"\" }] }, base),\n+\t\t\t(base) => repo.draft({ edits: [{ file: \"shapes.js\", old: `${FN.join(\"\\n\")}\\n`, new: \"\" }] }, base),\n \t\t\t(base) => moveArea(repo, base),\n \t\t);\n \t\tassert.deepEqual(conflicts(repo.graph, repo.shared), []);\n@@ -243,6 +245,22 @@\n \t\taccept(repo, mk(\"a0.2\", \"a0.0\"));\n \t\tconst text = repo.text(\"f.txt\");\n \t\tassert.deepEqual(text.split(\"\\n\").filter(Boolean).sort(), [\"m\", \"n\", \"x\", \"y\"]);\n+\t\tclass BoundedReads extends SqlState {\n+\t\t\toverride read(collection: string, key: string): unknown {\n+\t\t\t\tif (this.reads > 10_000) throw new Error(\"relocation cycle did not terminate\");\n+\t\t\t\treturn super.read(collection, key);\n+\t\t\t}\n+\t\t}\n+\t\tconst storage = new BoundedReads();\n+\t\ttry {\n+\t\t\tconst stored = new Graph({ storage });\n+\t\t\tfor (let seq = 0; seq < repo.graph.size; seq++) stored.add(repo.graph.atom(repo.graph.idOfSeq(seq)));\n+\t\t\tconst reopened = new Graph({ storage });\n+\t\t\tassert.equal(new View(reopened, repo.shared).text(\"f.txt\"), text);\n+\t\t\tassert.equal(new View(reopened, new StableOverlaySet(repo.shared)).text(\"f.txt\"), text);\n+\t\t} finally {\n+\t\t\tstorage.db.close();\n+\t\t}\n \t});\n \n \tit(\"rejects a move onto itself or out of range\", () => {"}],"unmatched":[]}