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 115 --json
JSON
/christopher/abso-core/versions/115?format=json

Preserve indexed membership when closing disk-first views

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

Version 114 · Files at version 115

2 files, 21 lines added, 2 removed.

--- a/worker/project/project.ts
+++ b/worker/project/project.ts
@@ -2512,7 +2512,25 @@
25122512 * A discarded atom that a later publish still depends on stays in the view
25132513 * (abso issue 80). A closed set is unchanged.
25142514 */
2515− #closed(set: Iterable<AtomId>): Set<AtomId> {
2515+ #closed(set: Iterable<AtomId>): ReadonlySet<AtomId> {
2516+ if (set instanceof StableSet) {
2517+ // Keep indexed membership external. Only dependencies absent from
2518+ // that snapshot belong in the operation's closure overlay.
2519+ const missing = new Set<AtomId>();
2520+ const visit = (id: AtomId) => {
2521+ const stack = [id];
2522+ while (stack.length) {
2523+ for (const dependency of this.#graph.atom(stack.pop()!).deps) {
2524+ if (!set.has(dependency) && !missing.has(dependency)) {
2525+ missing.add(dependency);
2526+ stack.push(dependency);
2527+ }
2528+ }
2529+ }
2530+ };
2531+ for (const id of set) visit(id);
2532+ return missing.size ? new StableUnionSet(set, new StableOverlaySet(missing)) : set;
2533+ }
25162534 return this.#graph.closureOf(set);
25172535 }
25182536
--- a/worker/project/test/project-writer-storage.test.ts
+++ b/worker/project/test/project-writer-storage.test.ts
@@ -1,6 +1,6 @@
11import assert from "node:assert/strict";
22import { test } from "node:test";
3−import { storedArray } from "../../../src/engine/state-source.ts";
3+import { StableSet, storedArray } from "../../../src/engine/state-source.ts";
44import { SqlState } from "../../../src/engine/test/storage-helper.ts";
55import { MemoryStore, Project } from "../project.ts";
66import type { Entry, ProjectStore } from "../project-types.ts";
@@ -58,6 +58,7 @@
5858 storage.transaction(() => project.publish("writer", "Two", 2));
5959 project = Project.openWriter(store, storage, entries.length);
6060 const base = project.sharedView();
61+ assert.ok(base.set instanceof StableSet, "published membership must remain indexed rather than copied into a Set");
6162 assert.equal(project.draftOf("writer")!.view, base);
6263 assert.equal(base.text("a.txt"), "two\n");
6364 storage.transaction(() => project.record("other", { "a.txt": "three\n" }, 3));