{"draft":null,"from":206,"to":207,"files":[{"path":"worker/project/project.ts","added":39,"removed":4,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -12,8 +12,16 @@\n // agents publish into under the same rules, and that lands in shared as one\n // unit. Every agent works in one space at a time.\n \n-import { type Atom, type AtomId, EngineError, Graph, type LineId, type ReadView } from \"../../src/engine/index.ts\";\n import {\n+\ttype Atom,\n+\ttype AtomId,\n+\tEngineError,\n+\tGraph,\n+\ttype LineId,\n+\ttype ReadView,\n+\tView,\n+} from \"../../src/engine/index.ts\";\n+import {\n \tCachedStateStorage,\n \tdifferenceSet,\n \ttype GraphStateStorage,\n@@ -176,11 +184,21 @@\n import { recordFile as hostedRecordFile, type RecordFileHost } from \"./record-file.ts\";\n import { refusals as hostedRefusals, refuse as hostedRefuse, type RefuseHost } from \"./refuse.ts\";\n import { restore as hostedRestore, type RestoreHost } from \"./restore.ts\";\n-import { indexClosure, last, Membership, SHARED, SharedAdditions, type Space, sharedBaseOf } from \"./spaces.ts\";\n+import {\n+\tclosureChangedAt,\n+\tindexClosure,\n+\tlast,\n+\tMembership,\n+\tSHARED,\n+\tSharedAdditions,\n+\ttype Space,\n+\tsharedBaseOf,\n+} from \"./spaces.ts\";\n import { starting as hostedStarting, type StartingHost } from \"./start.ts\";\n import { switchTo as hostedSwitchTo, type SwitchHost } from \"./switch-to.ts\";\n import { sync as hostedSync, type SyncHost } from \"./sync.ts\";\n import { treeHash } from \"./tree.ts\";\n+import { versionFiles as keptVersionFiles, type VersionFilesHost } from \"./version-files.ts\";\n import {\n \ttype LogHost,\n \tcompare as versionCompare,\n@@ -1588,8 +1606,25 @@\n \t\t\tthis.#applyEntry(entry, at, keptTime);\n \t\t\t// Shared's closure, kept per version on disk (abso Capacity): after the entry, since its atoms join the graph after\n \t\t\t// its membership.\n-\t\t\tif (this.#writerStorage && (this.#spaces.get(SHARED)?.versions.length ?? 0) > versionsBefore)\n-\t\t\t\tindexClosure(this.#writerStorage, this.#spaces.get(SHARED)!, this.#graph);\n+\t\t\tif (this.#writerStorage && (this.#spaces.get(SHARED)?.versions.length ?? 0) > versionsBefore) {\n+\t\t\t\tconst shared = this.#spaces.get(SHARED)!;\n+\t\t\t\tconst storage = this.#writerStorage;\n+\t\t\t\tindexClosure(storage, shared, this.#graph);\n+\t\t\t\t// Each new version's changed files, from what it touched (version-files.ts): kept in the shapes table when\n+\t\t\t\t// the host gives one, so the log, a path's history and the tree never lay versions out to find them.\n+\t\t\t\tconst host: VersionFilesHost = {\n+\t\t\t\t\tstorage,\n+\t\t\t\t\tgraph: this.#graph,\n+\t\t\t\t\tat: (v) => this.#at(shared, v),\n+\t\t\t\t\tviewAt: (v) => this.#viewAt(shared, v),\n+\t\t\t\t\tempty: () => new View(this.#graph, []),\n+\t\t\t\t\tclosureChangedAt: (v) => closureChangedAt(storage, v),\n+\t\t\t\t};\n+\t\t\t\tfor (let v = versionsBefore; v < shared.versions.length; v++) {\n+\t\t\t\t\tconst { files, exists } = keptVersionFiles(host, shared.versions[v]!);\n+\t\t\t\t\tthis.#paths.keep(shared, v, files, v === 0 ? host.empty() : host.viewAt(v - 1), host.viewAt(v), exists);\n+\t\t\t\t}\n+\t\t\t}\n \t\t} finally {\n \t\t\t// Positions by version: where each version of shared was made.\n \t\t\tconst versionsAfter = this.#spaces.get(SHARED)?.versions.length ?? 0;"}],"unmatched":[]}