fix(ci): inject release version into PACQUET_VERSION constant#12058
Conversation
The pacquet release workflow patched the clap `version` attribute in cli_args.rs, expecting a string literal. Since #12047 that attribute references the `pacquet_config::PACQUET_VERSION` constant, so the perl substitution matched nothing and the verifying grep failed, aborting the whole release. Patch the `PACQUET_VERSION` constant in defaults.rs instead. That single constant feeds both `pacquet --version` and the default User-Agent, so both report the published version. Also tag the default User-Agent as `pnpm/pacquet-<version>` so registries can tell pacquet's traffic apart from the TypeScript pnpm CLI, while keeping the `pnpm` token for UA-keyed allow / rate-limit rules.
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🧰 Additional context used📓 Path-based instructions (1)pacquet/**/*.rs📄 CodeRabbit inference engine (pacquet/AGENTS.md)
Files:
🧠 Learnings (3)📚 Learning: 2026-05-20T19:40:55.051ZApplied to files:
📚 Learning: 2026-05-22T00:08:44.646ZApplied to files:
📚 Learning: 2026-05-20T23:07:58.444ZApplied to files:
🔇 Additional comments (5)
📝 WalkthroughWalkthroughThe PR refactors the pacquet release process to inject the version into a dedicated constant in the config crate, then updates the user-agent format from ChangesUser-Agent Format and Version Injection
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Micro-Benchmark ResultsLinux |
Review Summary by QodoFix release workflow and update User-Agent format to include pacquet identifier
WalkthroughsDescription• Fix release workflow by patching PACQUET_VERSION constant instead of clap attribute • Update User-Agent format to pnpm/pacquet- for traffic differentiation • Update documentation and tests to reflect new User-Agent format • Ensure both --version and User-Agent report published version Diagramflowchart LR
A["Release Workflow"] -->|"Patch PACQUET_VERSION"| B["defaults.rs constant"]
B -->|"Feeds both"| C["pacquet --version"]
B -->|"Feeds both"| D["User-Agent header"]
D -->|"New format"| E["pnpm/pacquet-VERSION"]
File Changes1. pacquet/crates/config/src/defaults.rs
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12058 +/- ##
==========================================
- Coverage 89.13% 89.12% -0.02%
==========================================
Files 235 235
Lines 31550 31550
==========================================
- Hits 28123 28118 -5
- Misses 3427 3432 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The pacquet release workflow patched the clap `version` attribute in cli_args.rs, expecting a string literal. Since #12047 that attribute references the `pacquet_config::PACQUET_VERSION` constant, so the perl substitution matched nothing and the verifying grep failed, aborting the whole release. Patch the `PACQUET_VERSION` constant in defaults.rs instead. That single constant feeds both `pacquet --version` and the default User-Agent, so both report the published version. Also tag the default User-Agent as `pnpm/pacquet-<version>` so registries can tell pacquet's traffic apart from the TypeScript pnpm CLI, while keeping the `pnpm` token for UA-keyed allow / rate-limit rules.
Why
The pacquet release run failed at the Inject version into
pacquet/crates/cli/src/cli_args.rsstep (exit 1), which — withfail-fast— cancelled every platform leg.The step patched the clap
versionattribute, expecting a string literal:#[clap(version = "0.2.2")]Since #12047 that attribute references a constant:
#[clap(version = pacquet_config::PACQUET_VERSION)]So the perl substitution matched nothing, the file was left unchanged, and the verifying
grep "version = \"$VERSION\""failed.What
PACQUET_VERSIONconstant inpacquet/crates/config/src/defaults.rsinstead of the clap attribute. That single constant feeds bothpacquet --versionand the default User-Agent, so both now report the published version (the old step only fixed--version).pnpm/pacquet-<version> npm/? node/? <platform> <arch>so registries can distinguish pacquet's traffic from the TypeScript pnpm CLI, while keeping the leadingpnpmtoken so UA-keyed allow / rate-limit rules that pass pnpm also pass pacquet.Verification
0.2.2-14).cargo nextest run -p pacquet-config user_agentpasses.cargo clippy -p pacquet-config -p pacquet-network --all-targets -- --deny warningsclean.Written by an agent (Claude Code, claude-opus-4-8).
Summary by CodeRabbit