fix(gitlab): discard label removal events on merge requests#2785
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the GitLab provider's event detection logic to determine if only labels have changed by comparing the length of current and previous labels. It also introduces a helper function and several test cases to verify different label change scenarios. The review feedback points out a critical bug in this implementation: comparing only the slice lengths fails to detect label changes when a label is added and another is removed simultaneously (as the total count remains unchanged). A code suggestion is provided to correctly identify when at least one new label has been added, along with a recommendation to add a corresponding test case for this scenario.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2785 +/- ##
==========================================
+ Coverage 60.19% 60.20% +0.01%
==========================================
Files 211 211
Lines 21274 21280 +6
==========================================
+ Hits 12806 12812 +6
Misses 7671 7671
Partials 797 797 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
why lint rules are forced in this PR 🤔 |
e0d0fff to
494b7fc
Compare
494b7fc to
2e6f8f9
Compare
|
/retest |
Label removal events on GitLab merge requests were incorrectly triggering pipeline runs. The hasOnlyLabelsChanged check used an OR condition that matched both additions and removals. Changed to compare current vs previous label count so only label additions are processed. Signed-off-by: Zaki Shaikh <zashaikh@redhat.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2e6f8f9 to
9951a1d
Compare
📝 Description of the Change
Label removal events on GitLab merge requests were incorrectly triggering pipeline runs. The hasOnlyLabelsChanged check used an OR condition that matched both additions and removals. Changed to compare current vs previous label count so only label additions are processed.
🔗 Linked GitHub Issue
Fixes #
🧪 Testing Strategy
🤖 AI Assistance
AI assistance can be used for various tasks, such as code generation,
documentation, or testing.
Please indicate whether you have used AI assistance
for this PR and provide details if applicable.
Important
Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project's standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.
If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message.For example:
Co-authored-by: Claude noreply@anthropic.com
✅ Submitter Checklist
fix:,feat:) matches the "Type of Change" I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.