refactor(reporting): extract paginate_dependency helper and fix tests…#742
Merged
Baskarayelu merged 2 commits intoJun 18, 2026
Conversation
Contributor
|
clean refactor - folding the cross-contract dependency pagination into a shared paginate_dependency helper cuts a lot of duplication, and the snapshot tests still line up. merging 👍 |
Closed
4 tasks
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.
close #738
PR Description
Summary
Extracts the duplicated pagination logic shared by 4 reporting reports into a
single generic
paginate_dependencyhelper. Also fixes 55 pre-existingcompilation errors in
tests.rsthat blocked running any tests.Changes
Refactor —
reporting/src/lib.rsPaginatedResult<T>(items + data_availability)paginate_dependency(env, fetch_page)— bounded loop(MAX_DEP_PAGES cap), drains pages until
next_cursor == 0get_bill_compliance_report_internalget_insurance_report_internalget_top_bills_report_internalget_top_savings_report_internalget_savings_report_internalunchanged — it uses a singlenon-paginated
get_all_goalscallNew tests —
reporting/src/paginate_dependency_tests.rs12 unit tests covering:
DataAvailability::Missing(first page empty)DataAvailability::Complete(cursor=0 within MAX_DEP_PAGES)DataAvailability::Partial(cap reached)Fixed pre-existing
tests.rserrors (55 total)_callerarg to get_savings_report, get_bill_compliance_report,get_insurance_report, get_financial_health_report, get_stored_report,
check_dependencies
Test results
(test_verify_dependency_address_set_does_not_write_storage — storage
accessed outside contract context, pre-dates this PR)