Repository navigation
fix: report project-identity bind conflicts accurately instead of always advising adopt/fork - #332
Merged
Merged
Conversation
…ays advising adopt/fork
The push-time identity bind dropped the server's 409 body on the floor
and collapsed the follow-up binding read into Option<Value>: 'None'
conflated 'server reports unbound' with 'read failed', and the message
always advised 'repo identity adopt'/'fork' — advice that cannot work
when the remote is actually unbound (the storage-side ref-scoping bug
fixed in atomic-storage#113).
- atomic-remote: parse the 409 body into BindServerError {code, message}
(both optional, non-JSON tolerated, nested error{} accepted) and map
the follow-up read to an explicit ConflictRemote::{Bound, Unbound,
Unknown} instead of Option<Value>.
- libatomic: format_bind_conflict renders per-outcome advice — genuine
divergence keeps adopt/fork, a re-minted document of the same project
advises adopt only (fork would conflict the same way), an unbound
report names the storage bug and says upgrade-and-retry, and an
unknown binding states it could not be read without remediation. The
server's code/message are quoted verbatim whenever present.
Fixes #329
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.
Root cause
atomic pushcallsbind_before_push()before any objects move, which POSTs the local project-identity document to<remote>?project-identity=1. On HTTP 409 the client transport:{"code":"IDENTITY_CONFLICT","message":…}was never read, so the operator never saw the real reason.GET ?project-identity=1intoOption<Value>—Nonesilently merged three very different situations: server reports unbound, fetch failed, and unparsable document.bind_before_pushthen renderedremote_id = <unreadable>and always advisedatomic repo identity adopt/atomic repo identity fork— advice that cannot work when the remote is actually unbound. This is exactly what an external user hit: a server-side ref-scoping bug made the bind 409 against a sibling project while the follow-up GET reportedbound:false(server fix in atomic-storage#113).The fix (three parts)
1.
atomic-remote/src/http/identity.rsBindServerError { code, message }(both optional, serializable); the 409 body is parsed on the wire — non-JSON bodies tolerated, nested{"error":{…}}spelling accepted as fallback.BindOutcome::Conflictnow carriesremote: ConflictRemote— an explicit enum{ Bound(Value), Unbound, Unknown }— instead ofOption<Value>.IdentityFetch::Bound → Bound,IdentityFetch::Unbound → Unbound, any fetch error →Unknown(a pre-transport ping also maps toUnknown, since the binding is unreadable).2.
libatomic/src/identity_transport.rsformat_bind_conflict()with per-outcome advice:Bound+ different projectId → genuine divergence: both ids rendered, existing adopt/fork advice kept.Bound+ same projectId but different document (re-minted) → suggestsadoptonly; fork would mint a third lineage that conflicts the same way (verified againstfork_identity()).Unbound→ names the server-side ref-scoping bug (fixed in atomic-storage#113) and advises upgrading the storage server and retrying; no adopt/fork advice.Unknown→ states the remote binding could not be read; no remediation triad.code/messageverbatim when present.<unreadable>is gone: a bound document lacking a readableatomic:projectIdis explained as such.3. Tests
atomic-remote/tests/project_identity_transport.rs) against the canned HTTP server: 409 with a JSON error body surfaces code+message; 409 +bound:false→ConflictRemote::Unbound; 409 +bound:true→ConflictRemote::Bound(doc); 409 + failing GET →ConflictRemote::Unknown.libatomic/src/identity_transport.rscovering everyformat_bind_conflictbranch: divergence keeps adopt/fork, same-project keeps adopt only, unbound has no adopt/fork text and names ci: add dispatchable Prepare Release workflow #113, unknown has no remediation, server words quoted verbatim.Test evidence
Fixes #329 (client half; server half in atomic-storage#113)