fix(ci): use temporary version in verify.js to avoid publish collision [EXT-7068]#2422
Conversation
📝 WalkthroughWalkthroughModified Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant VerifyScript as Verify Script
participant FS as FileSystem (`package.json`)
participant NPM as npm (publish --dry-run)
Note over VerifyScript: Start verification
VerifyScript->>FS: read version (getVersion) -> originalVersion
Note right of VerifyScript: derive tag from originalVersion
VerifyScript->>FS: setDryRunVersion() -> write 0.0.0-verify.{timestamp}
FS-->>VerifyScript: confirm written (newVersion)
VerifyScript->>NPM: npm publish --dry-run (uses newVersion)
NPM-->>VerifyScript: dry-run result
Note over VerifyScript,FS: log temporary dry-run version
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used🪛 Biome (2.1.2)scripts/verify.js[error] 42-42: Illegal use of reserved keyword (parse) [error] 44-44: Illegal use of reserved keyword (parse) [error] 50-52: Illegal use of reserved keyword (parse) 🔇 Additional comments (4)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
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 |
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
There was a problem hiding this comment.
Actionable comments posted: 1
Fix all issues with AI Agents 🤖
In @scripts/verify.js:
- Around line 14-29: The setDryRunVersion() function performs synchronous fs
reads/writes without local error handling; wrap the readFileSync and
writeFileSync calls in a try-catch inside setDryRunVersion(), log a clear
contextual error (including the caught error) and rethrow to preserve existing
outer handling, ensure you still preserve the package name set by
setPackageName() (which uses ORIGINAL_PACKAGE_JSON) and when writing
PACKAGE_JSON_PATH include a trailing newline at the end of the JSON string to
match file formatting conventions.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
scripts/verify.js
🧰 Additional context used
🧬 Code graph analysis (1)
scripts/verify.js (2)
scripts/shared.js (4)
fs(3-3)packageJson(30-30)PACKAGE_JSON_PATH(7-7)PACKAGES(5-5)scripts/publish.js (1)
require(2-10)
🪛 Biome (2.1.2)
scripts/verify.js
[error] 32-32: Illegal use of reserved keyword package as an identifier in strict mode
(parse)
[error] 34-34: Illegal use of reserved keyword package as an identifier in strict mode
(parse)
[error] 40-42: Illegal use of reserved keyword package as an identifier in strict mode
(parse)
🔇 Additional comments (3)
scripts/verify.js (3)
2-2: LGTM! Necessary imports for the new functionality.The
fsmodule andPACKAGE_JSON_PATHimports are required for the newsetDryRunVersion()function to read and modify package.json.Also applies to: 10-10
36-37: Correct approach: tag should be based on the original version.The change to preserve
originalVersionand derive the tag from it (rather than from the temporary version) is the right approach. The npm tag should reflect the actual release version, not the temporary0.0.0-verify.*version.
42-44: Good addition: temporary version prevents publish collision.This change addresses the core issue described in the PR objectives. By setting a unique temporary version before
npm publish --dry-run, the script avoids the "version already exists" error that occurs because verify.js runs before semantic-release calculates the new version. The logging is also helpful for CI debugging.
|
🎉 This PR is included in version 4.49.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Purpose of PR
The release pipeline is failing due to an order-of-operations issue - verify.js is running before
@semantic-release/npmbumps to the calculated new version. To fix this issue, this changeset ensures:PR Checklist
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.