[Bug][Tempo] Worklog domain ids lack the connection id, so connections with the same worklog id overwrite each other
维护者通常 2 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- go
调研方向
从 backend/plugins/tempo/tasks/worklog_convertor.go 开始,检查它如何构建 worklog 领域 ID;将其与 TempoWorklog 主键以及 issue 中描述的其他连接作用域 ID 进行比较。添加一个单元测试,覆盖两个连接具有相同 worklog ID 的情况。完成标准是每个连接都会生成一条不同的 issue_worklogs 记录,并且测试通过。
由索引模型根据 Issue 内容生成。
描述
Search before asking
- I had searched in the issues and found no similar issues.
What happened
The Tempo convert_worklogs subtask (backend/plugins/tempo/tasks/worklog_convertor.go) builds the issue_worklogs id from the Tempo worklog id alone:
domainWorklogId := fmt.Sprintf("tempo:TempoWorklog:%d", tempoWorklog.TempoWorklogId)
The tool layer keys worklogs by (connection_id, tempo_worklog_id) (models.TempoWorklog), and the other ids of the same row (jira:JiraIssue:<conn>:<id>, jira:JiraAccount:<conn>:<id>) carry the connection id. Domain ids that didgen generates for other plugins carry it too. The worklog id doesn't.
So when two Tempo connections have a worklog with the same tempoWorklogId (two connections to the same Tempo instance, or two instances whose worklog ids overlap), both convert to the same issue_worklogs primary key. The connection converted last overwrites the other connection's row (its issue_id, author_id and _raw_data_params), so one of the two worklogs disappears from the domain layer.
Example: connection 1 and connection 2 both have worklog 12345. After converting connection 1 and then connection 2, issue_worklogs has one row, tempo:TempoWorklog:12345, which points to jira:JiraIssue:2:.... Connection 1's worklog is gone. Re-running connection 1 brings it back and drops connection 2's.
What do you expect to happen
Each connection's worklog gets its own domain row: tempo:TempoWorklog:<connectionId>:<tempoWorklogId>, the id didgen would generate from the TempoWorklog primary key.
How to reproduce
- Create two Tempo connections (ids 1 and 2) that both return a worklog with the same
tempoWorklogId. - Collect, extract and convert worklogs for a team scope of each connection.
SELECT id, issue_id, _raw_data_params FROM issue_worklogs WHERE id LIKE 'tempo:%'shows one row for that worklog instead of two.
Anything else
Proposed fix (I have a PR ready): add the connection id to the domain worklog id and add a unit test. No migration is needed: the converter is a full-sync DataConverter, so its first batch deletes the scope's old rows (same _raw_data_table / _raw_data_params) before it saves the rows with the new ids.
Version
main
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
- 主要语言
- Go
- 星标
- 3.2k
- 派生
- 832
- 平均合并
- 1 天 21 小时
- 30 天内合并 PR
- 78
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/devlake 的其他 Issue
-
[Bug][Testmo] Runs, milestones and automation runs: only the first 100 are collected可能已有人在做 @ShivamSharma43 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
[Bug][linker] LinkPrToIssue never matches lowercase issue keys (e.g. in branch names)可能已有人在做 @VictorColomb 于 4 天前认领。 未关闭type/bug
难度 2/5 1-3 小时 新手友好度 78/100
apache/devlake#9283 · 1 条评论 · 1 个 reaction · 已指派 1 人 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 60/100
维护者通常 2 天内回复
-
type/bug
难度 4/5 3-5 天 新手友好度 51/100
维护者通常 2 天内回复
-
[Bug][JIRA Service API TOKEN] Jira API Gateway: saved service-account token truncated by varchar(255), causing Base64 errors and HTTP 500可能已有人在做 @RyoKusnadi 今天认领。 未关闭type/bug
难度 3/5 1-2 天 新手友好度 58/100
维护者通常 2 天内回复
相似的 Issue
-
needs-triage
难度 2/5 1-3 小时 新手友好度 72/100
stacklok/toolhive-catalog#1890 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
integrations/terraform-provider-github#3719 · 1 条评论 ·
维护者通常 1 天内回复
-
Wayfinder sample agents don't reach the Data Plane on the quickstart pack可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭Type/Bug
难度 2/5 1-3 小时 新手友好度 82/100
thunder-id/thunderid#6402 ·
维护者通常 1 天内回复
-
GoStratumEngine未关闭addition
难度 1/5 1 小时以内 新手友好度 72/100
awesome-selfhosted/awesome-selfhosted-data#3290 ·
维护者通常 1 天内回复
-
log4j2.xml from orchestration.extraConfiguration is rendered twice, and the install fails when orchestration.log4j2 is also set可能已有人在做 @irisfield 今天认领。 未关闭platform/local
难度 2/5 1-3 小时 新手友好度 78/100
camunda/camunda-platform-helm#7854 ·
维护者通常 1 天内回复