Fix issue URL generation for group-level work items using UrlBuilder
What does this MR do and why?
Replaces project-level issue/work item URL helpers with Gitlab::UrlBuilder to correctly support group-level work items (epics), which do not have an associated project.
Helpers like project_issue_url raise errors when passed group-level work items. This MR fixes those errors and adds EE spec coverage to prevent regressions
The change ensures:
- URLs are generated correctly for both project-level issues and group-level epics
- No errors are raised when serializing group-level work items
- URL generation logic is centralized and consistent with GitLab conventions
EE spec coverage has been added to prevent regressions.
References
-
issue - #579688
-
Sentry error referenced in the issue discussion
-
Gitlab::UrlBuilderdocumentation and existing usages
Screenshots or screen recordings
Not applicable.
This MR contains backend and serializer changes only, with no UI impact.
How to set up and validate locally
-
Ensure you are using a supported Ruby version (3.2.x):
rbenv local 3.2.6 -
Install dependencies:
bundle install -
Run the affected EE serializer specs:
bundle exec rspec \ ee/spec/serializers/vulnerabilities/feedback_entity_spec.rb \ ee/spec/serializers/vulnerabilities/issue_link_entity_spec.rb
The added specs cover group-level work items (epics) and would fail prior to this change.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.