{"version":112,"agent":"codex-capacity-chair","message":"Read one actor head without projecting every agent draft","time":1791828253882,"timeIso":"2026-10-12T18:04:13.882Z","changes":2,"change":1284,"files":["worker/project/project.ts","worker/project/test/project-writer-storage.test.ts"],"draft":null,"diff":[{"path":"worker/project/project.ts","added":10,"removed":0,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -2430,6 +2430,16 @@\n \t\treturn snapshotStatus(this.#snapshot);\n \t}\n \n+\t/** The operation fence needs one actor's heads, not every agent's file projection. */\n+\tactorHead(name: string): { base: number; draftChanges: number; draft: string | null } | undefined {\n+\t\tconst agent = this.#agents.get(name);\n+\t\tif (!agent) return undefined;\n+\t\tconst published = this.#setOf(this.#spaceOf(agent));\n+\t\tlet draftChanges = 0;\n+\t\tfor (const id of agent.mine) if (!published.has(id)) draftChanges++;\n+\t\treturn { base: agent.base, draftChanges, draft: agent.space === SHARED ? null : agent.space };\n+\t}\n+\n \t/** A space's contents at one of its versions. */\n \t#at(space: Space, version: number): ReadonlySet<AtomId> {\n \t\treturn this.#membership.at(space, version);"},{"path":"worker/project/test/project-writer-storage.test.ts","added":20,"removed":0,"diff":"--- a/worker/project/test/project-writer-storage.test.ts\n+++ b/worker/project/test/project-writer-storage.test.ts\n@@ -4,6 +4,7 @@\n import { SqlState } from \"../../../src/engine/test/storage-helper.ts\";\n import { MemoryStore, Project } from \"../project.ts\";\n import type { Entry, ProjectStore } from \"../project-types.ts\";\n+import { WriterAgents } from \"../writer-agents.ts\";\n \n function setup() {\n \tconst storage = new SqlState();\n@@ -30,6 +31,25 @@\n \t};\n }\n \n+test(\"actor fence reads neither enumerate other agents nor project their files\", (t) => {\n+\tconst { storage, entries, store } = setup();\n+\tlet project = new Project(store, { writerStorage: storage });\n+\tstorage.transaction(() => project.init({ \"a.txt\": \"one\\n\" }, 0));\n+\tstorage.transaction(() => project.record(\"writer\", { \"a.txt\": \"ONE\\n\" }, 1));\n+\tstorage.transaction(() => project.record(\"other\", { \"a.txt\": \"OTHER\\n\" }, 2));\n+\tconst status = project.status().agents.find((agent) => agent.agent === \"writer\")!;\n+\tproject = Project.openWriter(store, storage, entries.length);\n+\tt.mock.method(WriterAgents.prototype, \"entries\", () => {\n+\t\tthrow new Error(\"all-agent scan forbidden\");\n+\t});\n+\tt.mock.method(Project.prototype, \"status\", () => {\n+\t\tthrow new Error(\"full status projection forbidden\");\n+\t});\n+\tassert.deepEqual(project.actorHead(\"writer\"), { base: status.base, draftChanges: status.draftChanges, draft: null });\n+\tassert.equal(project.actorHead(\"absent\"), undefined);\n+\tstorage.db.close();\n+});\n+\n test(\"actual Project record and publish use persistent graph, membership and positional indexes\", (t) => {\n \tt.mock.method(Date, \"now\", () => 100);\n \tconst { storage, entries, store } = setup();"}],"ci":null}