Repository navigation
feat(releasing): publish a new package's first release at its manifest version - #13207
Conversation
…t version The release engine computed every new version as inc(currentVersion, bump), with no notion of whether currentVersion was ever published. A brand-new package seeded at the epic band floor (e.g. 1100.0.0) with a minor changeset therefore debuted at 1100.1.0, silently skipping 1100.0.0 — the deliberate band-floor debut that epic re-base already publishes members at. Surfaced by #13198, which adds `@pnpm/deps.github-actions` at 1100.0.0. pnpm version -r and pnpm change status now probe the registry for each release's current version and hold the never-published ones at their manifest version: the first release publishes it verbatim, and the pending changesets (still composed into the changelog and recorded in the ledger) apply only from the next release. A probe failure fails the command rather than guessing. Mirrored in both stacks: `@pnpm/releasing.versioning` gains an unpublishedDirs input to assembleReleasePlan, resolved by `@pnpm/releasing.commands` via a registry probe threaded through a two-pass assembly; pacquet mirrors it in pacquet-versioning's plan and the CLI's change/version commands. The engine's Rust integration tests advance manifests without a real publish cycle, so a debug-only PACQUET_ASSUME_VERSIONS_PUBLISHED seam (compiled out of release builds) keeps them network-free; two new tests exercise the real probe against the mock registry.
Use the existing `lib` fixture name instead of a coined word in the first-release assembleReleasePlan tests.
The `perfectionist::impure_macro_arguments` dylint rejects passing `response.status()` directly into `miette!`; bind it to a `let` first, which also evaluates it once.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughRelease planning now probes registry publication state and preserves unpublished manifest versions for first releases. Rust and TypeScript ChangesRegistry-aware first-release versioning
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Command
participant ReleasePlan
participant Registry
Command->>ReleasePlan: assemble initial plan
ReleasePlan-->>Command: current release versions
Command->>Registry: check package@currentVersion
Registry-->>Command: published status
Command->>ReleasePlan: assemble with unpublishedDirs
ReleasePlan-->>Command: final release plan
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
PR Summary by QodoPublish first releases at the manifest version by probing the registry
AI Description
Diagram
High-Level Assessment
Files changed (15)
|
Confidence Score: 5/5This looks safe to merge.
Reviews (6): Last reviewed commit: "fix(versioning): publish an unpublished ..." | Re-trigger Greptile |
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Micro-Benchmark ResultsLinux |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
pnpm/crates/cli/tests/change.rs (1)
39-87: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMissing Rust regression test for the "probe errors" path.
This file adds coverage for "published" (200, version present) and "unpublished-but-existing-package" (200, version absent from
versions), but nothing here (or elsewhere in the provided context) exercisesis_version_published's definitive-404 branch or its non-success-status error-propagation branch against the mock registry — the TS-side equivalent (a registry probe failure fails the command rather than guessing the versioninpnpm11/releasing/commands/test/change/index.test.ts) has no Rust counterpart here.As per path instructions, "Add regression tests that fail without the fix: cover both 'published' and 'not published' outcomes, plus the 'probe throws error' failure path," and pnpm/AGENTS.md's "Testing" rule requires proving "probe-error behavior via the right level." Consider adding a test that makes the mock registry return a non-200/non-404 status (or is otherwise unreachable) for a package in the plan, and asserts
pnpm change status/pnpm version -rfail rather than silently guessing a version.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/crates/cli/tests/change.rs` around lines 39 - 87, Add a Rust regression test alongside first_release_probe_bumps_a_version_the_registry_reports_published and first_release_probe_debuts_an_unpublished_version_verbatim that configures the mocked registry to return a non-success, non-404 response or be unreachable for the planned package, then asserts the pnpm change/version flow fails and does not guess or apply a version.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm/crates/cli/tests/change.rs`:
- Around line 113-124: Update the comment above the pnpm helper to reference the
actual test function first_release_probe_debuts_an_unpublished_version_verbatim
instead of the stale
first_release_of_an_unpublished_version_is_published_verbatim name.
In `@pnpm11/releasing/commands/src/publish/previousChangelog.ts`:
- Around line 91-93: Update isVersionPublished and the fetchPackument flow so a
notModified response is never treated as unpublished: preserve distinct 404 and
not-modified outcomes, then retry or fail explicitly for not-modified instead of
returning undefined. Keep the existing false result for a confirmed missing
package/version, and add a regression test covering an already-published release
receiving a 304 response.
---
Nitpick comments:
In `@pnpm/crates/cli/tests/change.rs`:
- Around line 39-87: Add a Rust regression test alongside
first_release_probe_bumps_a_version_the_registry_reports_published and
first_release_probe_debuts_an_unpublished_version_verbatim that configures the
mocked registry to return a non-success, non-404 response or be unreachable for
the planned package, then asserts the pnpm change/version flow fails and does
not guess or apply a version.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: d976cda3-e04b-480e-bd99-f35d356a8867
📒 Files selected for processing (15)
.changeset/first-release-verbatim.mdpnpm/crates/cli/src/cli_args/change.rspnpm/crates/cli/src/cli_args/changelog.rspnpm/crates/cli/src/cli_args/dispatch_query.rspnpm/crates/cli/src/cli_args/version.rspnpm/crates/cli/tests/change.rspnpm/crates/versioning/src/plan.rspnpm/crates/versioning/src/plan/tests.rspnpm11/releasing/commands/src/change/index.tspnpm11/releasing/commands/src/publish/previousChangelog.tspnpm11/releasing/commands/src/resolveUnpublishedDirs.tspnpm11/releasing/commands/src/version/index.tspnpm11/releasing/commands/test/change/index.test.tspnpm11/releasing/versioning/src/assembleReleasePlan.tspnpm11/releasing/versioning/test/assembleReleasePlan.ts
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13207 +/- ##
==========================================
+ Coverage 86.78% 86.90% +0.11%
==========================================
Files 525 526 +1
Lines 89206 90004 +798
==========================================
+ Hits 77421 78214 +793
- Misses 11785 11790 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time). Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.57277973452,
"stddev": 0.1746232711932148,
"median": 2.5473582951200004,
"user": 1.56210248,
"system": 1.3036879000000001,
"min": 2.35829011162,
"max": 2.7943479896200003,
"times": [
2.5364756336200003,
2.7943479896200003,
2.55824095662,
2.45326294862,
2.77290503262,
2.37073821262,
2.40929247762,
2.7062034176200003,
2.76804056462,
2.35829011162
]
},
{
"command": "pacquet@main",
"mean": 2.5194958270200005,
"stddev": 0.17670972227587256,
"median": 2.43204503612,
"user": 1.54913718,
"system": 1.2844133999999998,
"min": 2.35606558562,
"max": 2.78744367862,
"times": [
2.46396902162,
2.73997620862,
2.35606558562,
2.6401605746200003,
2.78744367862,
2.36996794462,
2.36474769462,
2.40012105062,
2.37018233662,
2.70232417462
]
},
{
"command": "pnpr@HEAD",
"mean": 1.6076327758200002,
"stddev": 0.1320055762216753,
"median": 1.61847188362,
"user": 1.0865654799999998,
"system": 1.1695411000000002,
"min": 1.3941913026200001,
"max": 1.7737274546200001,
"times": [
1.5955773446200001,
1.58869060562,
1.4594982126200002,
1.7737274546200001,
1.3941913026200001,
1.64136642262,
1.75495930762,
1.7463156476200001,
1.64705727062,
1.4749441896200002
]
},
{
"command": "pnpr@main",
"mean": 1.51679667232,
"stddev": 0.13927423732482078,
"median": 1.49335840412,
"user": 1.06308268,
"system": 1.1789485,
"min": 1.3704231606200001,
"max": 1.72993003862,
"times": [
1.6155138556200002,
1.44638568362,
1.72101558562,
1.3704231606200001,
1.5403311246200002,
1.38761869862,
1.38972054262,
1.39487995062,
1.57214808262,
1.72993003862
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.26227333384,
"stddev": 0.00658884972923332,
"median": 0.26057491244000003,
"user": 0.21846428,
"system": 0.53181336,
"min": 0.25480226744,
"max": 0.27517922544,
"times": [
0.25852639544000006,
0.26144034044000003,
0.25480226744,
0.26777857144000006,
0.26706801844000005,
0.26618395944,
0.25640744944000005,
0.25563762644000004,
0.25970948444,
0.27517922544
]
},
{
"command": "pacquet@main",
"mean": 0.25841542614,
"stddev": 0.005112960038691863,
"median": 0.25868391544,
"user": 0.20661708,
"system": 0.5365918599999999,
"min": 0.24950968044,
"max": 0.26478277244000004,
"times": [
0.25325800144000005,
0.25778023544,
0.25754292044000004,
0.26478277244000004,
0.25376809944,
0.24950968044,
0.26389644944,
0.25958759544000004,
0.25992311544,
0.26410539144000006
]
},
{
"command": "pnpr@HEAD",
"mean": 0.2643292326400001,
"stddev": 0.005461185887189271,
"median": 0.2652729609400001,
"user": 0.21221498,
"system": 0.5041998599999999,
"min": 0.25735231244,
"max": 0.27352091344,
"times": [
0.26832476644000003,
0.27352091344,
0.26623223044000005,
0.25873925344000004,
0.25735231244,
0.26133224844,
0.26431369144000005,
0.26912504744000004,
0.25753009544000005,
0.26682176744
]
},
{
"command": "pnpr@main",
"mean": 0.27483818204000005,
"stddev": 0.006075076456716234,
"median": 0.27560685144,
"user": 0.21405557999999997,
"system": 0.5559270599999999,
"min": 0.26440842344000004,
"max": 0.28205228344000005,
"times": [
0.27976838544000004,
0.26508930644,
0.27288954944000005,
0.28003566544,
0.27665168744,
0.27896595944,
0.26440842344000004,
0.27395854444,
0.27456201544000003,
0.28205228344000005
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.8029215033999995,
"stddev": 0.013451275772936488,
"median": 2.8020693068,
"user": 1.74393164,
"system": 1.3627101799999999,
"min": 2.7856401813,
"max": 2.8259184782999998,
"times": [
2.7908815413,
2.8097357103,
2.7927460773,
2.7900113393,
2.7982831013,
2.7856401813,
2.8177126093,
2.8259184782999998,
2.8124304833,
2.8058555123
]
},
{
"command": "pacquet@main",
"mean": 2.7900142818,
"stddev": 0.027804526898326618,
"median": 2.7826959907999997,
"user": 1.71573514,
"system": 1.3416808799999997,
"min": 2.7616969292999998,
"max": 2.8393434952999996,
"times": [
2.7948960493,
2.8380257032999996,
2.7639893643,
2.7732457293,
2.7616969292999998,
2.7870754013,
2.8393434952999996,
2.7730021962999998,
2.7783165803,
2.7905513693
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5596727268,
"stddev": 0.12807804273242845,
"median": 1.5243593523,
"user": 1.0615969399999998,
"system": 1.1332690799999998,
"min": 1.4430712403000001,
"max": 1.7925253133,
"times": [
1.4586356103,
1.5750250823,
1.7925253133,
1.5812290143,
1.6341360573000001,
1.4530561403,
1.4430712403000001,
1.4470276173,
1.7383275703,
1.4736936223000001
]
},
{
"command": "pnpr@main",
"mean": 1.5765824828,
"stddev": 0.14787533335509553,
"median": 1.5179271638,
"user": 1.0547748399999999,
"system": 1.1621175799999999,
"min": 1.4330105373000002,
"max": 1.8297941853000002,
"times": [
1.4557971783,
1.5394002023000002,
1.7651760563,
1.4512856513,
1.6748263353,
1.8297941853000002,
1.6788191003,
1.4412614563000001,
1.4330105373000002,
1.4964541253
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6106210118200001,
"stddev": 0.011741208259020494,
"median": 0.6114937932200001,
"user": 0.7466967,
"system": 0.69796318,
"min": 0.58616409422,
"max": 0.6256930152200001,
"times": [
0.6241598392200001,
0.58616409422,
0.6201316282200001,
0.6104109632200001,
0.60083034022,
0.6256930152200001,
0.6125766232200001,
0.6057487922200001,
0.6072555472200001,
0.6132392752200001
]
},
{
"command": "pacquet@main",
"mean": 0.6014821920200001,
"stddev": 0.007125988860868265,
"median": 0.5997835182200001,
"user": 0.7311522,
"system": 0.6884387799999999,
"min": 0.5907387312200001,
"max": 0.6147700152200001,
"times": [
0.60260249322,
0.6068434652200001,
0.60066098322,
0.5907387312200001,
0.59829889522,
0.6147700152200001,
0.5989060532200001,
0.6094284002200001,
0.5967622642200001,
0.5958106192200001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.31010441332000005,
"stddev": 0.0036765247096135975,
"median": 0.31170559172,
"user": 0.20307489999999997,
"system": 0.54872168,
"min": 0.30208842522,
"max": 0.31402007522,
"times": [
0.30866498522,
0.31169006722,
0.30208842522,
0.31261920921999997,
0.31402007522,
0.30581736622,
0.30973941022,
0.31172111622,
0.31225342322,
0.31243005522
]
},
{
"command": "pnpr@main",
"mean": 0.30791983742,
"stddev": 0.0067913493241376615,
"median": 0.30870498522,
"user": 0.21171559999999995,
"system": 0.5321498799999999,
"min": 0.29770654022,
"max": 0.31859474222,
"times": [
0.30244808922,
0.30081449822,
0.30929611821999997,
0.29770654022,
0.30302595222,
0.30811385222,
0.31859474222,
0.31578328122,
0.31169711122,
0.31171818922
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.9289261832600002,
"stddev": 0.014756889232085233,
"median": 1.92879073856,
"user": 0.94810014,
"system": 0.7986008599999999,
"min": 1.90308062756,
"max": 1.95494573256,
"times": [
1.95494573256,
1.90308062756,
1.92268533556,
1.9295234545600002,
1.93472456856,
1.92805802256,
1.94255795356,
1.9351890705600001,
1.92727473156,
1.91122233556
]
},
{
"command": "pacquet@main",
"mean": 1.91961808926,
"stddev": 0.013593166506259012,
"median": 1.9201846955600002,
"user": 0.97443414,
"system": 0.75507606,
"min": 1.8960809985600002,
"max": 1.93878923956,
"times": [
1.93878923956,
1.92935591856,
1.8960809985600002,
1.91739624656,
1.92897500356,
1.90180985356,
1.91107877656,
1.9211730265600002,
1.93232546456,
1.91919636456
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29749084176,
"stddev": 0.007551374424280347,
"median": 0.29727380156000005,
"user": 0.21763114,
"system": 0.49526066,
"min": 0.28487152756,
"max": 0.30859327256,
"times": [
0.29710245056,
0.30796391056000005,
0.30068189956,
0.30208089556,
0.30859327256,
0.28487152756,
0.29198814756,
0.29744515256000004,
0.29138227056000005,
0.29279889056
]
},
{
"command": "pnpr@main",
"mean": 0.31087238936,
"stddev": 0.0046759843094403885,
"median": 0.31090439656,
"user": 0.18558714000000004,
"system": 0.5710198599999999,
"min": 0.30413230756000004,
"max": 0.31761568156000003,
"times": [
0.31002655356000003,
0.30413230756000004,
0.31533508956000006,
0.30957526656,
0.31761568156000003,
0.31187849956,
0.31644899156000006,
0.30485594556,
0.30707331856000003,
0.31178223956
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.36038450794000004,
"stddev": 0.014356368158867022,
"median": 0.35403500714,
"user": 0.35164897999999994,
"system": 0.059914079999999995,
"min": 0.34710853814000003,
"max": 0.39398846114,
"times": [
0.35334953614000003,
0.34848664614,
0.35460261814000005,
0.34710853814000003,
0.35346739614000006,
0.37146323314,
0.36086003414000006,
0.36903850114000003,
0.35148011514000005,
0.39398846114
]
},
{
"command": "pacquet@main",
"mean": 0.36246485974000003,
"stddev": 0.009941998557420608,
"median": 0.36740640114,
"user": 0.35922458,
"system": 0.05276617999999998,
"min": 0.34797473414,
"max": 0.37183740514,
"times": [
0.36728631014,
0.36752649214000005,
0.36990145114000006,
0.34937326014000003,
0.36790484114000005,
0.34814864114000005,
0.37147022514000005,
0.36322523714000005,
0.34797473414,
0.37183740514
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08685004235212122,
"stddev": 0.001570442602820156,
"median": 0.08727174414000001,
"user": 0.02128328,
"system": 0.007932890909090912,
"min": 0.08253464014,
"max": 0.08922786614,
"times": [
0.08572440814000001,
0.08922786614,
0.08835285214000001,
0.08465397914,
0.08682152814,
0.08834064914,
0.08784388714000001,
0.08806180714,
0.08538464014000001,
0.08757115614000001,
0.08715622614,
0.08891217214000001,
0.08728686114,
0.08391654414000001,
0.08901288214000001,
0.08434895614,
0.08757290814,
0.08716642514,
0.08727174414000001,
0.08787711914,
0.08681598814000001,
0.08637253514000001,
0.08524759214000001,
0.08782672514,
0.08458722414000001,
0.08762771114000001,
0.08705145914000001,
0.08767408814000001,
0.08743346614000001,
0.08645068214000001,
0.08253464014,
0.08803433414,
0.08589034014000001
]
},
{
"command": "pnpr@main",
"mean": 0.08692001726121211,
"stddev": 0.001709073581592977,
"median": 0.08711245414,
"user": 0.020173098181818182,
"system": 0.008942449696969695,
"min": 0.08343255614,
"max": 0.09049536514,
"times": [
0.08593705714000001,
0.08732498414,
0.08730981414000001,
0.08892233114,
0.08604230514000001,
0.08715767914000001,
0.08575833114,
0.08617301114,
0.08343255614,
0.08642183714000001,
0.08733147614,
0.08862149714,
0.08572946714,
0.08847922014000001,
0.08711245414,
0.09049536514,
0.08452633914,
0.08889389814000001,
0.08468443514000001,
0.08786405514000001,
0.08787007514,
0.08691931114000001,
0.08640451514000001,
0.08874406614000001,
0.08743610114000001,
0.08601659714000001,
0.08711691214,
0.09034978214,
0.08583553614,
0.08526963414000001,
0.08363327314,
0.08892457614,
0.08562207614
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.547777458400001,
"stddev": 0.14637295964307528,
"median": 4.5112010619,
"user": 1.7523460399999997,
"system": 1.3723758,
"min": 4.4235498009,
"max": 4.8840008309,
"times": [
4.4385894269,
4.4942491019,
4.4257727049,
4.4235498009,
4.4438825329,
4.5281530219,
4.8840008309,
4.5340423499,
4.6276621699,
4.6778726439
]
},
{
"command": "pacquet@main",
"mean": 4.6098880497,
"stddev": 0.1339374476228893,
"median": 4.6204611604,
"user": 1.7541957399999997,
"system": 1.3777138999999998,
"min": 4.4464779069,
"max": 4.8272848079,
"times": [
4.7866693669,
4.6815488349,
4.4464779069,
4.6535657499,
4.6241654549,
4.5389877739,
4.4631356209,
4.4602881149,
4.6167568659,
4.8272848079
]
},
{
"command": "pnpr@HEAD",
"mean": 3.5321629612,
"stddev": 0.10472188687381068,
"median": 3.4860621729,
"user": 1.2502124399999999,
"system": 1.218512,
"min": 3.4497187129,
"max": 3.7944322609,
"times": [
3.4758609519,
3.5564111559000002,
3.7944322609,
3.4833510849000002,
3.4874055449,
3.6218243509,
3.4497187129,
3.4881761829,
3.4847188009,
3.4797305659
]
},
{
"command": "pnpr@main",
"mean": 3.6060302560999995,
"stddev": 0.12310215051757181,
"median": 3.5786734369,
"user": 1.16860304,
"system": 1.2952632999999998,
"min": 3.4650229479,
"max": 3.8417821719000003,
"times": [
3.8417821719000003,
3.6448888279,
3.5450161749,
3.6584632119,
3.4650229479,
3.5047340209,
3.4806370089,
3.6011131779000003,
3.7624113229000002,
3.5562336959
]
}
]
} |
|
| Branch | pr/13207 |
| Testbed | pnpr |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,443.07 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 284.87 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 302.09 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 82.53 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,394.19 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,449.72 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 257.35 ms |
- Reuse one registry client across the concurrent probes instead of building a fresh one per release, so the global network-concurrency bound and connection pool are respected (`createVersionPublishedChecker` in TS; a shared `ThrottledClient` in `unpublished_release_dirs` in Rust). - Redact URL credentials in the Rust probe's error message via `redact_url_credentials`, matching the other registry-fetch paths. - Document that the probe passes no cache validator, so a not-modified (304) response never occurs and an absent packument always means a 404 (unpublished). - Document that fixed-group sharing and epic band re-basing supersede the verbatim debut (lockstep and band validity are workspace-wide invariants a package cannot opt out of); add an engine test that an unpublished epic member re-bases to the new band floor when its lead crosses a major. - Add a Rust integration test that a probe failure fails the command, and fix a stale test-name reference in a comment.
|
Addressed the automated review in fcd2c38:
Two greptile P1 threads I've left open because they're design decisions rather than defects, and I'd like your call:
Written by an agent (Claude Code, claude-opus-4-8). |
| } | ||
| let response = request.send().await.into_diagnostic()?; | ||
| let status = response.status(); | ||
| if status.as_u16() == 404 { |
There was a problem hiding this comment.
4. 404 treated as unpublished 🐞 Bug ⛨ Security
Rust is_version_published() returns false on any registry 404, but pnpm’s resolver explicitly documents that a 404 can also mean “no permission to fetch it”, not “does not exist”. This can produce a misleading release plan and then apply it (e.g. pnpm version -r consuming intents) based on an ambiguous probe result.
Agent Prompt
### Issue description
`is_version_published()` treats HTTP 404 as a definitive “not published” signal. In pnpm semantics, 404 can also represent an authorization-masked failure ("not in registry, or no permission"). Using 404 as “unpublished” can therefore make `pnpm version -r`/`pnpm change status` proceed with a wrong plan instead of failing as designed.
### Issue Context
This PR’s stated contract is “fail on error; only definitive 404 means not published.” The codebase itself documents that 404 is ambiguous for registry metadata fetches.
### Fix Focus Areas
- pnpm/crates/cli/src/cli_args/changelog.rs[122-151]
- pnpm11/resolving/npm-resolver/src/fetch.ts[57-73]
### Suggested fix
- When the packument probe returns 404, add an additional auth/health disambiguation step before treating it as unpublished (e.g. a lightweight `/-/whoami` probe against the same registry origin when an auth header would be sent), and fail the command if that check indicates auth is invalid/unusable.
- Alternatively, make “treat 404 as unpublished” conditional on additional evidence from the response body/headers (if available), and otherwise error with a message explaining that 404 can also mean lack of permission.
- Ensure the same semantics are implemented in both Rust and TS stacks to keep parity.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
Leaving this as a design call for now, with reasoning:
A bare 404 is genuinely ambiguous in npm (absent vs. no read permission), and it can't be disambiguated reliably — the registry conflates the two on purpose, and a /-/whoami check only tells you whether auth is valid, not whether this package is readable.
In the first-release context, though, it can't cause a bad publish. The probe sends the same auth the subsequent publish will use, so:
- If a private package exists but is unreadable, the release can't publish it either — it fails at publish, not silently.
- If the probe wrongly treats it as unpublished (verbatim),
pnpm publishthen attempts the current version and fails on the already-published version rather than corrupting anything.
It also matches how @pnpm/resolving.npm-resolver itself treats a packument 404. So the ambiguity is real but the outcome is fail-safe. Happy to add a disambiguation step if preferred — flagging it for the maintainer to decide.
Written by an agent (Claude Code, claude-opus-4-8).
|
Code review by qodo was updated up to the latest commit fcd2c38 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
pnpm/crates/cli/tests/change.rs (1)
97-97: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winDisable retries in the intentional-failure fixture.
Both probe commands can otherwise incur registry retry/backoff before failing. Add
fetch-retries=0to this test’s.npmrcso the error-path test remains fast and deterministic.Proposed fix
- fs::write(workspace.join(".npmrc"), "registry=http://127.0.0.1:1/\n").expect("write npmrc"); + fs::write( + workspace.join(".npmrc"), + "registry=http://127.0.0.1:1/\nfetch-retries=0\n", + ) + .expect("write npmrc");As per path instructions, avoid costly work on test and command paths.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/crates/cli/tests/change.rs` at line 97, Update the `.npmrc` content written by the intentional-failure fixture in the change test to include `fetch-retries=0` alongside the invalid registry setting. Keep the existing failure setup unchanged while disabling registry retries for both probe commands so the test fails quickly and deterministically.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm11/releasing/commands/src/publish/previousChangelog.ts`:
- Around line 85-101: Bound concurrent registry probes in
createVersionPublishedChecker by wrapping fetchPackument with a shared limiter
created once for the checker, so resolveUnpublishedDirs() can retain Promise.all
without unbounded fan-out. Use the repository’s standard limiter and an
appropriate documented concurrency limit, while preserving the existing boolean
result and error propagation behavior.
---
Nitpick comments:
In `@pnpm/crates/cli/tests/change.rs`:
- Line 97: Update the `.npmrc` content written by the intentional-failure
fixture in the change test to include `fetch-retries=0` alongside the invalid
registry setting. Keep the existing failure setup unchanged while disabling
registry retries for both probe commands so the test fails quickly and
deterministically.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 64a8c143-ca7b-4f63-a099-f31458e28c2a
📒 Files selected for processing (8)
pnpm/crates/cli/src/cli_args/changelog.rspnpm/crates/cli/tests/change.rspnpm/crates/versioning/src/plan.rspnpm/crates/versioning/src/plan/tests.rspnpm11/releasing/commands/src/publish/previousChangelog.tspnpm11/releasing/commands/src/resolveUnpublishedDirs.tspnpm11/releasing/versioning/src/assembleReleasePlan.tspnpm11/releasing/versioning/test/assembleReleasePlan.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts
- pnpm11/releasing/versioning/test/assembleReleasePlan.ts
- pnpm/crates/cli/src/cli_args/changelog.rs
- pnpm11/releasing/versioning/src/assembleReleasePlan.ts
resolveUnpublishedDirs probed every release with an unbounded Promise.all; a large recursive release could burst as many concurrent registry connections as there are releases. Cap the fan-out with p-limit at networkConcurrency (default 16), matching how the rest of the commands package bounds registry work. The Rust side was already bounded — the shared ThrottledClient's per-origin semaphore caps concurrent probes — so only a clarifying comment is added there.
Summary
The release engine computed every new version as
inc(currentVersion, bump), with no notion of whethercurrentVersionwas ever published. A brand-new package seeded at the epic band floor (e.g.1100.0.0) with aminorchangeset therefore debuted at1100.1.0, silently skipping1100.0.0— even though epic re-base already publishes members at thex00.0.0floor, so a new package should debut there too. This surfaced in #13198, which adds@pnpm/deps.github-actionsat1100.0.0with aminorchangeset; that package would have first published as1100.1.0.This teaches the engine that a package's first release publishes the version in its manifest verbatim.
pnpm version -randpnpm change statusnow probe the registry for each release's current version and hold the never-published ones at that version: the first release publishes it as-is, and the pending changesets — still composed into the changelog and recorded in the ledger — apply only from the next release.Per the discussion that motivated this approach:
pnpm version -r,pnpm change status, and--dry-run— no offline special case.How it's wired (both stacks, in lockstep):
@pnpm/releasing.versioning/pacquet-versioning:assembleReleasePlangains anunpublishedDirsinput;computeNewVersionreturns the current version verbatim for those dirs (and, on a lane, a prerelease of the current version without incrementing).@pnpm/releasing.commands/ the pacquet CLI: a registry probe (isVersionPublished/unpublished_release_dirs, reusing the existing packument-fetch plumbing) resolves that set, threaded through a two-pass assembly (assemble → probe the plan's releases → re-assemble). Holding a package at its current version can only remove dependent propagation, never add it, so the second pass is a subset of the first — every dir it can hold was probed.Notes for review
checkVersionPublished(mirroring the existing injectedverifyPublishedgate) so the command tests steer first-vs-follow-up without a network round trip. Production leaves it unset and probes.debug_assertions-gatedPACQUET_ASSUME_VERSIONS_PUBLISHEDenv var that makes every release bump as if published. It is compiled out of release builds, so a productionpnpmalways probes — worst-case misuse in a debug build only reverts to the pre-PR bump-always behavior, never an incorrect publish. Two new integration tests exercise the real probe against the mock registry (@pnpm.e2e/[email protected]→ bumps;@pnpm.e2e/[email protected]→ verbatim).pacquetchangecommand becameasyncto run the probe (its dispatch now awaits it).Validation:
@pnpm/releasing.versioning(63) and@pnpm/releasing.commandschange-suite (15) Jest tests,pacquet-versioning(66) andpacquet-cli::change(9) tests, plus workspacecargo fmt/taplo/clippy -D warnings.Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-opus-4-8).
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
changeand recursiveversion -r.change statuspreviews to reflect the effective published/unpublished state used for planning.