Skip to content

chore: make magicblock-magic-program-api support backward-compat feature#1210

Merged
snawaz merged 5 commits into
masterfrom
snawaz/backward-compat
May 19, 2026
Merged

chore: make magicblock-magic-program-api support backward-compat feature#1210
snawaz merged 5 commits into
masterfrom
snawaz/backward-compat

Conversation

@snawaz
Copy link
Copy Markdown
Contributor

@snawaz snawaz commented May 18, 2026

Made magic-program-api support backward-compat feature 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-api is re-exported from the SDK as-is, it will break users’ code if magic-program-api does not provide this feature.

Summary

Breaking Changes

  • None
  • Yes — migration path described below

Test Plan

Summary by CodeRabbit

  • New Features

    • Added a backward-compat feature flag to opt into alternate Solana compatibility crates.
  • Changes

    • Core Solana helper types are now provided through a compatibility layer; outward APIs and names remain the same.
    • Default build uses the current Solana dependencies; enabling backward-compat switches to the compatibility set without changing behavior.

Review Change Stack

@github-actions
Copy link
Copy Markdown

Manual Deploy Available

You can trigger a manual deploy of this PR branch to testnet:

Deploy to Testnet 🚀

Alternative: Comment /deploy on this PR to trigger deployment directly.

⚠️ Note: Manual deploy requires authorization. Only authorized users can trigger deployments.

Comment updated automatically when the PR is synchronized.

Copy link
Copy Markdown
Contributor Author

snawaz commented May 18, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

Warning

Rate limit exceeded

@snawaz has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 39 minutes and 43 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: af59d71c-faea-43aa-9cd7-25f90a657fbb

📥 Commits

Reviewing files that changed from the base of the PR and between 807af82 and 5b31e92.

📒 Files selected for processing (3)
  • magicblock-magic-program-api/src/args.rs
  • magicblock-magic-program-api/src/compat.rs
  • magicblock-magic-program-api/src/instruction.rs
📝 Walkthrough

Walkthrough

Adds a Cargo feature backward-compat and optional compat dependencies, introduces a new public compat module that conditionally re-exports Solana types from either compat crates or the standard crates, re-exports declare_id/pubkey/Pubkey from compat at crate root, and rewires internal modules to import Solana types via crate::compat.

Suggested reviewers

  • GabrielePicco
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch snawaz/backward-compat

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: 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3b75749 and 72aed62.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • magicblock-magic-program-api/Cargo.toml
  • magicblock-magic-program-api/src/args.rs
  • magicblock-magic-program-api/src/compat.rs
  • magicblock-magic-program-api/src/instruction.rs
  • magicblock-magic-program-api/src/lib.rs
  • magicblock-magic-program-api/src/pda.rs
  • magicblock-magic-program-api/src/response.rs

Comment thread magicblock-magic-program-api/Cargo.toml
Comment thread magicblock-magic-program-api/src/lib.rs
@snawaz snawaz force-pushed the snawaz/backward-compat branch from c78729c to 807af82 Compare May 19, 2026 03:29
@snawaz snawaz marked this pull request as ready for review May 19, 2026 03:40
@snawaz snawaz requested review from bmuddha and jonasXchen May 19, 2026 03:40
@snawaz snawaz changed the title chore: make magicblock-magic-program-api support backward-compat feature chore: make magicblock-magic-program-api support backward-compat feature May 19, 2026
Copy link
Copy Markdown
Contributor Author

snawaz commented May 19, 2026

Merge activity

  • May 19, 6:21 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 19, 6:22 AM UTC: @snawaz merged this pull request with Graphite.

@snawaz snawaz merged commit defa883 into master May 19, 2026
39 checks passed
@snawaz snawaz deleted the snawaz/backward-compat branch May 19, 2026 06:22
thlorenz added a commit that referenced this pull request May 19, 2026
* master:
  release magic-program-api v0.10.1 (0.10.0 -> 0.10.1) (#1215)
  chore: make `magicblock-magic-program-api` support `backward-compat` feature (#1210)
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