Skip to content

fix: resolve release notes issue links for GitLab work item projects#348

Merged
mglaman merged 2 commits into
mainfrom
fix/release-notes-gitlab-work-items
Jun 4, 2026
Merged

fix: resolve release notes issue links for GitLab work item projects#348
mglaman merged 2 commits into
mainfrom
fix/release-notes-gitlab-work-items

Conversation

@mglaman

@mglaman mglaman commented Jun 4, 2026

Copy link
Copy Markdown
Owner

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 to drupal.org/node/{id}, fetching the category from api-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: canvas 1.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

  • Detect GitLab projects via field_project_has_issue_queue on the project node.
  • Issue link — prefer the work item web_url (git.drupalcode.org/project/{p}/-/work_items/{iid}); fall back to canonical drupal.org/project/{p}/issues/{iid}. Never a global node URL.
  • Category — from the 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.
  • Contributors — filter contribution_record by the work item URL.
  • Project name resolution — parse git.drupalcode.org/project/{name} (and issue-fork) remotes, which previously fell through to the directory name and broke GitLab detection.

Files

  • GitLab/Client.phpgetIssuesByIid() concurrent work item fetch
  • DrupalOrg.phpgetProject(); getContributorsFromJsonApi() takes a keyed id => sourceURI map
  • CommitParser.phpcategoryFromConventionalCommit()
  • GetMaintainerReleaseNotesAction.php — GitLab branch, issueLinks map, isGitLab flag, remote parsing
  • MaintainerReleaseNotesResult.phpissueLinks + isGitLab
  • Cli/Command/Maintainer/ReleaseNotes.php — link per-issue from the map

Verification

  • vendor/bin/phpunit (160 tests), phpcs, phpstan (level 6) all green. New unit cases: GitLab web_url, GitLab 404→canonical fallback, conventional-commit data provider.
  • Smoke test against a real canvas clone:
    drupalorg mrn 1.4.1 1.5.0 --format=md
    
    Links now resolve to git.drupalcode.org/project/canvas/-/work_items/{iid}. Reference issues categorize as in drupal-mrn: #3576410→Bug, #3555239→Bug (label wins over the chore prefix), #3588438→Task.

🤖 Generated with Claude Code

mglaman and others added 2 commits June 4, 2026 11:03
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>
@mglaman mglaman merged commit a6a6228 into main Jun 4, 2026
9 checks passed
@mglaman mglaman deleted the fix/release-notes-gitlab-work-items branch June 4, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant