fix: improve MR detection with branch normalization
Description
Summary
This MR improves the robustness and correctness of merge request detection for the current branch without changing any user-facing behavior.
Changes
- Normalizes branch names before querying the GitLab API
- Selects open merge requests deterministically (most recently updated, non-draft)
- Filters out draft/WIP merge requests
- Centralizes MR lookup logic into a single helper
- Adds graceful fallback behavior on API failures
- Avoids redundant API calls via early-return checks
Scope
- No UI or UX changes
- No new commands or settings
- Existing behavior remains unchanged
Related issue
Closes #2208
Improves the robustness of merge request detection logic for the current branch without changing any user-facing behavior.
Related Issues
Resolves #[issue_number]
How has this been tested?
- Verified behavior manually by switching branches with and without open merge requests
- Confirmed fallback behavior when no open MR exists
-
If
src/browserorsrc/commonhas been modified, please consider interoperability with the Web IDE. See Running the Extension in WebIDE. - Consider an end-to-end test for significant new features that aren't covered by integration tests.
Screenshots (if appropriate)
What CHANGELOG entry will this MR create?
N/A (no UI changes)
-
fix:Bug fix fixes - a user-facing issue in production - included in changelog -
feature:New feature - a user-facing change which adds functionality - included in changelog -
BREAKING CHANGE:(fix or feature that would cause existing functionality to change) - should bump major version, mentioned in the changelog - None - other non-user-facing changes
Closes #2208