Skip to content

release: bump the IDL program version - #564

Merged
kskalski merged 1 commit into
solana-program:mainfrom
kskalski:ks/release_idl_version
Oct 2, 2026
Merged

kskalski merged 1 commit into
solana-program:mainfrom
kskalski:ks/release_idl_version

Conversation

@kskalski

@kskalski kskalski commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The release bumps interface/Cargo.toml without touching the IDL files, so the IDL job fails after every release until someone regenerates them.

Summary of Changes

  • regenerate both IDL files from a cargo-release pre-release hook, skipping dry runs
  • enable the shared workflow's pnpm input, since the hook needs pnpm

Testing

Ran cargo release minor --execute --no-publish --no-push --no-tag on a scratch branch, from the repo root and from interface/, and checked that each release commit carries both regenerated IDL files at the new version.

@kskalski
kskalski marked this pull request as ready for review September 25, 2026 11:15
@kskalski
kskalski requested a review from joncinque September 25, 2026 11:16

@joncinque joncinque left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great to me! This is a great way to solve the problem, and I tested that it works. Just some nits to make it more robust.

cc @lorisleiva since we've discussed some sort of action to do this in the past. This seems like a very neat and easy solution

Comment thread interface/Cargo.toml Outdated

[package.metadata.release]
pre-release-replacements = [
{ file = "../idl.json", search = '("publicKey": "Stake11111111111111111111111111111111111111",\n "version": ")[^"]+', replace = "${1}{{version}}", exactly = 1 },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: in case we end up changing the spacing, can we make this slightly more robust?

Suggested change
{ file = "../idl.json", search = '("publicKey": "Stake11111111111111111111111111111111111111",\n "version": ")[^"]+', replace = "${1}{{version}}", exactly = 1 },
{ file = "../idl.json", search = '("publicKey":\s*"Stake11111111111111111111111111111111111111",\s*"version":\s*")[^"]+', replace = "${1}{{version}}", exactly = 1 },

Comment thread interface/Cargo.toml Outdated
[package.metadata.release]
pre-release-replacements = [
{ file = "../idl.json", search = '("publicKey": "Stake11111111111111111111111111111111111111",\n "version": ")[^"]+', replace = "${1}{{version}}", exactly = 1 },
{ file = "../interface-idl.json", search = '("publicKey": "Stake11111111111111111111111111111111111111",\n "version": ")[^"]+', replace = "${1}{{version}}", exactly = 1 },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: same here

Suggested change
{ file = "../interface-idl.json", search = '("publicKey": "Stake11111111111111111111111111111111111111",\n "version": ")[^"]+', replace = "${1}{{version}}", exactly = 1 },
{ file = "../interface-idl.json", search = '("publicKey":\s*"Stake11111111111111111111111111111111111111",\s*"version":\s*")[^"]+', replace = "${1}{{version}}", exactly = 1 },

@lorisleiva

Copy link
Copy Markdown
Member

@joncinque If I understand correctly even though the Codama Macros already do use the Cargo.toml to get the IDL version, this is a post-release timing issue that keeps the IDL version to the previous one until it gets regenerated?

@joncinque

Copy link
Copy Markdown
Contributor

@joncinque If I understand correctly even though the Codama Macros already do use the Cargo.toml to get the IDL version, this is a post-release timing issue that keeps the IDL version to the previous one until it gets regenerated?

No not quite, this bumps the IDL version to the new / correct version after the crate is released. Currently, every time we bump the interface crate version, we immediately get CI failures because the IDL version is out of sync. This will make it so we avoid that extra manual step every time.

Unless the better option is to perform a post-bump step to re-run codama to pick up the newest version and commit it?

@kskalski

Copy link
Copy Markdown
Contributor Author

We could also run the full script as pre-release-hook, but I think the necessary plumbing is not worth it. At least as long as we are sure the full script only updates those release lines that the replacement catches.

@lorisleiva

Copy link
Copy Markdown
Member

Unless the better option is to perform a post-bump step to re-run codama to pick up the newest version and commit it?

That would have been my go-to solution yeah but I'm not sure how feasible it is to add this post-bump step to the Rust pipeline.

@lorisleiva

Copy link
Copy Markdown
Member

I think the necessary plumbing is not worth it

I don't disagree but I'm also not a fan of the fact that we end up with two places to check when it comes to IDL generation. But again I'm not sure how complex that plumbing is in Rust so happy with the current solution is the trade-off is not worth it.

@kskalski

Copy link
Copy Markdown
Contributor Author

Seems like it will boil down to something like this

[package.metadata.release]
pre-release-hook = ["sh", "-c", '[ "$DRY_RUN" = true ] || make -C "$WORKSPACE_ROOT" generate-idl-interface']

and the cost will be that the release pipeline needs to install the necessary tools... I agree this is cleaner, so let me prepare this one.

@joncinque

Copy link
Copy Markdown
Contributor

We can avoid PRs like #572 if we land this, sooo anytime!

@kskalski
kskalski force-pushed the ks/release_idl_version branch from fd0effd to 0561e3b Compare October 2, 2026 07:18
@kskalski
kskalski requested a review from joncinque October 2, 2026 07:24
Problem
The release bumps `interface/Cargo.toml` without touching the IDL files, so the IDL job fails after every release until someone regenerates them.

Summary of Changes
- regenerate both IDL files from a cargo-release pre-release hook, skipping dry runs
- enable the shared workflow's `pnpm` input, since the hook needs pnpm
- regenerate the IDL files for 5.1.1, since the last release left them at 5.1.0

Testing
Ran `cargo release minor --execute --no-publish --no-push --no-tag` on a scratch branch, from the repo root and from `interface/`, and checked that each release commit carries both regenerated IDL files at the new version.
@kskalski
kskalski force-pushed the ks/release_idl_version branch from 0561e3b to 77155c7 Compare October 2, 2026 09:33

@joncinque joncinque left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested and confirming this works, thanks!

@kskalski
kskalski merged commit e32051c into solana-program:main Oct 2, 2026
26 checks passed
@kskalski
kskalski deleted the ks/release_idl_version branch October 2, 2026 14:19
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.

3 participants