Skip to content

Fix/pagination and compliance coverage - #326

Merged
valoryyaa-byte merged 4 commits into
RWA-ToolKit:mainfrom
jhaydeeee-web:fix/pagination-and-compliance-coverage
Aug 31, 2026
Merged

Fix/pagination and compliance coverage#326
valoryyaa-byte merged 4 commits into
RWA-ToolKit:mainfrom
jhaydeeee-web:fix/pagination-and-compliance-coverage

Conversation

@jhaydeeee-web

Copy link
Copy Markdown
Contributor

Closes #306
Closes #311
Closes #312
Closes #313

SUMMARY

  1. test(holders): pin limit clamping to MAX_PAGE_SIZE like assets::list — Added limit_is_clamped_to_max_page_size to holders.rs, mirroring the
    existing assets.rs test: seeds 150 holders on an asset, requests ?limit=1000, asserts exactly 100 come back.
  2. test(compliance): cover jurisdiction aggregation at the HTTP route level — Added jurisdictions_round_trip_through_the_http_response to
    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.
  3. feat(api): report total match count via X-Total-Count on list endpoints — Both assets::list and holders::list now return (HeaderMap,
    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.
  4. fix(api): treat ?limit=0 as unset instead of an empty page — Changed both AssetQuery.limit and HolderQuery.limit handling to filter out 0
    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.

jhaydeeee-web and others added 4 commits August 30, 2026 17:03
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
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@valoryyaa-byte
valoryyaa-byte merged commit 6da9ad0 into RWA-ToolKit:main Aug 31, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment