chore: make magicblock-magic-program-api support backward-compat feature#1210
Conversation
Manual Deploy AvailableYou can trigger a manual deploy of this PR branch to testnet: Alternative: Comment
Comment updated automatically when the PR is synchronized. |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds a Cargo feature Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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-magic-program-api/Cargo.toml`:
- Around line 11-20: Uncomment and enable the compile-time mutual-exclusion
check in src/compat.rs so the crate emits a clear compile error if both features
"latest" and "backward-compat" are enabled; specifically, restore the
#[cfg(all(feature = "latest", feature = "backward-compat"))] / compile_error!()
guard that references those feature names to prevent simultaneous activation,
locating the check near the other #[cfg(feature = "...")] blocks in compat.rs;
alternatively, if you prefer not to enforce at compile time, add a terse note in
Cargo.toml documenting that "backward-compat" takes precedence when both
features are enabled.
In `@magicblock-magic-program-api/src/lib.rs`:
- Line 7: Add clear documentation to the crate (e.g., top of lib.rs or README)
describing the feature flags `latest` vs `backward-compat`, the type-mixing risk
when re-exporting Solana types via compat (see the public re-export line `pub
use compat::{declare_id, pubkey, Pubkey};`), and migration guidance for
consumers moving from Solana v2.x to v3.x; explicitly state when to enable each
feature, warn that mixing `latest` and `backward-compat` across crates in the
same dependency graph can lead to incompatible types, and provide brief steps to
update code and dependencies during migration.
🪄 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: fe10e0b9-2589-4266-9825-af3de54752b5
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
magicblock-magic-program-api/Cargo.tomlmagicblock-magic-program-api/src/args.rsmagicblock-magic-program-api/src/compat.rsmagicblock-magic-program-api/src/instruction.rsmagicblock-magic-program-api/src/lib.rsmagicblock-magic-program-api/src/pda.rsmagicblock-magic-program-api/src/response.rs
c78729c to
807af82
Compare
magicblock-magic-program-api support backward-compat feature

Made
magic-program-apisupportbackward-compatfeature following the same pattern used in magicblock-labs/delegation-program#170 and magicblock-labs/ephemeral-rollups-sdk#215.The reason why we need this feature because
magic-program-apiis re-exported from the SDK as-is, it will break users’ code if magic-program-api does not provide this feature.Summary
Breaking Changes
Test Plan
Summary by CodeRabbit
New Features
backward-compatfeature flag to opt into alternate Solana compatibility crates.Changes
backward-compatswitches to the compatibility set without changing behavior.