{"draft":null,"from":39,"to":318,"files":[{"path":"src/engine/test/graph-insertion-runs.test.ts","added":24,"removed":0,"diff":"--- /dev/null\n+++ b/src/engine/test/graph-insertion-runs.test.ts\n@@ -0,0 +1,24 @@\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { buildBase, Graph } from \"../index.ts\";\n+import { SqlState } from \"./storage-helper.ts\";\n+\n+test(\"many insertion runs reopen without fetching every run\", (t) => {\n+\tconst storage = new SqlState();\n+\tt.after(() => storage.db.close());\n+\tconst files = Object.fromEntries(Array.from({ length: 257 }, (_, i) => [`file-${i}.txt`, `value ${i}`]));\n+\tconst atom = buildBase(files, { author: \"fixture\", message: \"many files\", time: 0 });\n+\tnew Graph({ storage }).add(atom);\n+\tassert.ok(JSON.stringify(storage.read(\"atoms\", \"0\")).length < 2048);\n+\tconst read = storage.read.bind(storage);\n+\tlet runs = 0;\n+\tstorage.read = (collection, key) => {\n+\t\tif (collection === \"atom-inserts:0\") runs++;\n+\t\treturn read(collection, key);\n+\t};\n+\tconst saved = new Graph({ storage }).atom(\"a0\");\n+\tassert.equal(saved.inserts.length, atom.inserts.length);\n+\tassert.equal(runs, 0);\n+\tassert.deepEqual([...saved.inserts[256]!.lines], atom.inserts[256]!.lines);\n+\tassert.equal(runs, 1);\n+});"}],"unmatched":[]}