Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Bug][linker] LinkPrToIssue never matches lowercase issue keys (e.g. in branch names)

オープン 初心者向け
#9,283 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go, sql
領域
backend, databases

調査の方向性

backend/plugins/linker/tasks/link_pr_and_issue.goから始め、LinkPrToIssueがpull requestのフィールドからキーを抽出し、issues.issue_keyと比較する方法を追ってください。このタスクの既存テストを確認し、小文字のブランチキーが大文字の保存済みキーにリンクされるケースを追加してください。このケースでパイプラインが期待されるpull_request_issues行を作成すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

type/bug
Search before asking
  • I had searched in the issues and found no similar issues.
What happened

The linker plugin's LinkPrToIssue subtask compares the keys extracted from a PR (title, description or head ref) against issues.issue_key with an exact, case-sensitive match. normalizeIssueKey only strips # and whitespace.

Some issue trackers generate lowercase branch names from the issue key, e.g. user/proj-123-short-title for issue PROJ-123. Since #8777, head refs are searched, but even with a case-insensitive prToIssueRegexp such as (?i)\b(PROJ)-\d+\b, the extracted key is proj-123. It never equals the stored key PROJ-123, so the PR is silently left unlinked.

In my instance, about 5% of PRs that contain a key are affected, namely those where the key appears only in the branch name.

What do you expect to happen

Matching should be case-insensitive, or the extracted key should be normalized to match the stored issue_key, so that proj-123 links to PROJ-123.

How to reproduce
  1. Sync an issue tracker with an issue keyed PROJ-123 and a GitHub repo into one project.
  2. Open a PR whose head ref is user/proj-123-short-title, with no key in the title or description.
  3. Enable the linker plugin with prToIssueRegexp = (?i)\b(PROJ)-\d+\b.
  4. Run the project pipeline.
  5. pull_request_issues has no row for this PR.
Anything else

Suggested fix in backend/plugins/linker/tasks/link_pr_and_issue.go: compare case-insensitively, e.g. uppercase the extracted keys and match with UPPER(issues.issue_key) IN ?. Uppercasing in normalizeIssueKey alone would only work for trackers with uppercase keys.

A related limitation is that the enricher stops at the first field (title, then description, then head ref) with any regex match. A PR with an unrelated match in the title, such as CVE-2024-0000, never has its description or branch checked, so a real key there is ignored. I can open that as a separate issue if preferred.

Version

v1.0.3-beta18

Are you willing to submit PR?
  • Yes I am willing to submit a PR!
Code of Conduct
主要言語
Go
スター
3.2k
フォーク
830
平均マージ
2日 6時間
マージ済み PR(30日)
62

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/devlake のほかの issue

apache/devlake の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。