fix(parse): dedupe required flag validation errors#685
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesRequired-flag deduplication for aliased flags
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 SummaryThis PR fixes a bug where a required flag with multiple aliases (e.g.,
Confidence Score: 5/5Safe to merge — the change is minimal, correctly scoped, and the deduplication logic aligns with how merged/inherited flags are already handled elsewhere in the same file. The fix is a single well-understood iterator adapter. Pointer identity via No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "fix(parse): dedupe required flag validat..." | Re-trigger Greptile |
Summary
Root cause
available_flagsstores one entry per lookup token, such as-nand--name, and both entries point at the sameSpecFlag. Required-flag validation iterated the map values directly, so a missing required flag with multiple aliases emitted the same error once per alias.Validation
cargo fmt --all -- --checkcargo test -p usage-libcargo test --all --all-featuresThis PR was generated by an AI coding assistant.
Note
Low Risk
Small, localized change to validation error reporting in parse; no change to successful parse behavior or auth/data paths.
Overview
Fixes duplicate
Missing required flagerrors when a required flag registers both short and long aliases inavailable_flags(each alias points at the sameArc<SpecFlag>).Adds
unique_flags, which walks flag values once per logical flag viaArcpointer identity, and uses it in the partial-parse required-flag check instead of iterating every map entry.Adds regression coverage for
flag "-n --name <name>" required=#trueso a missing value yields a single error message.Reviewed by Cursor Bugbot for commit 5450e16. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit