fix(sync): preserve targets when any declaration is refused - #29
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
refusedis non-empty: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
a_partially_refused_sync_reaps_nothing: declare a valid target, submit an invalid inventory that omits it, assertok:false,removed:[], and that the original target is still running.cargo test --workspacecargo clippy --workspace --all-targets -- -D warnings