fix(publish): poll npm registry for verification instead of republishing - #109
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #105
Working session summaryDone — all CI checks pass, working tree clean. PR: #109 (ready for review) Root cause: Fix: new Tests: This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $1.679828📊 Context and tokens usage:
Total: (68 new + 50.1K cache writes + 1.6M cache reads) input tokens, 15.4K output tokens, $1.679828 cost 🤖 Models used:
📎 Log file uploaded as Gist (1079KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart triggered (iteration 1)Reason: Merge conflicts detected Starting new session to address the issues. Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations. |
# Conflicts: # .gitkeep
Working session summaryConflict resolved (only This summary was automatically extracted from the AI working session output. |
🔄 Auto-restart-until-mergeable Log (iteration 1)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $0.188740📊 Context and tokens usage:
Total: (10 new + 11.8K cache writes + 109.6K cache reads) input tokens, 647 output tokens, $0.188740 cost 🤖 Models used:
📎 Log file uploaded as Gist (1304KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
🎉 Auto-mergedThis pull request has been automatically merged by hive-mind.
Auto-merged by hive-mind with --auto-merge flag |
Fixes #105
Problem
scripts/publish-to-npm.mjstreated "publish succeeded" and "verification succeeded" as one retryable unit. When the publish worked but the single check 2s later missed because npm's registry had not propagated, the retry loop re-ran the wholechangeset publish, which then failed with "cannot publish over the previously published versions" — turning a successful release into a reported failure.Solution
New module
scripts/publish-retry.mjssplits the two failure domains:waitForVersionOnRegistry()— bounded polling with exponential backoff (7 attempts, 2s → 30s cap). A thrown E404/network error is treated as a miss and polling continues.publishWithRetry()— retrieschangeset publishonly when the publish command itself failed. Once a publish reports success, the flow moves to verification and never re-enters the publish path; an exhausted poll fails the release without republishing.isAlreadyPublishedError()—EPUBLISHCONFLICT/ "cannot publish over the previously published versions" is treated as a cue to verify, not to fail.Verification is still mandatory: a publish that falsely claims success still fails the release.
publish-to-npm.mjsnow delegates topublishWithRetry;attemptPublishbecamerunPublishCommand(publish only, no verification). Non-retryable auth guidance from #77 is preserved.Reproduction / tests
tests/publish-retry.test.jsencodes the scenario from the issue — a runner whose publish succeeds once and whose verification misses twice:maxDelayAll 169 tests pass;
npm run lint,format:checkandcheck:duplicationare clean.