{"draft":null,"from":119,"to":120,"files":[{"path":"src/engine/test/state-source.test.ts","added":38,"removed":0,"diff":"--- a/src/engine/test/state-source.test.ts\n+++ b/src/engine/test/state-source.test.ts\n@@ -5,6 +5,44 @@\n import { lines, Repo } from \"./helpers.ts\";\n import { SqlState } from \"./storage-helper.ts\";\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\tfor (const name of [\"writers\", \"readers\", \"holders\"]) {\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(\"per-file list pages append and reopen without reading the full historical list\", () => {\n \tconst source = new SqlState();\n \ttry {"}],"unmatched":[]}