Fix/pagination and compliance coverage - #326
Merged
valoryyaa-byte merged 4 commits intoAug 31, 2026
Merged
Conversation
holders::list reuses the same DEFAULT_PAGE_SIZE/MAX_PAGE_SIZE clamping as assets::list, but only the latter had a test proving the clamp holds. Add the equivalent case for holders: request ?limit=1000 against an asset with 150 holders and assert exactly 100 come back. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XuzjEXQKQDNTaab4qqsftw
Jurisdiction aggregation was only tested at the indexer level (indexer::mod::compliance_summary_counts_by_status); the route-level tests in compliance.rs only covered the default (empty) summary. Seed snap.compliance with a populated ComplianceSummary and drive it through the actual GET /assets/:id/compliance handler, asserting the jurisdictions entries round-trip through the JSON response unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XuzjEXQKQDNTaab4qqsftw
GET /assets and GET /assets/:id/holders paginate with ?offset=/?limit= but returned a bare JSON array, giving clients no way to know how many total items matched before pagination was applied — they'd have to fetch an extra, possibly-empty page to detect the end of the list. Both handlers now return an X-Total-Count header carrying the pre-pagination match count (post-filter for assets, since assets also supports ?asset_type=/?active=). Document the header on both endpoints in the API docs and the OpenAPI spec, and add tests asserting the header value against the underlying total. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XuzjEXQKQDNTaab4qqsftw
AssetQuery.limit and HolderQuery.limit are Option<usize>, so a negative value already fails Query extraction with a 400, but ?limit=0 parsed successfully and silently returned an empty page instead of falling back to DEFAULT_PAGE_SIZE. Filter out 0 before the unwrap_or so it's treated the same as an absent limit, and pin the behavior with tests on both routes plus a docs/OpenAPI note. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XuzjEXQKQDNTaab4qqsftw
|
@jhaydeeee-web Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Closes #306
Closes #311
Closes #312
Closes #313
SUMMARY
existing assets.rs test: seeds 150 holders on an asset, requests ?limit=1000, asserts exactly 100 come back.
compliance.rs, seeding snap.compliance with a populated ComplianceSummary (including 3 jurisdiction entries) and driving it through the
actual GET /assets/:id/compliance handler via a Router, asserting the full JSON payload round-trips correctly.
Json<...>) with an X-Total-Count header carrying the pre-pagination match count. Updated the OpenAPI spec and the /docs/api/assets and
/docs/api/holders pages to document it, plus added tests verifying the header value against the underlying total.
before falling back to DEFAULT_PAGE_SIZE, so ?limit=0 now behaves like an absent limit instead of silently returning []. Pinned with a test
on each route plus doc/OpenAPI notes.