diff --git a/CHANGELOG.md b/CHANGELOG.md index 39541c7631..8c91d9853b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/e2e/tests-dfx/upgrade_check.bash b/e2e/tests-dfx/upgrade_check.bash index 9b5068f460..4e9ea4b934 100644 --- a/e2e/tests-dfx/upgrade_check.bash +++ b/e2e/tests-dfx/upgrade_check.bash @@ -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 \"\")" diff --git a/src/dfx/src/lib/models/canister.rs b/src/dfx/src/lib/models/canister.rs index c00fa14f7f..9c4b759e91 100644 --- a/src/dfx/src/lib/models/canister.rs +++ b/src/dfx/src/lib/models/canister.rs @@ -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, diff --git a/src/dfx/src/lib/operations/canister/install_canister.rs b/src/dfx/src/lib/operations/canister/install_canister.rs index 3f7fd5331a..1928b3761d 100644 --- a/src/dfx/src/lib/operations/canister/install_canister.rs +++ b/src/dfx/src/lib/operations/canister/install_canister.rs @@ -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()),