fix(github): handle existing release tag (idempotent publish)#93
fix(github): handle existing release tag (idempotent publish)#93PrzemyslawKlys merged 2 commits intomainfrom
Conversation
Pull Request Review: Fix GitHub Release Tag Collision (Idempotent Publish)OverviewThis PR adds idempotency support to GitHub release publishing by handling 422 status codes for existing tags and assets. The implementation allows reruns to succeed rather than fail when releases or assets already exist. Strengths1. Well-Designed Idempotency Logic
2. Consistent Implementation
3. Good Error Context
4. Proper Resource Management
Code Quality ObservationsMinor: Method Visibility ChangesLocation: SendGitHubReleaseCommand.cs:165,233 The methods CreateRelease and UploadAssets were changed from static to instance methods. This is necessary to access WriteWarning(), but creates a slight inconsistency since other helper methods remain static. Impact: Low - The change is necessary and does not affect functionality. Minor: Empty Catch BlockLocation: Both files in IsAlreadyExistsValidationError method (lines 316-318 and 246-248) Concern: Silently swallows all exceptions during JSON parsing. While this is acceptable for the "already exists" check (where we default to re-throwing the original error), it could hide deserialization issues. Recommendation: Consider adding a comment explaining why all exceptions are caught, or logging at debug level. Security ConsiderationsNo new security concerns identified:
Performance ConsiderationsAdditional API Call on Collision: When a release already exists, the code now makes an additional GET request to fetch the existing release. Impact: Minimal - This only occurs on reruns where the release already exists, and is necessary to obtain the upload URL for asset uploads. Test CoverageNo automated tests found for either file in the repository. Recommendations:
Additional ObservationsGetReleaseByTag ImplementationBoth implementations are solid:
Backwards CompatibilityChanges are fully backwards compatible - existing successful flows are unchanged, only the error handling path is enhanced. VerdictLGTM with minor suggestions - This is a well-implemented fix for a real CI/CD pain point. The idempotency logic is sound, the implementation is consistent across both modules, and no security or performance issues were identified. Suggested Follow-ups (Non-blocking):
Files Reviewed:
Total: +154/-2 lines across 2 files |
Pull Request Review: PR #93 - fix(github): handle existing release tag (idempotent publish)SummaryThis PR adds idempotency to GitHub release creation and asset uploads by gracefully handling the 422 status code when tags or assets already exist. The implementation allows CI/CD pipelines to safely retry release operations without failing. ✅ Strengths1. Excellent Problem Solution
2. Code Quality
3. Error Handling
🔍 Observations & Minor Suggestions1. Method Visibility Changes (SendGitHubReleaseCommand.cs:165, 219, 233)The methods
2. Duplicate Code Between FilesThe
3. Missing Validation Error Response PropertiesThe
4. Asset Upload Continuation Logic (SendGitHubReleaseCommand.cs:252-256, GitHubReleasePublisher.cs:166-170)When an asset already exists, the code uses
🧪 Test CoverageConcern: No unit tests found for the new functionality. The changes introduce new code paths that should be tested:
Recommendation: Consider adding integration or unit tests for:
🔒 Security ConsiderationsNo security concerns identified.
🚀 Performance ConsiderationsNo performance concerns identified.
📝 Additional Notes1. Consistency in CommentsBoth files use identical comments: "Idempotency: reruns frequently hit..." - this is good for maintainability. 2. GetReleaseByTag Implementation (SendGitHubReleaseCommand.cs:219-231, GitHubReleasePublisher.cs:125-143)The new method correctly:
3. Backward CompatibilityThis change is backward compatible - no breaking changes to public APIs. ✅ RecommendationAPPROVE with suggestions for follow-up This PR is well-implemented and ready to merge. The suggestions above are minor improvements that could be addressed in future PRs:
The idempotency improvements are valuable and the implementation is solid. The code is production-ready. Reviewed by Claude Code |
When GitHub release creation returns 422 (tag already exists), reuse the existing release and continue uploading assets.\n\nAlso skips asset uploads when GitHub returns 422 (asset name already exists), making reruns idempotent.