-
Notifications
You must be signed in to change notification settings - Fork 8
PRs Detection Error Reporting System
JElsheikh edited this page Nov 8, 2025
·
1 revision
This document describes the error reporting system implemented to help debug GitLab merge request detection issues across different GitLab versions and configurations.
Users on certain GitLab versions (especially self-hosted enterprise instances) experience detection failures where the extension doesn't recognize their MR pages. This system collects comprehensive environment data to help identify patterns and fix detection logic.
A modular, reusable service that:
- Safely collects comprehensive debug information about the page
- Uses defensive coding (optional chaining, nullish coalescing) to prevent errors
- Sends data to background script for forwarding to cloud function
Key Features:
- Safe DOM element detection
- URL pattern analysis
- Platform detector state capture
- GitLab version detection via meta tags
- Browser and extension info collection
Error reporting is triggered at these key detection failure points:
- Detection failure - "Current page does not need button"
- Panel injection blocked - Not on supported page
- User clicked AI Review on unsupported page
- Platform initialization error
- GitLab MR info extraction error
Added handler for LOG_DETECTION_ISSUE message type (line ~528):
- Extracts user email from storage
- Forwards debug data to cloud function
- Handles anonymous users gracefully
-
URL Information
- Full URL, hostname, pathname, search params
- Essential for understanding URL variations
-
Path Analysis
- Tests for
/merge_requests/,/-/merge_requests/, etc. - Identifies which patterns match/fail
- Extracts MR ID from path
- Tests for
-
DOM Elements
- Checks for GitLab-specific CSS classes
- Helps distinguish URL issues from DOM issues
- Detects different GitLab UI versions
-
Meta Tags
- Generator tag often contains GitLab version
- Example: "GitLab 14.5.2"
-
Platform Detector State
- Full detection result object
- Shows why detection failed
-
Custom Domains
- Lists user-configured GitLab domains
- Helps identify registration issues