Skip to content

fix: report special opt rule as warning instead of error #4319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

Added `dfx canister snapshot download` and `dfx canister snapshot upload` commands to download and upload the canister snapshot.

### fix: dfx now warns when encountering a special opt rule

dfx now shows warnings when the new Candid declaration is a subtype of the old Candid declaration via a special opt rule, instead of throwing an error.

# 0.28.0

### fix: deps deploy works with Canister ID out of the ranges of the pocket-ic subnets
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests-dfx/upgrade_check.bash
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ teardown() {
jq '.canisters.hello_backend.main="v4_bad.mo"' dfx.json | sponge dfx.json
echo yes | (
assert_command dfx deploy
assert_match "Candid interface compatibility check failed"
assert_match "FIX ME! opt text <: opt int via special opt rule."
)
assert_command dfx canister call hello_backend f '()'
assert_match "(opt \"\")"
Expand Down
2 changes: 1 addition & 1 deletion src/dfx/src/lib/models/canister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ fn check_valid_subtype(compiled_idl_path: &Path, specified_idl_path: &Path) -> D
let mut gamma = HashSet::new();
let specified_type = env.merge_type(env2, specified_type);
subtype_with_config(
OptReport::Error,
OptReport::Warning,
&mut gamma,
&env,
&compiled_type,
Expand Down
2 changes: 1 addition & 1 deletion src/dfx/src/lib/operations/canister/install_canister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ fn check_candid_compatibility(
.ok_or_else(|| anyhow!("Deployed did file should contain some service interface"))?;
let mut gamma = HashSet::new();
let old_type = env.merge_type(env2, old_type);
let result = subtype_with_config(OptReport::Error, &mut gamma, &env, &new_type, &old_type);
let result = subtype_with_config(OptReport::Warning, &mut gamma, &env, &new_type, &old_type);
Ok(match result {
Ok(_) => None,
Err(e) => Some(e.to_string()),
Expand Down