fix(parse): align negative values across parse phases - #1318
Conversation
|
Warning Review limit reachedNext included review available in 23 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
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 |
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
|
Summary
external_subcommanddiscovery from consuming a required flag's negative value--apps -1withexternal_subcommandFollow-up to #1317 and its final review feedback.
Testing
cargo test -p usage-lib --all-featurescargo fmt --all -- --checkThis pull request was generated by Codex.
Note
Medium Risk
Changes core CLI argument parsing semantics for flags, optional values, and external subcommand discovery; incorrect rules would mis-bind arguments or break clap-aligned edge cases.
Overview
Unifies when a flag may consume the next token by introducing
accepts_detached_flag_valueand using it everywhere detached values are decided (prefix forwarding,allow_hyphen_values, optional/default-missing binding, and pending-flag binding) instead of duplicatedis_flag_like/ negative-number checks.Tightens negative detached values for optional flags: tokens like
-1are only taken as a detached value whenallow_negative_numbersis set, or when the flag has a required value (nodefault_missingand notvalue_optional). That keeps optional/default_missingflags from swallowing-1during subcommand discovery while still allowing required flags and explicitallow_negative_numbers.Skips the early hyphen-value path when
attached_continuationis set, so attached short-bundle continuations are not mis-handled.Adds a regression test for
external_subcommandwith--apps -1so-1binds to the flag instead of being treated as external input.Reviewed by Cursor Bugbot for commit e1a7e82. Bugbot is set up for automated code reviews on this repo. Configure here.