Skip to content

Remove ci/check_variants.py - #4549

Merged
alex merged 1 commit into
mainfrom
claude/drop-check-variants
Nov 7, 2026
Merged

alex merged 1 commit into
mainfrom
claude/drop-check-variants

Conversation

@alex

@alex alex commented Nov 7, 2026

Copy link
Copy Markdown
Member

This answers your question on #4536: with dispatch in verified code, we don't need check_variants any more.

What it still checked, and why that isn't worth a check

  • Every caller of a function with variants has a variant for each. Generic registrations already give this by construction: a caller in Generic/<Iface>/… is emitted for every variant of its interface, and the generated dispatcher runs the best one. The check could only catch a hand-written caller that calls the baseline. That costs speed, never correctness, and CLAUDE.md keeps the rule ("Never add a caller that calls only the baseline implementation").
  • Every variant is used. A combination nothing chooses is dead code: size, not correctness.

Its upkeep was the problem: name-based heuristics (internal functions' families, qualified parts, aliases) and exceptions (NEVER_WITH) kept growing.

Changes

  • Deletes ci/check_variants.py and ci/test_check_variants.py, its Static checks step, and its rows in ci/README.md.
  • Removes NEVER_WITH from CLAUDE.md, and the skill section on the script from adding-a-primitive.
  • Rewords comments that cited it:
    • VerifiedGarbageTest/Dispatch.lean, whose ranking guards stay;
    • Proof/MlKem1024/Contract.lean and Proof/Weierstrass/Point0Contract.lean (comments only, so their importers rebuild once in CI).

Follow-ups

  • A small TCB PR: internal functions' _FEATURES constants (Rust.internalFile) exist only for this script. With it gone they have no users, so the emitter should stop writing them.
  • x86-64 GCM-SIV still emits 10 instances its dispatcher never chooses. Removing them is a separate cleanup.

Checks

Every remaining Static checks step passes. The edited Lean modules build.


Generated by Claude Code

Dispatch is now verified code: each function's generated dispatcher runs
the best implementation the CPU supports, and a generic caller is emitted
for every variant of what it calls without anyone listing it. What the
script still checked, from the names of the generated functions, is that
no hand-written caller calls only a baseline implementation and that no
combination of variants goes unused: speed and code size, never
correctness, at the cost of exceptions of its own (`NEVER_WITH`, the
handling of qualified names and aliases). CLAUDE.md keeps the rule that
callers are generic over the variants of what they call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHE2dqL6Q2PDogxfD5f
@alex
alex added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit daf7be3 Nov 7, 2026
47 checks passed
@alex
alex deleted the claude/drop-check-variants branch November 7, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants