Skip to content

fix(sync): reap targets not loaded on this replica - #46

Closed
albertovincenzi wants to merge 2 commits into
fix/no-reap-on-partial-syncfrom
fix/sync-stored-inventory
Closed

fix(sync): reap targets not loaded on this replica#46
albertovincenzi wants to merge 2 commits into
fix/no-reap-on-partial-syncfrom
fix/sync-stored-inventory

Conversation

@albertovincenzi

Copy link
Copy Markdown
Collaborator

Perché

PUT /v1/apps/:app/targets dichiara l’intera configurazione e deve rimuovere i target omessi. Il reap enumerava però soltanto registry.of_app(): se la richiesta arrivava a una replica fresca prima del reconcile, il registry era vuoto, il sync rispondeva ok: true, ma i target omessi restavano nello store e continuavano a vivere sulle altre repliche.

Fix

  • legge l’inventario durabile prima di applicare la lista;
  • costruisce i candidati al reap come unione deterministica di store e registry locale;
  • elimina anche un target presente soltanto nello store e ferma il runtime locale se esiste;
  • conserva l’esenzione dei grafi multi-nodo;
  • se scan/paginazione/decodifica non producono un inventario completo, applica in sicurezza le dichiarazioni valide ma restituisce ok: false e non rimuove nulla.

Verifica

  • nuovo test live: il target è dichiarato sulla prima replica, una seconda replica con registry vuoto riceve un sync [], lo rimuove dallo store e la prima converge sulla cancellazione;
  • cargo test --workspace;
  • cargo clippy --workspace --all-targets -- -D warnings;
  • cargo fmt --all e git diff --check.

Dipendenza / nota per Alice

Questa PR è basata su #29, perché un inventario illeggibile deve sfruttare la sua garanzia “qualsiasi refusal => nessun reap”. Con #28 lo scan completa anche cataloghi paginati; senza #28 resta comunque sicuro e rifiuta il reap quando Queen segnala truncated.

albertovincenzi and others added 2 commits September 5, 2026 00:55
Reading the inventory from the store is what this branch is for, but the
multi-node exemption was read from there too and then applied to the local
runtime without checking it. Those are not the same graph.

A redeclare registers before it saves. A graph that grew nodes and whose store
write then failed is a one-node document in the store and a multi-node graph in
this registry, so the merged candidate set offered it up and the reap stopped
it and deleted its document. Master could not do this: it iterated runtimes and
skipped `rt.plan.nodes.len() > 1`.

The runtime now decides, and it is asked BEFORE the store write, so a graph that
is exempt keeps its document as well as its consumers.

Claude-Session: https://claude.ai/code/session_012K8u7BEJyd6nDNMCQAgH3z
@alice-viola

Copy link
Copy Markdown
Contributor

Landed on master via #67 (merge commit 944ee9b) as part of the 62-PR integration — this PR's head commit 332fd8f is an ancestor of master. GitHub could not mark it merged automatically because its base is fix/no-reap-on-partial-sync, not master. Closing as landed.

@alice-viola alice-viola closed this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants