Skip to content

Support migrated GitLab work items in issue:branch and bare NID resolution - #385

Merged
mglaman merged 8 commits into
mainfrom
fix/migrated-issue-branch
Sep 16, 2026
Merged

mglaman merged 8 commits into
mainfrom
fix/migrated-issue-branch

Conversation

@mglaman

@mglaman mglaman commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Fixes #380.

issue:branch failed for an issue that migrated from Drupal.org to a GitLab work item, in every form the reporter tried: bare NID, project#nid, and the work item URL. The error said the node was not found, which was wrong.

What changed

  • Migrated nodes are recognized. Drupal.org answers a migrated NID with a stub whose only field is new_url. Client::getNode() now throws MigratedIssueException carrying the parsed work item ref. The message names the qualified ref to pass. Commands without work item support show that instead of "not found".
  • Bare NIDs resolve. IssueProjectResolver takes the project from that ref, so issue:get-fork 3617735, issue:setup-remote 3617735, and issue:checkout 3617735 work with no qualifier and no extra request.
  • issue:branch supports work items. The action takes the ref, or follows a migrated node to GitLab. The branch slug comes from the work item title. The base branch comes from the version label (v2.0.x-dev gives 2.0.x) and falls back to the project's default branch when there is no version label, which is the case on ai_context.
  • issue:show follows the migration. A bare NID for a migrated issue renders the work item instead of stopping with the migration error.
  • Wrong-repository message names the work item. When the redirect points at project A and you are in a clone of project B, the resolver says the work item lives in A instead of offering a Drupal.org issue that no longer exists.
  • IssueCommandBase opens the repository for work item refs. It returned early after parsing project#nid or a URL, so any command that used the repository crashed with an uninitialized property.
  • The slug and version-branch rules move from IssueNode to IssueBranchNaming so both sources name branches the same way. That commit is a pure refactor.

Testing

Unit tests cover the migrated stub in getNode(), the resolver with and without a repository project, the collision case, work items with and without a version label, and a bare NID that follows the redirect to GitLab.

Live, in a clone of restrict_route_by_ip, without a token:

drupalorg issue:branch 3617735
drupalorg issue:branch restrict_route_by_ip#3617735
drupalorg issue:branch https://git.drupalcode.org/project/restrict_route_by_ip/-/work_items/3617735

Each checks out 2.0.x and creates 3617735-fix_js_on_add_form_a. issue:show 3617735, issue:get-fork 3617735, and issue:checkout 3617735 also work with the bare NID. issue:setup-remote 3617735 from a clone of poll prints the work item collision message and adds no remote.

🤖 Generated with Claude Code

mglaman and others added 8 commits September 16, 2026 09:58
… found"

Drupal.org answers a migrated node ID with a stub whose only field is
new_url. getNode() read that as a missing node. It now throws
MigratedIssueException carrying the parsed work item ref, and the
message names the qualified ref to pass.

IssueProjectResolver takes the project from that ref, so a bare NID
resolves for issue:get-fork, issue:setup-remote, and issue:checkout
without a qualifier.

Refs #380

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
No behavior change. The slug and version-branch rules move to
IssueBranchNaming so a GitLab work item can name its branch the same
way a Drupal.org issue does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The command parsed project#nid and work item URLs but then discarded
the ref and read the Drupal.org node, which fails for migrated issues.
The action now takes the ref, or follows a migrated node to GitLab,
and names the branch from the work item title and its version label
(for example v2.0.x-dev). Work items without a version label fall back
to the project's default branch.

Fixes #380

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ue error

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…item ref

IssueCommandBase returned early after parsing project#nid or a work
item URL and never opened the repository, so issue:branch crashed with
an uninitialized property for those forms.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A bare NID for a migrated issue now renders the work item instead of
stopping with the migration error. The command already had the GitLab
path; it only needed to catch MigratedIssueException and reuse it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…he repository

The generic collision message offered a Drupal.org issue that no longer
exists. A migrated issue in another project now says where the work
item lives and asks for a clone of that project.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mglaman
mglaman merged commit 87e7361 into main Sep 16, 2026
9 checks passed
@mglaman
mglaman deleted the fix/migrated-issue-branch branch September 16, 2026 15:26
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.

Commands fail when a node was migrated from Drupal.org to a GitLab work item

1 participant