Commit 52f706b
committed
fix(dao): Use upsert for resolved items junction tables
When the Evaluator stores resolved issues, the same issue message can be
reported for multiple packages at different timestamps. ORT's Issue
includes `timestamp` in its equals, so these survive as separate map keys
in `resolveResolutionsWithMappings()`.
However, `findOrtRunIssueId()` matches only on `source`, `message`,
`severity`, and `affectedPath` — not `timestamp` — so both map to the same
database row. When both match the same resolution, the second insert of the
identical `(ortRunId, ortRunIssueId, issueResolutionId)` tuple violates the
unique constraint.
Fix by changing `insert` to `upsert` for `ResolvedIssuesTable`,
`ResolvedRuleViolationsTable`, and `ResolvedVulnerabilitiesTable`, matching
the pattern already used for the `ResolvedConfigurations*` tables.
Resolves #4461.
Signed-off-by: Jyrki Keisala <jyrki.keisala@doubleopen.org>1 parent d760fd4 commit 52f706b
File tree
2 files changed
+51
-3
lines changed- dao/src
- main/kotlin/repositories/resolvedconfiguration
- test/kotlin/repositories/resolvedconfiguration
2 files changed
+51
-3
lines changedLines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
134 | 138 | | |
135 | 139 | | |
136 | 140 | | |
| |||
156 | 160 | | |
157 | 161 | | |
158 | 162 | | |
159 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
160 | 168 | | |
161 | 169 | | |
162 | 170 | | |
| |||
182 | 190 | | |
183 | 191 | | |
184 | 192 | | |
185 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
186 | 199 | | |
187 | 200 | | |
188 | 201 | | |
| |||
Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
367 | 402 | | |
368 | 403 | | |
369 | 404 | | |
| |||
0 commit comments