Return the caller's own sample guid with an IBD suggestion - #29
Merged
Conversation
`/api/v1/ibd/attest` gates on `owns_sample(attester_did, claimed_sample)`, but a self-publishing Edge client has no way to learn its server-side `core.biosample.sample_guid` — the suggestions payload returned only the *candidate's* guid, so Navigator could never fill in `claimed_sample` and the attest endpoint was unreachable from the edge. `suggestions_for_did` already joins on `ms.target_sample_guid` (that is how the per-DID scope is enforced), so surfacing it costs nothing and leaks nothing: the caller owns that sample by construction. `suggested_sample_guid` supplies the `counterpart_sample` of the same report. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Why
POST /api/v1/ibd/attestgates onowns_sample(attester_did, claimed_sample)—claimed_samplemust be acore.biosample.sample_guidthe attester owns. A self-publishing Edge client has no way to learn its own:/ibd/suggestionsreturned only the candidate's guid, so Navigator could never fill inclaimed_sampleand the attest endpoint was unreachable from the edge.That left completed edge-to-edge comparisons stranded — computed, signed, agreed by both parties, and then never reported, so the discovery graph could not grow from its own results.
What
suggestions_for_didalready joins onms.target_sample_guid— that join is the per-DID scope. Selecting it costs nothing and discloses nothing: the caller owns that sample by construction.suggested_sample_guidsupplies thecounterpart_sampleof the same report.du_db::ibd::SuggestionViewgainstarget_sample_guidsuggestions_for/suggestions_for_didselect it/api/v1/ibd/suggestionsreturns itAdditive: the field is new, nothing is removed or renamed.
Testing
cargo build -p du-db -p du-webclean;du-webclippy clean; theibd_suggestionstest binary compiles.DATABASE_URLwas unset in my environment, so all three returned in 0.00s via their skip path. The new assertion insuggestions_scoped_by_owner_did(thattarget_sample_guidis the caller's own sample) has therefore never been run. Please run these against a real DB before merging:Companion
Navigator side: JamesKane/decodingus-navigator#43. Navigator parses this field as optional, so it degrades cleanly against an AppView without this change — everything works except attesting.
🤖 Generated with Claude Code