fix: Add publish verification and failure detection to prevent false positives#116
Merged
fix: Add publish verification and failure detection to prevent false positives#116
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #115
…positives The publish-to-npm.mjs script was falsely reporting success when changeset publish failed. This happened because: 1. changeset publish exits with code 0 even when packages fail to publish 2. command-stream library doesn't throw exceptions on non-zero exit codes 3. The script only relied on exception handling to detect failures This fix adds multi-layer failure detection: - Output pattern matching for known error messages (E404, 401, 403, etc.) - Exit code checking (when available) - Post-publish verification by querying npm registry - Retry logic now properly triggers on all failure types Also adds comprehensive case study documentation in docs/case-studies/issue-115/ with timeline, root cause analysis, and references to upstream changesets issues. Fixes #115 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the issue where npm publish failures were incorrectly reported as successes. The root cause was that
changeset publishexits with code 0 even when packages fail to publish, and the script only relied on exception handling for failure detection.Changes:
Multi-layer failure detection in
publish-to-npm.mjs:packages failed to publish,npm error code E,E404,E401,E403,Access token expired,ENEEDAUTH)Case study documentation in
docs/case-studies/issue-115/:Test script in
experiments/test-failure-detection.mjs:Root Cause
The original issue occurred because:
changeset publishexits with code 0 even when packages fail to publish (known upstream issue)command-streamlibrary doesn't throw exceptions on non-zero exit codesHow it's Fixed
The script now:
changeset publishusing.run({ capture: true })Test Plan
npm run lint)npm run format:check)bun test tests/json-standard-unit.test.js)node experiments/test-failure-detection.mjs)Related Issues
Fixes #115
🤖 Generated with Claude Code