Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed
MCP
show on this site's /mcp
CLI
abso show 114 --json
JSON
/christopher/abso-core/versions/114?format=json

Reuse published projections for empty actor drafts

of shared·codex-capacity-chair··Not checked

Version 113 · Files at version 114

2 files, 24 lines added, 0 removed.

--- a/worker/project/project.ts
+++ b/worker/project/project.ts
@@ -2483,6 +2483,9 @@
24832483
24842484 /** An agent's view, keyed by what the set is made of, not by sorting every atom in it (#46): that cost more than the work. */
24852485 #agentViewKey(agent: AgentState): string {
2486+ // An empty draft is exactly its published base. Share its projection
2487+ // with version readers instead of walking the same history twice.
2488+ if (agent.mine.length === 0) return `v ${agent.space}@${agent.base}`;
24862489 return `a ${agent.space}@${agent.base}+${agent.mine.join(",")}`;
24872490 }
24882491
--- a/worker/project/test/project-writer-storage.test.ts
+++ b/worker/project/test/project-writer-storage.test.ts
@@ -50,6 +50,27 @@
5050 storage.db.close();
5151});
5252
53+test("empty writer drafts reuse their exact published base projection without conflating newer heads", () => {
54+ const { storage, entries, store } = setup();
55+ let project = new Project(store, { writerStorage: storage });
56+ storage.transaction(() => project.init({ "a.txt": "one\n" }, 0));
57+ storage.transaction(() => project.record("writer", { "a.txt": "two\n" }, 1));
58+ storage.transaction(() => project.publish("writer", "Two", 2));
59+ project = Project.openWriter(store, storage, entries.length);
60+ const base = project.sharedView();
61+ assert.equal(project.draftOf("writer")!.view, base);
62+ assert.equal(base.text("a.txt"), "two\n");
63+ storage.transaction(() => project.record("other", { "a.txt": "three\n" }, 3));
64+ assert.notEqual(project.draftOf("other")!.view, base);
65+ storage.transaction(() => project.publish("other", "Three", 4));
66+ assert.equal(project.sharedView().text("a.txt"), "three\n");
67+ assert.equal(project.draftOf("writer")!.view, base, "an unchanged actor stays at its old base");
68+ assert.equal(project.draftOf("writer")!.view.text("a.txt"), "two\n");
69+ assert.notEqual(project.draftOf("writer")!.view, project.sharedView());
70+ assert.equal(project.draftOf("other")!.view, project.sharedView());
71+ storage.db.close();
72+});
5374test("actual Project record and publish use persistent graph, membership and positional indexes", (t) => {
5475 t.mock.method(Date, "now", () => 100);
5576 const { storage, entries, store } = setup();