{"draft":null,"from":128,"to":129,"files":[{"path":"src/engine/test/state-source.test.ts","added":47,"removed":0,"diff":"--- a/src/engine/test/state-source.test.ts\n+++ b/src/engine/test/state-source.test.ts\n@@ -315,3 +315,50 @@\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+});"}],"unmatched":[]}