fix(derive): three more descriptions a spec keeps and the derive lost - #861
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 improves description fidelity in generated CLI metadata.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (4): Last reviewed commit: "fix(derive): keep a short-only flag's va..." | Re-trigger Greptile |
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 9ea3f1a. Configure here.
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
|
Found while starting on `--help`, which reads the long forms the short one does not. A variant's short description was hiding the struct's long one. `meta_overrides` chose both from the variant when the variant had *either*, so the shape every generated CLI has — the enum says what a command is for in a line, the struct's own comment carries the detail — lost the detail entirely. Each falls back on its own now. A doc comment's lines were trimmed one by one, which flattened every indented block in a CLI's help. An indented block is how a spec shows a command to type, and mise's help is full of them. Only the single space `///` conventionally adds is stripped now, and trailing space. A program could not describe itself twice over. A comment's long form always contains its short one, because the short form *is* the comment's first paragraph — where a spec keeps `about` and `about_long` independent, and mise's are entirely different sentences. `#[usage(about = …, long_about = …)]` declares them, and the generator uses it when a comment cannot say both. The `--help` layout these were found by is written but not yet at parity — 123 of 211 pages still differ, each remaining cause another metadata path where the shadow's description is not the spec's. It is held back rather than shipped wrong, and the plan says so. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…'s about Two findings from Cursor Bugbot, both regressions from this stack. A flag is named after the form it answers to, and for a short-only flag that form is one character — right for the flag's name and useless as the name of its *value*, since help and the KDL both fall back to `flag.name` for the placeholder. `-j <j>` where the field is called `jobs`. The descriptive name is kept as the value name before the flag's own is overwritten. And when a program's two descriptions are independent, the generator skipped the root's doc comment and wrote them into the *usage* attribute list only — which the clap dialect never emits, so the clap shadow stopped describing the program at all. clap takes an independent `about` and `long_about`, and a fixture for comparing two frameworks cannot have one of them missing the CLI's own description. Both mutation-checked. `-h` parity is unchanged at 211 of 211, which is what says the value-name fix did not move the rendering. Two older findings on #854 were already answered by the `demanded`/`flag_demanded` helpers: a defaulted argument or flag is one the parser fills, so the usage line brackets it as optional. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Found while starting on
--help, which reads the long forms the short one does not.A variant's short description was hiding the struct's long one.
meta_overrideschose bothfrom the variant when the variant had either, so the shape every generated CLI has — the enum
says what a command is for in a line, the struct's own comment carries the detail — lost the
detail entirely. Each falls back on its own now.
A doc comment's lines were trimmed one by one, which flattened every indented block in a CLI's
help. An indented block is how a spec shows a command to type, and mise's help is full of them.
Only the single space
///conventionally adds is stripped now, and trailing space.A program could not describe itself twice over. A comment's long form always contains its short
one, because the short form is the comment's first paragraph — where a spec keeps
aboutandabout_longindependent, and mise's are entirely different sentences.#[usage(about = …, long_about = …)]declares them, and the generator uses it when a comment cannot say both.The
--helplayout these were found by is written but not yet at parity — 123 of 211 pagesstill differ, each remaining cause another metadata path where the shadow's description is not
the spec's. It is held back rather than shipped wrong, and the plan says so.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Stack created with GitHub Stacks CLI • Give Feedback 💬
Note
Low Risk
Cold-path help/spec metadata and test fixtures only; parsing and
-hparity (211/211) are unchanged.Overview
Fixes three metadata round-trip gaps in
usage-derivethat showed up while chasing--helpparity with usage-lib (still held back at 123/211 pages).Subcommand help:
meta_overridesno longer drops a struct’s long description when the enum variant only supplies a short one—short and long now fall back independently, matching the usual “variant line + struct detail” layout.Doc comments:
doc_commentstops trimming each///line, so indented examples in long help keep their spacing.Root
about/about_long: Adds#[usage(about = …, long_about = …)]when the two strings are not the first-paragraph relationship doc comments force. Shadow generation (xtask) emits the same attributes for usage and clap fixtures; mise shadows pick up explicit about text.Conformance tests cover the split-description fixture; PLAN.md records the fixes and that full
--helplayout is not shipped yet.Reviewed by Cursor Bugbot for commit 3c6fc19. Bugbot is set up for automated code reviews on this repo. Configure here.
How these were found
By starting on
--help. The wider layout reads the long form of every description, which theshort form never touches — so three more places where a spec says something the derive could not
keep surfaced at once.
meta_overrideschose both from the variant when it had either. That is the shape every generated CLI has — the enum names the command in a line, the struct's comment carries the detail — so the detail was lost for all of themaboutandabout_longindependent, and mise's are entirely different sentencesWhat is not here
The
--helprenderer itself. It is written, and it is at 123 of 211 pages differing — eachremaining cause another metadata path where the shadow's description is not the spec's. Shipping
a public
long_helpthat is wrong on more than half of a real CLI's pages would be worse thannot shipping it, so it is held back and the plan records the count rather than the intention.
The three fixes above stand on their own: they are round-trip fidelity, which docs, manpages,
completions and the SDK generators all read.
Verification
on the struct, an indented example inside it, and a program whose two descriptions differ.
-hparity is unaffected and still 211 of 211, which is the guard against these fixeschanging the short form.
AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: unavailable.