fix: make pre-release deletion reachable when publishing a full release #30
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
heiko/gogogo!30
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-prerelease-cleanup-dead-code"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
cleanupOldReleasesfiltered withpre-release=falsewhen publishing a full release, so the list never contained pre-releases — the!ri.PreRelease && release.PreReleasecondition was permanently unreachable (dead code)ListReleasescall withpre-release=trueafter the same-type asset-strip loop, and delete any pre-releases with a semver lower than the new full releasefakeAPI.ListReleasesin tests now honours thepre-releasefilter value, so both calls return the correct subsets and the test genuinely exercises the real code pathTest plan
TestCleanupOldReleasesEmptyList— no panic on empty list (regression for #22)TestCleanupOldReleasesKeepsNewest— assets stripped from older full releases, newest keptTestCleanupOldReleasesPreReleasePromotion— pre-release deleted when full release is published (now exercises the live code path)go test ./internal/cmd/release/...passesAdditional tests added during review
TestCleanupOldReleasesPublishingPreRelease— publishing a pre-release strips assets from older pre-releases but does not touch full releasesTestCleanupOldReleasesPreReleaseBoundary— pre-releases with version >= the new full release tag are kept; only strictly-older ones are deletedTestCleanupOldReleasesNoAssets— older releases without assets are silently skippedTestListReleases_PreReleaseFilter— verifies thepre-releasequery parameter actually reaches the Forgejo HTTP endpointgolangci-lint run ./internal/...clean🤖 Generated with Claude Code
Code Review Summary
Ran a detailed review via the code-review-expert agent. Key findings:
Fixed
fakeAPI.ListReleasesfakeAPI.deletedintodeletedReleasesandstrippedAssetsso tests can distinguishDeleteReleasefromDeleteAttachmentscalls. This would catch the very regression the PR fixes.min(1, len(releases)):bounds-safe slice skippingStatus
Not addressed in this PR (noted for future)
pre-releasequery param actually reaching endpoint)The core fix is solid and regressions are now covered by improved test fidelity.
Pull request closed