Skip to content

ci(candid): exclude no-compat debug endpoints from backward-compat check - #217

Draft
gregorydemay wants to merge 1 commit into
mainfrom
chore/candid-debug-endpoint-exclusion
Draft

ci(candid): exclude no-compat debug endpoints from backward-compat check#217
gregorydemay wants to merge 1 commit into
mainfrom
chore/candid-debug-endpoint-exclusion

Conversation

@gregorydemay

Copy link
Copy Markdown
Contributor

Purpose

Excludes debug endpoints (no backwards-compatibility guarantee) from the candid-backward-compat CI gate, so that adding e.g. a new event variant to EventType — reachable only through the debug get_events endpoint — no longer forces the candid-breaking-change label 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 existing hidden_endpoints.conf pattern). Starts with get_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, and didc check ignores unreferenced types.
  • .github/workflows/ci.yml — the candid-backward-compat job now strips both base and head .did via the script before running didc check.

Verification

Verified against the PR #208 scenario (base = before #208, head = after #208, which added the RemoveTradingAccount event variant reachable only via get_events):

  • Full didc check (current behaviour) → fails on the new variant.
  • Stripped didc check (this PR) → passes.

The legitimate didc warning on the stable interface (the additive RateLimit leaf on AddTradingAccountError) still surfaces — only the debug get_events scope is removed.

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.
Copilot AI review requested due to automatic review settings July 9, 2026 08:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.conf to enumerate service methods excluded from the compat gate (starting with get_events).
  • Added scripts/strip_candid_methods.py to strip configured method declarations from the service { ... } block of a .did.
  • Updated .github/workflows/ci.yml to run the stripping step on both base and head interfaces prior to didc 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
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

canbench 🏋 (dir: canister) e530454 2026-07-09 08:22:05 UTC

canister/canbench_results.yml is up to date
📦 canbench_results_benchmark.csv available in artifacts

---------------------------------------------------

Summary:
  instructions:
    status:   No significant changes 👍
    counts:   [total 15 | regressed 0 | improved 0 | new 0 | unchanged 15]
    change:   [max 0 | p75 0 | median 0 | p25 0 | min -32]
    change %: [max 0.00% | p75 0.00% | median 0.00% | p25 0.00% | min -0.00%]

  heap_increase:
    status:   No significant changes 👍
    counts:   [total 15 | regressed 0 | improved 0 | new 0 | unchanged 15]
    change:   [max 0 | p75 0 | median 0 | p25 0 | min 0]
    change %: [max 0.00% | p75 0.00% | median 0.00% | p25 0.00% | min 0.00%]

  stable_memory_increase:
    status:   No significant changes 👍
    counts:   [total 15 | regressed 0 | improved 0 | new 0 | unchanged 15]
    change:   [max 0 | p75 0 | median 0 | p25 0 | min 0]
    change %: [max 0.00% | p75 0.00% | median 0.00% | p25 0.00% | min 0.00%]

---------------------------------------------------
CSV results saved to canbench_results.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants