fix(update-major-tag): guard major tag push against concurrent rewinds#235
Merged
fix(update-major-tag): guard major tag push against concurrent rewinds#235
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughReplaced forced push operation with lease-based force push for major tag updates. Workflow now queries remote commit SHA for the major tag via Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Contributor
🔍 Lint Analysis
|
Contributor
🛡️ CodeQL Analysis ResultsLanguages analyzed: ✅ No security issues found. 🔍 View full scan logs | 🛡️ Security tab |
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.
GitHub Actions Shared Workflows
Description
Fixes a TOCTOU race flagged by CodeRabbit on PR #233 for the floating-major-tag update composite (
src/config/update-major-tag/action.yml).Problem
self-release.ymlandrelease.ymldo not define aconcurrency:block, so two release runs onmain(e.g. back-to-back merges) can overlap. If run A resolvesLATEST=v1.26.0while run B resolvesLATEST=v1.27.0and finishes its push first (movingv1 → def), run A's subsequentgit push --forcewould silently rewindv1back toabc(v1.26.0). Consumers pinning to@v1would regress until the next release.Fix
Replace the unconditional
--forcewith--force-with-lease, reading the current remote SHA viagit ls-remotefirst:If another run advanced
$MAJORbetween the lease read and the push, the push fails loudly instead of rewinding the tag. The zero-SHA fallback handles the first-ever push (tag not yet present on remote).Affected file:
src/config/update-major-tag/action.ymlType of Change
feat: New workflow or new input/output/step in an existing workflowfix: Bug fix in a workflow (incorrect behavior, broken step, wrong condition)perf: Performance improvement (e.g. caching, parallelism, reduced steps)refactor: Internal restructuring with no behavior changedocs: Documentation only (README, docs/, inline comments)ci: Changes to self-CI (workflows under.github/workflows/that run on this repo)chore: Dependency bumps, config updates, maintenancetest: Adding or updating testsBREAKING CHANGE: Callers must update their configuration after this PRBreaking Changes
None. The lease-based push succeeds in every case the previous unconditional
--forcedid, except when a concurrent run has already advanced the tag — which is exactly the scenario we want to detect and abort.Testing
@developor the beta tagCaller repo / workflow run: Next
mainrelease in this repo will exercise the composite end-to-end (self-release.yml is the only caller).Related Issues
Related to #233 — surfaced by CodeRabbit review on that PR.
Summary by CodeRabbit