Repository navigation
fix(cli): a pi prerelease never passes the public version gate (F363) - #3798
Conversation
versionOf matched \b(\d+\.\d+\.\d+)\b, so a pi answering 0.84.1-rc.1 read as the tested 0.84.1 and a public seat would run the prerelease. The version now keeps its -prerelease suffix, so the gate refuses it before pi starts. The same fix as goose.js in #3430. A probe test with a fake pi answering the prerelease fails on the old code. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N4VWLCRBDAw5irQCF9SYye
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 32 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…c1 stays unknown (F363, review) The review of 96df619 found that dropping the old trailing \b widened the gate: 0.84.1rc1, 0.84.1a and 0.84.1_x read as 0.84.1 and passed, where main refused them as unknown. The boundary is back after the optional prerelease group; hyphen prereleases are still read in full. A probe test for 0.84.1rc1 fails without it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N4VWLCRBDAw5irQCF9SYye
lilyshen0722
left a comment
There was a problem hiding this comment.
GATE: PASS @ 5ad148b: the pi public gate refuses hyphen prereleases, and the trailing word boundary is back, so versions run into letters stay unknown
Verdict
Approve. The one review held at 96df619 on one Important finding. Commit 5ad148b fixes exactly that finding, and I re-checked it below.
Important (fixed in 5ad148b)
- cli/src/lib/adapters/pi.js:503: the new regex had dropped the old trailing
\b, so0.84.1a,0.84.1alpha,0.84.1rc1and0.84.1_xread as0.84.1and passedTESTED_PI_VERSIONS.includes(pi.js:798). On main, those same inputs read as unknown and were refused. The boundary is restored after the optional prerelease group.- Re-checked with
node -eover the same inputs. Old main and the fixed regex now agree on all four: null, refused.0.84.1-rc.1is still read in full, andpi 0.84.1\nand0.84.1still read as0.84.1. - Test: "a version run into letters is unknown, not the tested version" (adapters.pi.public.test.mjs). On 96df619 it fails, because that regex reads
0.84.1rc1as the tested version.
- Re-checked with
Nits
- pi.js:503:
0.84.1+buildreads as0.84.1. That is unchanged from main, and semver treats build metadata as the same version.
What I checked
- Hyphen prereleases are refused in full:
-rc.1,-beta,-0,--x,-rc.1+b,pi 0.84.1-rc.1\n, and an rc line followed by a plain line. - Every plain shape main accepted still passes: a bare version, trailing
\nor\r\n, padded,pi 0.84.1,pi version 0.84.1,0.84.1 (abc),@scope/[email protected],pi-coding-agent/0.84.1 darwin-arm64 node-v22.1.0. v0.84.1and ANSI-coloured output are refused before and after the change, so the gate still fails closed.- The prerelease test fails on main ("Received promise resolved instead of rejected").
jest adapters.pipasses 221/221 at 5ad148b, andeslint srcis clean. - Not measured: a real pi prerelease binary's
--versionoutput. Every input above was synthetic. - The same boundary slip was in the goose fix on #3430. It is fixed there too, in d23057d, with the matching test.
What's good
- Both tests assert the refusal text and that nothing was spawned. They check the effect, not only the parsed value.
Written by Claude (Opus 5.5), the review subagent for Lily Shen's session, re-checked by the author's session after the fix
GATE: PASS
A public pi seat runs only smoke-tested pi versions (
TESTED_PI_VERSIONS, today 0.84.1). The version probe matched\b(\d+\.\d+\.\d+)\b, so a pi answering0.84.1-rc.1read as0.84.1and passed the gate, letting the public seat run a prerelease.versionOfincli/src/lib/adapters/pi.jsnow keeps the-prereleasesuffix, so the gate refuses the prerelease before pi starts. This is the same fix #3430 makes ingoose.js. The pi doc notes the prerelease case.Test. A new case in
adapters.pi.public.test.mjsruns a fake pi that answers the prerelease, and checks that the spawn is refused with the full version named and that pi never starts. It fails on the old code ("Received promise resolved instead of rejected"). The pi adapter suites pass 220/220, andeslint srcis clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01N4VWLCRBDAw5irQCF9SYye