ci(candid): exclude no-compat debug endpoints from backward-compat check - #217
Draft
gregorydemay wants to merge 1 commit into
Draft
ci(candid): exclude no-compat debug endpoints from backward-compat check#217gregorydemay wants to merge 1 commit into
gregorydemay wants to merge 1 commit into
Conversation
The candid-backward-compat gate ran `didc check` over the full interface, so adding a variant to a type reachable only through the debug `get_events` endpoint (documented with no backwards-compatibility guarantee) tripped the check and forced the `candid-breaking-change` label plus a `!` title on PRs that were not actually breaking. Introduce `canister/no_compat_endpoints.conf` (mirroring the existing `hidden_endpoints.conf` pattern) listing service methods that carry no compat guarantee. The CI job strips each listed method declaration from both the base and head `.did` before `didc check`; stripping a method makes its exclusive transitive types unreferenced, and `didc check` ignores unreferenced types, so debug-only changes no longer gate the PR. Verified against the PR #208 scenario: the full check fails on the new `RemoveTradingAccount` event variant (reachable only via `get_events`), while the stripped check passes.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the CI candid backward-compatibility gate to ignore explicitly “no-compat” (debug) endpoints by stripping those service method declarations from both the base and head .did files before running didc check, preventing debug-only type changes from being treated as breaking.
Changes:
- Added
canister/no_compat_endpoints.confto enumerate service methods excluded from the compat gate (starting withget_events). - Added
scripts/strip_candid_methods.pyto strip configured method declarations from theservice { ... }block of a.did. - Updated
.github/workflows/ci.ymlto run the stripping step on both base and head interfaces prior todidc check.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
scripts/strip_candid_methods.py |
New helper to remove configured service methods from .did output used by CI. |
canister/no_compat_endpoints.conf |
New configuration list of “no compat guarantee” endpoints to exclude from the compat check. |
.github/workflows/ci.yml |
Adjusted candid-backward-compat job to compare stripped interfaces instead of raw .did files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+64
to
+77
| if skip_depth > 0: | ||
| skip_depth += bracket_delta(line) | ||
| if skip_depth <= 0: | ||
| skip_depth = 0 | ||
| continue | ||
|
|
||
| m = name_re.match(line) | ||
| if m and m.group(1) in names: | ||
| skip_depth = bracket_delta(line) | ||
| # A declaration whose brackets balance on the opening line still | ||
| # ends with `;` on that same line — drop it entirely. | ||
| if skip_depth == 0: | ||
| continue | ||
| continue |
Contributor
|
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.
Purpose
Excludes debug endpoints (no backwards-compatibility guarantee) from the
candid-backward-compatCI gate, so that adding e.g. a new event variant toEventType— reachable only through the debugget_eventsendpoint — no longer forces thecandid-breaking-changelabel and a!title on PRs that are not actually breaking.Addresses the side-note in #208 (comment).
What changed
canister/no_compat_endpoints.conf— lists service methods that ship with no compat guarantee (mirrors the existinghidden_endpoints.confpattern). Starts withget_events.scripts/strip_candid_methods.py— strips the listed method declarations (service-block scoped, bracket-depth aware) from a.did, writing the stripped interface to stdout. Stripping a method makes its exclusive transitive types unreferenced, anddidc checkignores unreferenced types..github/workflows/ci.yml— thecandid-backward-compatjob now strips both base and head.didvia the script before runningdidc check.Verification
Verified against the PR #208 scenario (base = before #208, head = after #208, which added the
RemoveTradingAccountevent variant reachable only viaget_events):didc check(current behaviour) → fails on the new variant.didc check(this PR) → passes.The legitimate
didcwarning on the stable interface (the additiveRateLimitleaf onAddTradingAccountError) still surfaces — only the debugget_eventsscope is removed.