Skip to content

Return the caller's own sample guid with an IBD suggestion - #29

Merged
JamesKane merged 1 commit into
mainfrom
feat/ibd-suggestion-target-guid
Aug 2, 2026
Merged

Return the caller's own sample guid with an IBD suggestion#29
JamesKane merged 1 commit into
mainfrom
feat/ibd-suggestion-target-guid

Conversation

@JamesKane

@JamesKane JamesKane commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Why

POST /api/v1/ibd/attest gates on owns_sample(attester_did, claimed_sample)claimed_sample must be a core.biosample.sample_guid the attester owns. A self-publishing Edge client has no way to learn its own: /ibd/suggestions returned only the candidate's guid, so Navigator could never fill in claimed_sample and 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_did already joins on ms.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_guid supplies the counterpart_sample of the same report.

  • du_db::ibd::SuggestionView gains target_sample_guid
  • both suggestions_for / suggestions_for_did select it
  • /api/v1/ibd/suggestions returns it

Additive: the field is new, nothing is removed or renamed.

Testing

cargo build -p du-db -p du-web clean; du-web clippy clean; the ibd_suggestions test binary compiles.

⚠️ The DB-gated tests did not actually executeDATABASE_URL was unset in my environment, so all three returned in 0.00s via their skip path. The new assertion in suggestions_scoped_by_owner_did (that target_sample_guid is the caller's own sample) has therefore never been run. Please run these against a real DB before merging:

DATABASE_URL=… cargo test -p du-db --test ibd_suggestions

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

`/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>
@JamesKane
JamesKane merged commit 4fa36c7 into main Aug 2, 2026
1 check passed
@JamesKane
JamesKane deleted the feat/ibd-suggestion-target-guid branch August 2, 2026 17:29
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.

1 participant