JiraIssueChangelogItems primary key collision when Jira reports multiple items with the same field in one changelog entry
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 64/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- go
調査の方向性
backend/plugins/jira/models/issue_changelog.go から始め、JiraIssueChangelogItems に対する Jira extractor の upsert パスを追跡します。同じフィールドを持つ 2 つの item を再現し、schema change の影響を調査します。再抽出後も両方の item が衝突なしに永続化され、報告されたケースの regression coverage が追加されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
JiraIssueChangelogItems has a composite primary key of (ConnectionId, ChangelogId, Field). When Jira returns multiple items with the same Field value within a single changelog history entry, the second item silently overwrites the first on upsert.
Steps to reproduce
- Have a Jira issue where a single-value field (e.g.
fixVersions) is changed from value A to value B in one action - Jira's API represents this as two changelog items in the same history entry:
Fix Version: null → B(add)Fix Version: A → null(remove)
- Both items share the same
ChangelogIdandField = "Fix Version" - Run the Jira extractor — only one item survives in
_tool_jira_issue_changelog_items
Expected behavior
Both changelog items should be stored — the add and the remove.
Actual behavior
The second item overwrites the first because they collide on the primary key (ConnectionId, ChangelogId, Field).
Impact
Any downstream query that relies on changelog items to detect whether a specific value was ever added to a field (e.g. filtering issues by historical fixVersions) will produce incorrect results. This affects fixVersions, labels, components, affectedVersions, and any other field where Jira emits multiple items with the same field name in one history entry.
Suggested fix
Add a disambiguating column to the primary key — for example an item ordinal/index within the changelog entry. The model is in backend/plugins/jira/models/issue_changelog.go:
type JiraIssueChangelogItems struct {
ConnectionId uint64 `gorm:"primaryKey"`
ChangelogId uint64 `gorm:"primaryKey"`
Field string `gorm:"primaryKey"`
// no item-level disambiguator
}
Existing data would need re-extraction after the schema change, since collided rows already lost one of the two items.
Version
Verified on v1.0.3-beta10 and confirmed the PK is unchanged on main as of 2026-08-17.
- 主要言語
- Go
- スター
- 3.1k
- フォーク
- 812
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 51
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/devlake のほかの issue
-
type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
type/bug
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
Bob Shell support オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
santhosh-tekuri/jsonschema#276 ·