F4 SLICE-1: anchor prune counts proposal anchorIds (closes store.ts F4 TODO) (#12)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+3
-2
@@ -61,8 +61,8 @@ export class CoauthorStore {
|
||||
* Read-modify-write for sidecar co-ownership (spec F3 §6.2): each controller
|
||||
* mutates only its own section against a FRESH load, so ThreadController and
|
||||
* AttributionController never clobber each other. After the mutation, anchors
|
||||
* referenced by neither threads nor attributions are pruned (proposals are
|
||||
* still empty in F3 — revisit in F4). `mutate` MUST be synchronous: the
|
||||
* referenced by no thread, attribution, OR proposal are pruned (threads,
|
||||
* attributions, and proposals all keep their anchors — F4). `mutate` MUST be synchronous: the
|
||||
* read-modify-write (and the self-write mark) completes within this call.
|
||||
*/
|
||||
update(docPath: string, mutate: (artifact: Artifact) => void): Artifact {
|
||||
@@ -71,6 +71,7 @@ export class CoauthorStore {
|
||||
const referenced = new Set<string>([
|
||||
...artifact.threads.map((t) => t.anchorId),
|
||||
...artifact.attributions.map((a) => a.anchorId),
|
||||
...artifact.proposals.map((p) => p.anchorId),
|
||||
]);
|
||||
for (const id of Object.keys(artifact.anchors)) {
|
||||
if (!referenced.has(id)) delete artifact.anchors[id];
|
||||
|
||||
Reference in New Issue
Block a user