Skip to content

fix: joinset result ordering#1214

Merged
taco-paco merged 3 commits into
masterfrom
fix/joinset
May 19, 2026
Merged

fix: joinset result ordering#1214
taco-paco merged 3 commits into
masterfrom
fix/joinset

Conversation

@taco-paco
Copy link
Copy Markdown
Contributor

@taco-paco taco-paco commented May 18, 2026

Summary

JoinSet returns results in completion order not in scheduled order, as result with 2 chunks the returns acc data could correspond to different pubkey.

Breaking Changes

  • None
  • Yes — migration path described below

Test Plan

Summary by CodeRabbit

  • Refactor
    • Optimized concurrent account fetching operations with improved error handling semantics for faster error detection.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • test-integration/Cargo.lock is excluded by !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1f2baddc-20a2-470b-8129-7ce9483c72ac

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR refactors concurrent account fetching in the MagicblockRpcClient crate. The get_multiple_accounts_with_config method previously used tokio::task::JoinSet to spawn and join account fetch tasks per chunk; it now uses futures_util::future::try_join_all to await multiple chunked futures concurrently. The change adds a futures-util dependency, updates imports to include try_join_all, and restructures the chunk-fetching loop to map RPC results and flatten per-chunk account vectors into a single result. Error propagation follows try_join_all's fail-fast semantics.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/joinset

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@magicblock-rpc-client/src/lib.rs`:
- Around line 327-337: Add a regression test that exercises the chunked fetch
path (the code that maps pubkeys.chunks(max_per_fetch) into futures and awaits
try_join_all) to verify out-of-order completion still preserves input order:
implement a test (e.g., test_out_of_order_chunk_completion) that builds a
mock/replaceable RPC client used by the method under test and arranges the
per-chunk futures so a later chunk completes before an earlier chunk (use
controllable primitives like oneshot channels, delays, or a mock that resolves
in reversed order), call the function that invokes
self.client.get_multiple_accounts_with_config for chunks, and assert the
returned Vec<Option<Account>> aligns with the original pubkeys ordering despite
the reversed completion order.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 166d5374-c6da-48d3-805b-e814176009e0

📥 Commits

Reviewing files that changed from the base of the PR and between de0d994 and 280dff1.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • test-integration/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • magicblock-rpc-client/Cargo.toml
  • magicblock-rpc-client/src/lib.rs

Comment thread magicblock-rpc-client/src/lib.rs
@taco-paco taco-paco marked this pull request as ready for review May 19, 2026 05:28
Copy link
Copy Markdown
Collaborator

@bmuddha bmuddha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@taco-paco taco-paco merged commit 21b6564 into master May 19, 2026
41 checks passed
@taco-paco taco-paco deleted the fix/joinset branch May 19, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants