Fix CLI positional argument overflow#6561
Conversation
🦋 Changeset detectedLatest commit: ec442eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughCLI parsing now preserves leftover tokens during shared and context parsing, while top-level parsing reports unconsumed positional arguments with a new ChangesCLI unexpected argument handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Comment |
|
I think this is the behavior that we want / expect, no? |
a37ceff to
4bda315
Compare
Just to clarify, are you asking if the original behaviour was correct? The core problem here is that the original implementation was silently dropping user input - especially when a Codex also states that the v3 @effect/cli implementation did fail this case with a |
4bda315 to
ec442eb
Compare
Bundle Size Analysis
|
A positional variadic with a
maxstopped consuming values once it reached the limit, but any remaining operands were ignored after parsing finished.For example:
Running:
previously succeeded with
["a.txt", "b.txt"]and silently discardedc.txt. It now fails with:The fix rejects positional operands left over after the complete command has been parsed.
Variadics can still pass operands to positional arguments declared after them, so this remains valid:
Partial parsing for shared flags and parent command context also continues to preserve operands, since those may belong to the active command or subcommand.
This PR was raised with the help of Codex ( GPT-5.6-Sol-high )
Summary by CodeRabbit