fix(parser): reject ambiguous semantic signatures - #20
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 4:27 AM ET / 08:27 UTC. ClawSweeper reviewWhat this changesThe PR rejects duplicate argument, option, and flag labels plus required positional arguments declared after optional ones, and documents four new typed validation errors. Merge readinessKeep open for normal owner review. No patch defect was found; merging intentionally expands the public Priority: P2 Review scores
Verification
How this fits togetherCommander flattens command and option-group definitions into a signature used by both direct parsing and program-level routing. Validation runs before tokens are consumed, returning typed errors for invalid definitions. flowchart LR
A[Command definitions] --> B[Flattened signature]
B --> C[Signature validation]
C --> D{Definition valid?}
D -->|Yes| E[Parser or program routing]
D -->|No| F[Typed validation error]
Decision needed
Why: The implementation is coherent, but accepting a public enum expansion is an API-versioning choice that automated review cannot make. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land this as the documented 0.3.0 breaking API change, with downstream consumers updating exhaustive Do we have a high-confidence way to reproduce the issue? Yes—current parsing stores options by label, so differently spelled definitions sharing a label converge on one output key, and optional-before-required positionals cannot be bound unambiguously by position. Is this the best way to solve the issue? Yes for the validation defect: placing the checks in the flattened shared signature index covers direct parsing and Program routing. The remaining question is acceptance of the public 0.3.0 error-enum expansion. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 756cfce9a127. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Summary
CommanderErrorcases as part of the existing 0.3.0 breaking trainProof
Downstream exhaustive switches must add the four documented cases.
CommanderProgramErroris unchanged.