Skip to content

fix(derive): separate value metadata from parsing - #1054

Merged
jdx merged 6 commits into
agent/spec-unknown-flagsfrom
agent/value-enum-from-str
Aug 19, 2026
Merged

fix(derive): separate value metadata from parsing#1054
jdx merged 6 commits into
agent/spec-unknown-flagsfrom
agent/value-enum-from-str

Conversation

@jdx

@jdx jdx commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Stack created with GitHub Stacks CLIGive Feedback 💬


Note

Medium Risk
Behavior changes for enums that relied on derived FromStr without an explicit impl (compile failures until fixed); cfg-aware duplicate detection is heuristic and could mis-allow or mis-reject edge cases.

Overview
ValueEnum is metadata-only. The derive no longer emits impl FromStr; types must supply their own parser, like other typed fields. Help, completions, and choice checks still read the static CHOICES / alias tables from the ValueEnum trait impl.

Cfg-gated variants are allowed. Variant cfg / cfg_attr gates are copied onto static table entries instead of being rejected, and duplicate CLI words are permitted when the variants’ cfg predicates are disjoint (e.g. #[cfg(windows)] vs #[cfg(not(windows))]).

Call sites and tests add hand-written FromStr implementations (lint’s OutputFormat, conformance Interpreter, facade Shell, etc.). PLAN.md marks the fleet launch-gate item for ValueEnum + domain parsing as done.

Reviewed by Cursor Bugbot for commit 704bc20. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 83f2b12d-b434-4e9a-847c-a76ba822c52a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread derive/src/model.rs
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Instruction counts

benchmark trend instructions Δ wall (min) Δ
markdown ▂▂▃▂▂▃▃▃▁█▇█▇ 198,800,919 → 198,756,571 -0.02% 18.77 → 18.44ms -1.76%
startup ▁▁▁▁▁▁▁▁▁████ 1,214,930 → 1,214,960 +0.00% 1.25 → 1.27ms +1.72%

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 comparison

Parsing mise use -g node@20 against a shadow of mise's committed spec.
Reported, not gated: the shadow grows as the derive learns to express more, so
what to watch is the ratio rather than either column.

framework instructions, cold parse vs usage
usage 4253
argh 6292 1.5x
clap 5893640 1385x
bpaf 21917948 5153x
                                              min       p01       p10    median
usage-rs: argv -> struct                      188       191       194       199  ns
argh: argv -> struct                          272       277       281       288  ns
clap: build tree + parse -> struct         484328    486430    489046    495484  ns
bpaf: build parser + parse -> struct      1591424   1591424   1599070   1609130  ns

usage: argv -> struct                             200 ns      0.20 µs
clap: build tree + parse -> struct             492941 ns    492.94 µs
clap: parse -> struct, tree reused              23085 ns     23.09 µs
clap: build tree only                          307740 ns    307.74 µs

704bc20743e9 vs 93ea42d8d54e · measured on the runner, not pushed to the history.

@jdx
jdx force-pushed the agent/value-enum-from-str branch from faba255 to d84c11a Compare August 19, 2026 03:35
Comment thread usage-rs/tests/facade.rs
Comment thread derive/src/model.rs
@jdx
jdx force-pushed the agent/value-enum-from-str branch from eadb8dc to 5ff8b94 Compare August 19, 2026 14:02
@jdx
jdx force-pushed the agent/value-enum-from-str branch from 5ff8b94 to 2dec7c1 Compare August 19, 2026 14:09
Comment thread derive/src/codegen.rs

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1334ea7. Configure here.

Comment thread derive/src/model.rs
@jdx
jdx force-pushed the agent/value-enum-from-str branch from 1334ea7 to 704bc20 Compare August 19, 2026 14:51
@jdx
jdx merged commit bb6e10a into main Aug 19, 2026
10 checks passed
@jdx
jdx deleted the agent/value-enum-from-str branch August 19, 2026 16:59
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.

1 participant