From f3274fb894e88834fa7052dea00eddc92a73cd9c Mon Sep 17 00:00:00 2001 From: ilbertt Date: Mon, 14 Jul 2025 08:55:20 +0200 Subject: [PATCH 1/4] fix: report special opt rule as warning instead of error --- src/dfx/src/lib/models/canister.rs | 2 +- src/dfx/src/lib/operations/canister/install_canister.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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()), From c7c902e2cdb63b034d4b1722e7bdfcf42f396c50 Mon Sep 17 00:00:00 2001 From: ilbertt Date: Mon, 14 Jul 2025 14:39:54 +0200 Subject: [PATCH 2/4] chore: update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39541c7631..5f566c9652 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 old Candid declaration is a subtype of the new 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 From 3b0179b92f928030ccdb2349746e799fb6501fd5 Mon Sep 17 00:00:00 2001 From: ilbertt Date: Mon, 14 Jul 2025 14:44:40 +0200 Subject: [PATCH 3/4] chore: update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f566c9652..8c91d9853b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ Added `dfx canister snapshot download` and `dfx canister snapshot upload` comman ### fix: dfx now warns when encountering a special opt rule -dfx now shows warnings when the old Candid declaration is a subtype of the new Candid declaration via a special opt rule, instead of throwing an error. +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 From 9d791f13d9f8ac9aad6145d65051b1193deeb4f4 Mon Sep 17 00:00:00 2001 From: ilbertt Date: Mon, 14 Jul 2025 15:37:56 +0200 Subject: [PATCH 4/4] test: update assertion --- e2e/tests-dfx/upgrade_check.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 \"\")"