Skip to content

refactor(queries): extract shared bucket-pagination helper for get_ca… - #717

Open
Nife-tanny wants to merge 1 commit into
Iris-IV:mainfrom
Nife-tanny:refactor/shared_bucket_pagination
Open

refactor(queries): extract shared bucket-pagination helper for get_ca…#717
Nife-tanny wants to merge 1 commit into
Iris-IV:mainfrom
Nife-tanny:refactor/shared_bucket_pagination

Conversation

@Nife-tanny

Copy link
Copy Markdown

…mpaigns_by_category and get_creator_campaigns (#663)

Introduce a private helper that encapsulates
the identical bucket-traversal algorithm previously duplicated in
and . The helper is
parameterised by:

  • total count (derived by each caller from its own domain counter)
  • bucket size (CATEGORY_CAMPAIGNS_BUCKET_SIZE / CREATOR_CAMPAIGNS_BUCKET_SIZE)
  • a bucket getter closure (each caller supplies its own storage lookup)

Algorithm (unchanged):

  1. Jump to the bucket containing the page offset.
  2. Walk entries within that bucket starting at the requested position.
  3. Collect up to campaigns (capped at LIST_MAX_LIMIT).
  4. When the bucket is exhausted, advance position past the bucket boundary and repeat from step 1 with the next bucket.

Behaviour preservation:

  • Public function signatures unchanged — backwards-compatible.
  • Only src/queries.rs modified.
  • All 400 workspace tests run; only 2 pre-existing failures remain (test_campaign_update — unrelated Soroban host vector unpacking).
  • 26 query/bucket/benchmark tests pass with zero regressions.
  • cargo fmt --check and cargo clippy --all-targets --features testutils both pass cleanly.

Closes #663

📌 Description

Provide a clear and concise description of the changes in this PR.

🔗 Related Issues

Use GitHub's auto-close keywords with the # prefix (one issue per line):

Closes #123
Fixes #456
Resolves #789

Multiple issues can be closed by repeating the keyword on separate lines.

🧪 Changes Made

  • Bug fix
  • New feature
  • Refactor
  • Documentation update

✅ Checklist

  • Code compiles successfully
  • Tests added/updated and passing
  • Linting passes (no warnings/errors)
  • Documentation updated (if required)
  • No breaking changes (or clearly documented)

⚠️ Breaking Changes

If this PR introduces breaking changes, describe them here.

📸 Screenshots (if applicable)

Add screenshots to help reviewers understand the changes.

🧩 Additional Notes

Anything else reviewers should know.

Closes #663

…mpaigns_by_category and get_creator_campaigns (Iris-IV#663)

Introduce a private  helper that encapsulates
the identical bucket-traversal algorithm previously duplicated in
 and . The helper is
parameterised by:
  - total count (derived by each caller from its own domain counter)
  - bucket size (CATEGORY_CAMPAIGNS_BUCKET_SIZE / CREATOR_CAMPAIGNS_BUCKET_SIZE)
  - a bucket getter closure (each caller supplies its own storage lookup)

Algorithm (unchanged):
  1. Jump to the bucket containing the page offset.
  2. Walk entries within that bucket starting at the requested position.
  3. Collect up to  campaigns (capped at LIST_MAX_LIMIT).
  4. When the bucket is exhausted, advance position past the bucket
     boundary and repeat from step 1 with the next bucket.

Behaviour preservation:
  - Public function signatures unchanged — backwards-compatible.
  - Only src/queries.rs modified.
  - All 400 workspace tests run; only 2 pre-existing failures remain
    (test_campaign_update — unrelated Soroban host vector unpacking).
  - 26 query/bucket/benchmark tests pass with zero regressions.
  - cargo fmt --check and cargo clippy --all-targets --features testutils
    both pass cleanly.

Closes Iris-IV#663
@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Nife-tanny 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant