fix(#1224): accept --pr 0 placeholder at changeset creation (#1231)

* fix(#1224): accept --pr 0 placeholder at changeset creation

The required-field guard `!opts.pr` treated the integer 0 as falsy,
rejecting the documented `pr: 0` two-push placeholder with a usage
error (exit 2). Non-numeric `--pr abc` (NaN) was also silently
accepted before (passes `!NaN === true`... actually `!NaN` is true, so
NaN would trigger the guard already). The new explicit checks use
`opts.pr === null` for missing flag and `Number.isNaN` for non-numeric
input, accepting all finite integer values including 0.

The merge-time safety net in parse.cjs (`pr <= 0` → INVALID_PR) is
unchanged — a pr:0 fragment is still rejected at lint/render time.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore(#1224): backfill changeset PR number (#1231)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-06-14 15:02:54 -04:00
committed by GitHub
parent 15fbdf6879
commit cafb874c4a
3 changed files with 109 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
type: Fixed
pr: 1231
---
**`changeset new --pr 0` now accepted at creation** — the required-field guard treated the integer 0 as a missing `--pr` flag, so the documented `pr: 0` placeholder could not be authored via the CLI. (#1231)