fix(spec): split a clap default by the delimiter clap splits it by - #901
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 |
Greptile SummaryThe PR aligns generated usage-spec defaults with clap’s declared value delimiter.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (4): Last reviewed commit: "fix(spec): split a clap default by the d..." | Re-trigger Greptile |
Instruction counts
No instruction-count regression above 1%. 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
|
815779e to
0385fa6
Compare
0385fa6 to
ebd28db
Compare
`value_delimiter = ','` means clap splits every value before anyone sees it, defaults included — so `default_value = "a,b,c"` is three values and never the joined string. The conversion recorded the string. mise's `--fs-events` is where it shows: `default_value = "create,remove,rename,modify, metadata"`, a `value_parser` listing exactly those words as its choices, and a spec that came out declaring a default its own `choices` node forbids. Nothing read it strictly enough to complain, which is the only reason it went unnoticed; a reader that does check — and the derive now does — refuses the CLI outright. The spec has no delimiter of its own. It has a list, which says the same thing, so the fix is to write the list. Only where clap declares a delimiter: `"a,b"` without one is a value containing a comma, and splitting on speculation would corrupt every path list. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ebd28db to
5cd2095
Compare
value_delimiter = ','means clap splits every value before anyone sees it, defaults included — sodefault_value = "a,b,c"is three values and never the joined string. The conversion recorded the string.mise's
--fs-eventsis where it shows:and the spec that came out:
A default its own
choicesnode forbids. Nothing read it strictly enough to complain, which is the only reason it went unnoticed; a reader that does check — and the derive on top of this stack now does — refuses the CLI outright.The spec has no delimiter of its own. It has a list, which says the same thing, so the fix is to write the list. Only where clap declares a delimiter:
"a,b"without one is a value containing a comma, and splitting on speculation would corrupt every path list.Verification
Built mise against this branch and regenerated its spec;
--fs-eventscomes out asevery word one of the declared choices.
benches/mise.usage.kdlis updated to that, in the commit above it, since that is where the shadow reads it.Mutation: ignoring the delimiter fails
a_delimited_default_becomes_the_values_clap_would_split_it_into. 404 lib tests green.AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: unavailable.
Note
Low Risk
Narrow change to clap-to-spec metadata conversion with a targeted test; no runtime CLI parsing behavior in this PR.
Overview
Clap → spec conversion now records defaults the way clap actually applies them: when an arg has a
value_delimiter, default strings are split into multiple spec default entries instead of one joined string.A shared
default_valueshelper drives bothSpecArgandSpecFlagclap bridges, fixing cases like delimited multi-value flags whose recorded default violated their ownchoices(e.g. mise--fs-events). Without a delimiter, defaults stay a single string (commas preserved).A regression test covers delimited vs non-delimited behavior.
Reviewed by Cursor Bugbot for commit 5cd2095. Bugbot is set up for automated code reviews on this repo. Configure here.