fix: ic-cdk-bindgen v0.2.1 — escape service type method names in generated bindings - #713
Merged
Merged
Conversation
…rated bindings Upgrades `candid_parser` to v0.4.1, which escapes the method names of a service type when generating the Rust bindings. Previously such a name was emitted raw between the quotes of a Rust string literal, so a name containing characters that are legal in Candid text but significant in Rust produced incorrect generated code. Also raises the minimum `candid` version to v0.10.28, which `candid_parser` v0.4 requires to compile but declares as v0.10.16. Without this, a consumer with an older candid in their lockfile resolves to a combination that fails to build. Generated bindings are byte-identical for `.did` files whose service-type method names are ordinary identifiers. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
lwshang
marked this pull request as ready for review
August 14, 2026 14:15
|
✅ No security or compliance issues detected. Reviewed everything up to 84c0b94. Security Overview
Detected Code Changes
|
adamspofford-dfinity
approved these changes
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Upgrades
candid_parserto v0.4.1, which escapes the method names of a service type when generating the Rust bindings. Previously such a name was emitted raw between the quotes of a Rust string literal, so a name containing characters that are legal in Candid text but significant in Rust produced incorrect generated code. Fixed upstream in dfinity/candid#759.Also raises the minimum
candidversion to v0.10.28.candid_parserv0.4 needs it to compile but declares v0.10.16, so without this a consumer with an older candid pinned in their lockfile resolves to a combination that fails to build. The proper fix belongs incandid_parser's manifest; this keeps the upgrade path working in the meantime.This PR also releases ic-cdk-bindgen v0.2.1 (version bumps in the workspace + crate manifests and the corresponding CHANGELOG entry).
How Has This Been Tested?
management_canister.rs,bindgen_callee.rs) are byte-identical before and after the upgrade, confirming no codegen change for ordinary.didfiles.ic_cdk_bindgen::Config::generate()pipeline from a.didwhose service-type method names need escaping, and confirmed the output is well-formed.candidverified empirically: v0.10.26 fails to compile, v0.10.28 builds (v0.10.27 is yanked).cargo check --workspace --all-targets,cargo fmt --checkandcargo clippy --workspace --all-targets -- -D warningsare clean; the workspace test suite passes.Checklist:
🤖 Generated with Claude Code