fix: resolve release notes issue links for GitLab work item projects#348
Merged
Conversation
Release notes treated every numeric ID in a commit title as a global
Drupal.org node ID. For projects migrated to GitLab work items, that ID is
a work item iid that is unique only within its project, so links pointed at
unrelated nodes and categories came back wrong. Tested against canvas 1.5.0
from 1.4.1, where every issue link was broken.
Detect GitLab projects via field_project_has_issue_queue. For those projects:
- Link to the work item web_url, falling back to the canonical
drupal.org/project/{project}/issues/{iid} URL when the GitLab fetch fails.
- Resolve the category from the category::* GitLab label, then a
conventional-commit prefix, then Misc.
- Filter contribution records by the work item URL.
Parse git.drupalcode.org remotes so the project machine name resolves
correctly for GitLab-hosted projects, and apply the conventional-commit
category fallback to legacy projects too.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address review findings: - formatLine builds each link via a callback instead of interpolating the URL into the preg_replace replacement, which avoids backreference mangling and escapes the href for HTML output. - Only override the issue link for GitLab projects, so legacy titles that reference several issues keep linking each "#nid" to its own node. - Emit the full result DTO for --format=json so consumers receive issue_links and is_gitlab, not just the categorized changes. - Report the resolved machine name as the project so it matches the links. - Skip change record lookup when the project nid resolves to an empty string. Add tests for the git.drupalcode.org remote parsing and the new json keys. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Context
maintainer:release-notes(rn,mrn) pulled a numeric ID out of each commit title and treated it as a global Drupal.org node ID — linking todrupal.org/node/{id}, fetching the category fromapi-d7/node/{id}.json, and filtering contributors by the node URL.That is wrong for projects migrated to GitLab work items. A work item iid is unique only within its project, so
drupal.org/node/{iid}points at an unrelated node (or 404s), categories come back wrong, and contributor lookups miss. Test case:canvas1.5.0 from 1.4.1 — every issue link was broken.This ports the fix already shipped in the web version,
drupal-mrn(commit d42f463), to the CLI's Action / Result / Command layering.What changed
field_project_has_issue_queueon the project node.web_url(git.drupalcode.org/project/{p}/-/work_items/{iid}); fall back to canonicaldrupal.org/project/{p}/issues/{iid}. Never a global node URL.category::*GitLab label, then a conventional-commit prefix (fix:→Bug,feat:→Feature,chore:→Task), then Misc. The conventional-commit fallback now applies to legacy projects too.contribution_recordby the work item URL.git.drupalcode.org/project/{name}(and issue-fork) remotes, which previously fell through to the directory name and broke GitLab detection.Files
GitLab/Client.php—getIssuesByIid()concurrent work item fetchDrupalOrg.php—getProject();getContributorsFromJsonApi()takes a keyedid => sourceURImapCommitParser.php—categoryFromConventionalCommit()GetMaintainerReleaseNotesAction.php— GitLab branch,issueLinksmap,isGitLabflag, remote parsingMaintainerReleaseNotesResult.php—issueLinks+isGitLabCli/Command/Maintainer/ReleaseNotes.php— link per-issue from the mapVerification
vendor/bin/phpunit(160 tests),phpcs,phpstan(level 6) all green. New unit cases: GitLabweb_url, GitLab 404→canonical fallback, conventional-commit data provider.canvasclone:git.drupalcode.org/project/canvas/-/work_items/{iid}. Reference issues categorize as in drupal-mrn:#3576410→Bug,#3555239→Bug (label wins over thechoreprefix),#3588438→Task.🤖 Generated with Claude Code