JiraIssueChangelogItems primary key collision when Jira reports multiple items with the same field in one changelog entry
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 64/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- backend, data-engineering, databases
Direzione di ricerca
Inizia da backend/plugins/jira/models/issue_changelog.go, quindi segui il percorso di upsert dell’estrattore Jira per JiraIssueChangelogItems. Riproduci i due elementi con lo stesso campo e analizza le implicazioni della modifica dello schema; il lavoro è completato quando entrambi gli elementi persistono senza collisioni dopo una nuova estrazione, con una copertura di regressione per il caso segnalato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 3.1k
- Fork
- 812
- Merge medio
- 1g 23h
- PR unite (30g)
- 51
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/devlake
-
type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
type/bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Tutte le issue di apache/devlake
Issue simili
-
nix: vendorHash is outdated Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Bob Shell support Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
santhosh-tekuri/jsonschema#276 ·