Skip to content

fix(setKey): use a sentinel to detect count auto-increment#529

Open
SAY-5 wants to merge 1 commit into
yargs:mainfrom
SAY-5:fix/count-sentinel
Open

fix(setKey): use a sentinel to detect count auto-increment#529
SAY-5 wants to merge 1 commit into
yargs:mainfrom
SAY-5:fix/count-sentinel

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 13, 2026

Copy link
Copy Markdown

The TypeScript conversion changed value === increment (function reference used as a sentinel) to value === increment() (which returns 1), so any later occurrence of a non-count argument with value 1 is incorrectly incremented onto the previous value (parser('-x 3 -x 1') returns { x: 4 } instead of { x: [3, 1] }). Restored the original semantics with a Symbol sentinel that flows from processValue to setKey.

Closes #506

@shadowspawn

Copy link
Copy Markdown
Member

To be clear: is this PR entirely AI/LLM generated?

@SAY-5

SAY-5 commented May 18, 2026

Copy link
Copy Markdown
Author

No. I traced the regression from #506 myself, confirmed the sentinel-reference behavior change in git history, and verified the Symbol fix against the failing case with the added test. Happy to walk through any part of the reasoning.

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.

Multiple arguments are incremented if they are equal to 1.

2 participants