Skip to content

fix(docs-issue-picker): require project-qualified issue input for GitLab migration, fixes #163 - #173

Merged
rfay merged 4 commits into
mainfrom
20260630_issue_url
Jul 25, 2026
Merged

rfay merged 4 commits into
mainfrom
20260630_issue_url

Conversation

@rfay

@rfay rfay commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Closes Support creating workspaces from Drupal GitLab issue forks and associated merge requests #163. Issue numbers are no longer globally unique now that drupal.org issue queues are migrating to GitLab per-project — the same number can mean two unrelated issues depending on whether it's a legacy drupal.org node ID or a per-project GitLab issue IID. Verified this collision live (e.g. NID 3565155 resolves to nothing in the classic API for media_image_metadata, since that issue only exists on GitLab).
  • Drops bare-number input from the picker entirely; every accepted issue reference now carries an explicit project (a full URL, or the existing PROJECT-NID fork shorthand).
  • Adds parsing for GitLab issue URLs (git.drupalcode.org/project/{project}/-/issues/{iid} and -/work_items/{iid}).
  • When a drupal.org issue URL is pasted for a project whose queue has since migrated, the classic api-d7 lookup comes back empty and the picker now falls back to the GitLab Issues API using the project name already captured from the URL.
  • No Terraform/template changes needed — the issue_fork/issue_branch params and the issue/{project}-{id} fork-branch convention on git.drupalcode.org are unchanged by the migration and already worked as opaque strings.

Manual test plan

Open the docs PR preview (link posted by the docs-preview workflow below) and paste each input into the picker's input field, confirming the described result. All examples are live, real issues/forks as of this PR.

# Input Expected result
1 3568144 Rejected: "Could not parse input..." (bare numbers no longer accepted)
2 https://www.drupal.org/project/drupal/issues/3568144 drupal-core template; branch 3568144-editorfilterxss-11.x preselected
3 https://www.drupal.org/project/token/issues/3595271 drupal-contrib template (token); branch 3595271-image-style-tokens preselected
4 https://git.drupalcode.org/project/media_image_metadata/-/issues/3565155 drupal-contrib template (media_image_metadata, GitLab-native issue); branch 3565155-numeric-metadata-values preselected
5 https://git.drupalcode.org/project/media_image_metadata/-/work_items/3565155 Same result as #4 (-/work_items/ is the other GitLab URL shape for the same issue)
6 https://git.drupalcode.org/project/media_image_metadata/-/issues/3558227 Info message: "No issue fork exists for #3558227 on media_image_metadata yet..." (this issue has no fork)
7 https://www.drupal.org/project/media_image_metadata/issues/3565155 Old-style drupal.org URL for a migrated issue — classic API returns empty, picker falls back to GitLab and produces the same result as #4
8 token-3595271 Issue-fork shorthand — same result as #3
9 drupal-3568144 Issue-fork shorthand — same result as #2
10 https://www.drupal.org/project/token Plain contrib project form (token), no issue fork
11 token Same as #10 (bare machine name still accepted — unambiguous, unrelated to the issue-ID collision problem)
12 not a valid input Rejected: "Could not parse input..."

Also confirmed:

  • node --check on the extracted <script> block passes (no syntax errors).
  • Ran the new parseInput() against all inputs above outside the browser (via node -e) to confirm the parsed {type, nid, project, source} shape before doing the live manual pass.

🤖 Generated with Claude Code

@rfay rfay changed the title fix(docs-issue-picker): require project-qualified issue input for GitLab migration fix(docs-issue-picker): require project-qualified issue input for GitLab migration, fixes #163 Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-25 20:10 UTC

Comment thread docs/drupal-issue.html Outdated

