feat(api): GET /v1/attestor-sets/by-member/{pubkey}#69
Merged
Conversation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
New read endpoint so a wallet holding an attestor identity (
lpk1...) can discover whichlas1...sets it's a member of. Powers the themisra-dashboard Settings panel's "you're a member of N sets" view, closing audit gap #4 fromligate-io/themisra-dashboard#34(consumer side waiting on this isthemisra-dashboard#37).GET /v1/attestor-sets/by-member/{pubkey}returns the samePage<AttestorSetResponse>envelope as/v1/attestor-sets(cursor pagination,?limit+?before). Consistency with the rest of the api was the chosen path over the brief's{items, next_offset, total}offset shape.data: [], not a 404. The absence of memberships is a valid answer ("you're not in any sets yet"), not a missing resource.lpk+ 32-byte payload). Typos return 400invalid_pubkeywith a detail explaining what was wrong, instead of an opaque empty 200.Implementation notes
attestor_sets.memberswas added in the original indexer migration (20260509000001_indexer_query_tables.sql:174-176). The new query uses JSONB@>against it, so the WHERE is an index seek not a seq scan.LEFT JOIN schemas + COUNT GROUP BY. The brief's pseudo-SQL recomputedschemas_countper row, but the indexer already maintains a denormalizedattestor_sets.schema_countcolumn (bumped on everyRegisterSchemaingest). Cheaper and avoids the GROUP BY entirely.bech32(workspace dep, same crate the indexer uses forAttestationIdderivation) tocrates/api/Cargo.tomlfor the path-param check. Decode is inlined into the handler rather than factored to a helper, because returningResult<String, Response>from a helper tripsclippy::result_large_err(the axumResponseis ~128 bytes). Mirrors howattestation_by_idvalidates itslat1...path param./v1/attestor-sets/by-member/{pubkey}registered before/v1/attestor-sets/{id}for human readability. axum 0.8 disambiguates by segment count regardless of order.Test plan
cargo fmt --check(pre-commit hook passed on commit)cargo clippy --workspace --all-targets -- -D warningsclean (withSKIP_GUEST_BUILD=1 RISC0_SKIP_BUILD_KERNELS=1 CONSTANTS_MANIFEST_PATH=\$PWD)cargo test --workspaceno regressionsEXPLAIN ANALYZEon devnet confirmsBitmap Index Scan on attestor_sets_members_gin_idxFollow-ups (deliberately not in this PR)
tests/harness yet and seeding rows for this query needs inserting through theslots → transactions → attestor_setsFK chain. Either reusable api-side fixtures or extending the indexer e2e harness; either way it's its own PR.docs.ligate.io. The api repo doesn't host route docs (those live inligate-io-docs). Will flag to whoever owns the docs site.Consumer
Once merged + deployed,
ligate-io/themisra-dashboard#37(the/(app)/pendinginbox + Settings stub) can render the membership list offdata[i].id,members,threshold,schema_count, and deep-linkregistered_at.tx_hashto the explorer.