feat(spec): add ValueEnum aliases and case matching - #1040
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4c0be60. Configure here.
Instruction countsNothing was compared, and so nothing was gated. No series appears on both sides: either the base has no measurements recorded, or the two were measured on different runner classes, which are deliberately not comparable — counts shift between machine types by more than a real regression does. New, nothing to compare against: Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes. Shadow comparisonParsing
|

Summary
#[derive(ValueEnum)]variants#[usage(ignore_case)]matching for canonical words and aliasesTest plan
cargo test -p usage-conformance --test typedcargo clippy --workspace --all-features -- -D warningsReady for review.
Note
Medium Risk
Changes which argv tokens parse for
value_enumfields (aliases and optional case folding), though scope is limited to derived enums and conformance tests cover the behavior; diagnostics intentionally stay on canonical choices only.Overview
Extends the PossibleValue /
ValueEnumstory on the Rust derive path: enums can declare#[usage(alias = "...")]on variants and#[usage(ignore_case)]on the type. Parsing andFromStraccept the expanded vocabulary (aliases and, when enabled, ASCII case-insensitive canonical names and aliases);InvalidChoiceand emittedchoicesstill list only canonical words, matching the Go side’s split between accepted vs visible lists.Runtime:
ValueEnumgainsACCEPTED_CHOICESandIGNORE_CASE, plus sharedchoice_matches. Generatedchecklogic uses accepted choices for validation but canonicalCHOICESin error messages.Derive:
ValueEnummodeling is refactored toValueVariant(name + aliases); compile-time checks reject empty aliases and duplicate names/aliases (with case folding whenignore_caseis set). Docs and PLAN.md note Rust alias/case support; per-value help and hidden-value metadata in Rust remain outstanding.Reviewed by Cursor Bugbot for commit 7987267. Bugbot is set up for automated code reviews on this repo. Configure here.