fix(scripts): handle missing NPM dist-tags gracefully in release versioning (#6476) - #6481
Conversation
…ioning (#6476) getAndVerifyTags now returns null instead of throwing when no baseline version exists on NPM. getPreviewVersion and getStableVersion fall back to the package.json base version, matching the pattern already used by getNightlyVersion. This prevents the release workflow from failing when no nightly or preview dist-tag has been published yet.
E2E Test Report — Issue #6476IssueRelease workflow failed at Branch
Verification Results
Test CoverageExisting tests (all still passing)
New tests added
Files Changed
|
|
Thanks for this fix! Template: the PR body uses Problem: observed and verified. The release workflow failed at the Direction: aligned — release infrastructure resilience is squarely within scope. The fix correctly distinguishes "no dist-tag yet" (graceful fallback) from "transient network error" (propagate) and "dist-tag required" (explicit error). This is the right model. Size: not applicable — Approach: scope feels right. Every change directly addresses the stated problem — Moving on to code review. 🔍 中文说明感谢修复! 模板:PR 正文使用了 问题:已观测并验证。发布工作流失败于 方向:对齐——发布基础设施的韧性是核心范围。修复正确区分了"尚无 dist-tag"(优雅回退)、"瞬时网络错误"(传播错误)和"必须有 dist-tag"(显式报错)。这是正确的模型。 规模:不适用—— 方案:范围合理。每处改动都直接解决问题—— 进入代码审查 🔍 — Qwen Code · qwen3.7-max |
Code ReviewIndependent proposal (before reading diff): Given that
Comparison with the diff: The PR's approach matches my proposal exactly, and goes further in useful ways:
Reuse check: No new abstractions introduced. The Findings:
TestingUnit tests: 25/25 passing ✅ (including 17 new tests covering fallback paths, transient errors, deprecated versions, greenfield scenarios, and retrograde detection) CI: All green — Real-scenario testing (tmux): Nightly and preview work correctly. The stable error is expected and correct — it's the new retrograde safety check firing because the preview dist-tag points to 0.19.6 while latest is already 0.19.7. This guard prevents accidental retrograde releases. Note: This PR fixes release script behavior in CI — the bug (missing dist-tag crash) is only reproducible in a release workflow run where no dist-tag exists. The unit tests mock this scenario comprehensively (E404 from dist-tag lookup, transient errors, all-deprecated versions, greenfield scenarios). 中文说明代码审查独立方案(读 diff 前): 给定 与 diff 对比: PR 方案与我的完全一致,且在有用方向上更进一步: 发现: 无正确性 bug、安全问题或回归。无 AGENTS.md 违规。错误处理精确(仅 E404)。 测试
— Qwen Code · qwen3.7-max |
|
Stepping back: this PR fixes a real, observed CI failure — the release workflow crashed because The 25 unit tests cover the full matrix of scenarios (no dist-tag, transient errors, deprecated versions, greenfield, retrograde detection) without being padded. The tmux run confirms the script works correctly against the live NPM registry. After 3 rounds of review feedback, the remaining concerns (DRY in The only soft concern: the PR body doesn't follow the template, but this is an autofix bot and the information is all present under different headings. Not worth blocking. Verdict: clean, focused fix that solves the stated problem and adds useful safety guards. Ready to ship. 中文说明回顾全局:这个 PR 修复了一个真实的、已观测到的 CI 失败——发布工作流因 25 个单元测试覆盖了完整的场景矩阵,tmux 运行确认脚本在真实 NPM 环境下正常工作。经过 3 轮 review 反馈,剩余的关注点( 唯一的软性问题:PR 正文没有遵循模板,但这是 autofix bot,且所有信息都在不同的标题下呈现。不值得阻塞。 结论:干净、聚焦的修复,解决了所述问题并增加了有用的安全防护。可以合并。 — Qwen Code · qwen3.7-max |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship. ✅
…and missing dist-tags (#6476) - Distinguish 404 from transient errors in getVersionFromNPM so NPM outages halt the release instead of silently falling back - Consult getAllVersionsFromNPM when dist-tag is missing to derive baseline from published versions rather than returning empty - Add console.error logging when getAndVerifyTags returns null - Validate package.json fallback version in getStableVersion and getPreviewVersion - Add tests for promote-nightly/patch throw paths, true greenfield scenario, versions-list derivation, and transient error propagation
|
🤖 Addressed the latest review feedback (round 1/3). What changed, and what I pushed back on: Address Summary — PR #6481Feedback Classification & Actions1. [Critical]
|
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
…#6476) getAllVersionsFromNPM silently swallowed all errors including transient network failures (ETIMEDOUT, ECONNRESET), which became load-bearing now that the missing-dist-tag fallback depends on it. Match the same 404-only pattern already used by getVersionFromNPM. Also fix a DRY violation in getPreviewVersion, correct misleading test comments, and add test coverage for the versions-list error path and latest filter branch.
|
🤖 Addressed the latest review feedback (round 2/3). What changed, and what I pushed back on: Address Review Summary — PR #6481 (issue #6476)Feedback TriageRequired (Fixed)
Optional (Implemented)
Optional (Skipped)
Conflict NotesNo conflicts — Verification Results
Base-conflict check: no conflict with main. Re-review when you have a moment. After round 3 this bot stops and leaves the PR for a human. |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
— qwen3.7-max via Qwen Code /review
…ist failures (#6476) - Remove redundant '404' substring check; E404 is the canonical npm error code and bare '404' could false-match unrelated errors (port 4043, E4040) - Catch transient versions-list errors in detectRollbackAndGetBaseline when distTagVersion is already resolved, avoiding hard-blocking a release when rollback detection is merely a safety net - Update and add tests for the new fallback behavior and deprecated-versions path
|
🤖 Addressed the latest review feedback (round 3/3). What changed, and what I pushed back on: Review Address Summary — PR #6481 (issue #6476)Feedback classification and actions1.
|
yiliang114
left a comment
There was a problem hiding this comment.
Approved. The impact surface is small: this is limited to release version calculation and its tests, mainly affecting release automation rather than the main CLI/agent runtime paths. CI can remain the final gate.
|
@qwen-code /triage |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship. ✅
Summary
Fixes #6476 — the scheduled release workflow failed at the
preparejob becauseget-release-version.jsthrew an unhandled error when no NPM dist-tag existed for the requested release channel.Root cause
getAndVerifyTags()calleddetectRollbackAndGetBaseline()which returned an empty baseline when no dist-tag existed on NPM. Instead of handling this gracefully, the function threwError: Unable to determine baseline version for nightly. BothgetPreviewVersion()andgetStableVersion()were vulnerable to this — unlikegetNightlyVersion()which already read directly frompackage.json.Changes
scripts/get-release-version.jsgetAndVerifyTags()now returnsnullinstead of throwing when no baseline version is found on NPMgetPreviewVersion()handlesnullreturn and falls back topackage.jsonbase version +-preview.0getStableVersion()handlesnullreturn and falls back topackage.jsonbase versiongetLatestStableReleaseTag()handlesnullreturn gracefullypromoteNightlyVersion()andgetPatchVersion()throw explicit, descriptive errors whennullis returned (these paths genuinely require an existing dist-tag)scripts/tests/get-release-version.test.jspackage.jsonwhen no nightly dist-tag existspackage.jsonwhen no preview dist-tag existsVerification
npm run build— ✅ passednpm run typecheck— ✅ passednpm run lint— ✅ passed