feat: collect all subtype errors in compatibility check + release 0.10.27#725
Merged
feat: collect all subtype errors in compatibility check + release 0.10.27#725
Conversation
The compatibility check previously stopped at the first incompatibility,
forcing users to fix-and-retry in a loop. Now it collects every breaking
change and renders them as a grouped, hierarchical report:
method "transfer":
input type:
record field amount: nat is not a subtype of text
return type:
record field ok: text is not a subtype of bool
record field balance: text is not a subtype of nat
method "get_user":
- missing in new interface
Key changes:
- Add `subtype_check_all` / `Incompatibility` struct in subtype.rs
- Add `format_report` for hierarchical grouped display
- Add `service_compatibility_report` in candid_parser utils
- Update `didc check` and didjs UI to show full report
- 29 new tests covering compatible passes, incompatible catches,
multi-error collection, error message quality, and formatting
- 29 tests → 18: dropped redundant tests, folded table-driven cases - Fixed buggy test (compatible_add_variant_case_in_return tested identity) - DRY: table-driven helpers for compatible/incompatible pass/fail checks - Added missing coverage: vec element type, multi-arg functions, mixed compatible+incompatible methods, service_compatible vs report agreement, pathless errors in format_report, remove field from input record - Every test now asserts something the others don't
Click to see raw report |
There was a problem hiding this comment.
Pull request overview
This PR enhances the Candid service compatibility/subtyping workflow so it reports all incompatibilities in one pass (with a hierarchical, grouped report), and wires that reporting into CLI/UI consumers while adding parser-level helpers and test coverage.
Changes:
- Add
Incompatibility,subtype_check_all(), andformat_report()to collect and render all subtype incompatibilities. - Add
service_compatibility_report()incandid_parserand updatedidc check+ web UI to display the new report. - Add extensive compatibility/report-formatting tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/ui/src/didjs/lib.rs | Switch UI subtype check to collect all incompatibilities and display formatted report. |
| tools/didc/src/main.rs | Update didc check to print grouped incompatibility report and fail with breaking-change summary. |
| rust/candid/src/types/subtype.rs | Implement incompatibility collection + hierarchical report formatting and expose new public APIs. |
| rust/candid/src/types/internal.rs | Adjust internal TypeId ID computation casting. |
| rust/candid_parser/src/utils.rs | Add service_compatibility_report() helper returning all incompatibilities. |
| rust/candid_parser/tests/compatibility.rs | Add new tests validating compatibility detection, message/path quality, and report formatting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Three tests covering the contravariant (input type) path for record field missing, variant case removed, and arg-count mismatch error messages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Thread `is_input: bool` through `subtype_collect_` so record and variant error messages correctly identify which side is missing a field/case in the contravariant (function input) checking path. Also fix the swapped old/new arg-count values in the `check_func_params` input branch. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lwshang
approved these changes
Apr 8, 2026
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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.
Release
candid0.10.27candid_parser0.3.1didc0.6.1Summary
subtype_check_all(),Incompatibility,format_report()incandid;service_compatibility_report()incandid_parser.Before (stops at first error)
After (all errors, grouped by method)
Changes
rust/candid/src/types/subtype.rsIncompatibilitystruct,subtype_check_all(),format_report(), internalsubtype_collect_()rust/candid_parser/src/utils.rsservice_compatibility_report()tools/didc/src/main.rsdidc checkuses new reporttools/ui/src/didjs/lib.rsrust/candid_parser/tests/compatibility.rsTest plan