Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭 适合新手
#9,283 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
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 进行比较。检查此任务现有的测试,并添加一个小写分支键关联到大写存储键的案例。完成标准是 pipeline 为该案例创建预期的 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
派生
832
平均合并
2 天 6 小时
30 天内合并 PR
62

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/devlake 的其他 Issue

查看 apache/devlake 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。