Skip to content

Validate mutually exclusive groups in parse_known_args - #436

Merged
p-ranav merged 4 commits into
p-ranav:masterfrom
damnbrocrazy-svg:fix/parse-known-mutex-validation
Oct 2, 2026
Merged

p-ranav merged 4 commits into
p-ranav:masterfrom
damnbrocrazy-svg:fix/parse-known-mutex-validation

Conversation

@damnbrocrazy-svg

Copy link
Copy Markdown
Contributor

parse_known_args currently accepts conflicting members of mutually exclusive groups and allows required groups to remain unused. This shares the existing post-parse validation with parse_args so both public entry points enforce the same constraints, preserving exception text and validation order.

Adds regression coverage for optional and required groups, explicit use versus defaults, multiple groups, unknown-argument preservation, argc/argv and individual-argument error precedence. Addresses the top-level behavior in #400; subparser recursion is outside this change.

Validation: four new regression cases fail on the original header. With the patch, all 270 C++17 tests and 957 assertions pass on GCC13.2 for Windows UCRT; one existing test is skipped. The eight-case reproduction has no remaining behavior mismatch. Modules and std::format build variants were not exercised.

AI tools assisted implementation, test development and review. All reported tests were executed locally; the uploaded files match the tested sources.

@p-ranav
p-ranav merged commit 7d0c68b into p-ranav:master Oct 2, 2026
6 of 8 checks passed
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.

2 participants