<h2 id="issue-forks">Issue forks</h2>
<p>An issue fork must already exist on <a class="cds-link" href="https://git.drupalcode.org">git.drupalcode.org</a> — use <strong>Get push access</strong> on the drupal.org issue to create one, then reload here.</p>
<p>An issue fork must already exist on <a class="cds-link" href="https://git.drupalcode.org">git.drupalcode.org</a> before it shows up here. For issues still on drupal.org, use <strong>Get push access</strong> on the issue page to create one. For projects whose issue queue has migrated to GitLab, create the fork from the issue's GitLab page instead — then reload here.</p>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitLab doesn't have a way to create an issue fork. It has to be done from the "Fork Management" page on drupal.org; something like this:

https://new.drupal.org/drupalorg/issue-fork/management?source_link=https://git.drupalcode.org/project/media_image_metadata/-/work_items/3558227

As far as I can tell, GitLab also doesn't provide an obvious link to that page, so maybe we can improve the messaging and provide a direct link?

Sadly, issues created on drupal.org issue queues cannot (currently) use the Fork Management page, so we have to keep the if statement in place based on the source of the issue (drupalorg vs gitlab).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is improved now, thanks for looking. I'll pull this when tests complete successfully.

rfay and others added 2 commits July 25, 2026 12:38
…t GitLab issue URLs

Drupal issue IDs are no longer globally unique now that drupal.org issue
queues are migrating to GitLab per-project (#163) - a bare
number can silently resolve to the wrong project. Drop bare-number input,
add GitLab issue URL parsing, and fall back to the GitLab Issues API when
a drupal.org issue lookup comes back empty because the project migrated.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…flow

The "no issue fork exists" message asserted a drupal.org-specific
"Get push access" button regardless of source, which is wrong for
GitLab-native issues (e.g. media_image_metadata/-/work_items/3558227)
and not something this tool verifies either way. It only needs to
report that no fork exists and point at the issue.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@rfay
rfay force-pushed the 20260630_issue_url branch from ad79d8a to aab372b Compare July 25, 2026 18:38
rfay and others added 2 commits July 25, 2026 13:33
…rg's Fork Management page

James Wilson's review on #173 noted GitLab has no self-service fork-creation
UI of its own -- the actual mechanism is drupal.org's Fork Management page
with a source_link query param pointing at the GitLab issue. The prior
follow-up commit fixed this in spirit but left the static "Issue forks"
prose still telling users to "create the fork from the issue's GitLab page,"
which is exactly the incorrect claim James flagged. Fix the prose and give
the dynamic no-fork message a working, pre-filled link instead of a bare
issue URL.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…orkspace names to 32 chars

Only the issue-fork name generator (suggestedIssueForkWorkspaceName) capped
its output to Coder's 32-character workspace name limit. The plain-project
and manual-form generators (syncPlainWorkspaceName, syncManualWorkspaceName,
and their launch-time fallbacks) built names the same way but never capped
them, so a long project machine name or version/profile combo could
auto-fill a suggestion that was already invalid with no indication of how
to fix it. Extract the existing cap logic into a shared capWorkspaceName()
helper and apply it consistently across all three name generators.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@rfay
rfay merged commit 69cd511 into main Jul 25, 2026
16 checks passed
@rfay
rfay deleted the 20260630_issue_url branch July 25, 2026 20:10
rfay added a commit that referenced this pull request Sep 21, 2026
…g the project

Once a contrib project's issue queue migrates to GitLab, its old drupal.org
node IDs get reused for unrelated content (e.g. node 3591879 is some other
project's release node, while GitLab issue ui_icons#3591879 is a real,
different issue — see #163). The workspace's issue-title/link lookup only
ever queried the classic drupal.org API, so for a migrated project it could
silently show an unrelated issue's title and link to a dead/wrong
drupal.org page instead of failing cleanly.

Verify the drupal.org lookup's field_project.machine_name actually matches
this project before trusting it, and fall back to GitLab's own
project-qualified issues API (git.drupalcode.org/project/.../-/issues/...)
when it doesn't match or drupal.org has no such node. Mirrors the same
fallback the docs issue picker already does (PR #173).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

Support creating workspaces from Drupal GitLab issue forks and associated merge requests

2 participants