Skip to content

fix(sync): preserve targets when any declaration is refused - #29

Merged
alice-viola merged 2 commits into
masterfrom
fix/no-reap-on-partial-sync
Sep 7, 2026
Merged

fix(sync): preserve targets when any declaration is refused#29
alice-viola merged 2 commits into
masterfrom
fix/no-reap-on-partial-sync

Conversation

@albertovincenzi

Copy link
Copy Markdown
Collaborator

Problem

The target sync endpoint reaped omitted one-node graphs even when one or more documents in the submitted inventory were rejected.

That makes a validation error destructive: the response says ok: false, but unrelated valid targets omitted from the bad request have already been stopped and deleted from the durable store. The code comment promised the opposite: a sync that fails partway removes nothing.

Fix

Treat the submitted list as authoritative for deletion only when every declaration in it succeeded. If refused is non-empty:

  • successful declarations remain applied;
  • no existing target is reaped;
  • the caller can repair and retry without first recovering deleted configuration.

The existing application boundary and multi-node-graph exemption remain unchanged.

Notes for Alice

This deliberately does not attempt to roll back declarations that already succeeded; graph declaration has its own durability/provisioning guarantees. It only gates the destructive phase. This is the smallest change that restores the documented failure contract.

Verification

  • Added live regression a_partially_refused_sync_reaps_nothing: declare a valid target, submit an invalid inventory that omits it, assert ok:false, removed:[], and that the original target is still running.
  • cargo test --workspace
  • cargo clippy --workspace --all-targets -- -D warnings

The regression declared one target and then synced a list naming only an
invalid document. That proves the reap did not run, but not the property the
change is about: a list that is partly valid is still not authority to delete
what it leaves out.

Two targets now, and the submitted list carries one valid document plus one
broken one. `keep` is applied, `broken` is refused, and `drop` — the target
nobody named — is still declared and still running.

Taken from #7, which fixes the same bug with a byte-identical change to
`do_sync` and can be closed once this lands.

Claude-Session: https://claude.ai/code/session_012K8u7BEJyd6nDNMCQAgH3z
@alice-viola
alice-viola merged commit 95d47c7 into master Sep 7, 2026
1 check passed
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