fix(push-hook): retry MR commits fetch to handle GitLab async race condition#173
Closed
sylvaincombes wants to merge 1 commit into
Closed
fix(push-hook): retry MR commits fetch to handle GitLab async race condition#173sylvaincombes wants to merge 1 commit into
sylvaincombes wants to merge 1 commit into
Conversation
…ndition When Homer receives a push hook, it filters commits by cross-referencing the GitLab MR commits API. Because GitLab updates MR content asynchronously, the just-pushed commit is sometimes absent from the API response, causing Homer to silently return 204 and skip the Slack notification. Fix: poll the MR commits endpoint (up to 5s, 1s intervals) until the pushed commit appears, then fall back to a final fetch on timeout.
Member
Author
|
Closing — opened prematurely, still iterating. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #173 +/- ##
==========================================
- Coverage 89.29% 89.12% -0.17%
==========================================
Files 104 105 +1
Lines 2269 2289 +20
Branches 440 441 +1
==========================================
+ Hits 2026 2040 +14
- Misses 230 236 +6
Partials 13 13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
When Homer receives a push hook, it filters the pushed commits by cross-referencing the GitLab MR commits API (to remove rebase noise). Because GitLab updates MR content asynchronously, the just-pushed commit is sometimes absent from the API response at the time Homer fetches it.
Flow:
Fix
Add a
waitForMergeRequestCommitsutility that polls the MR commits endpoint (up to 5 s, 1 s intervals) until at least one of the pushed commits appears, then falls back to a final fetch on timeout.This follows the same pattern as the existing
waitForReleasePipelineutility.Changes
src/review/commands/share/utils/waitForMergeRequestCommits.ts— new polling utilitysrc/review/commands/share/hookHandlers/pushHookHandler.ts— use the new utility instead of a direct fetch__tests__/review/pushHook.test.ts— update mock to return a matching commit (the "no related review" test was asserting on the wrong layer; the 204 comes from no review in DB, not from empty commits)