Commit a2dc276
authored
fix(api): update suite metadata on re-index when name changes (#189)
## Summary
- Fixes suite `labels.name` not updating in the database when it changes
between runs (while suite hash stays the same)
- Root cause: `UpsertSuite` passed the same struct pointer to both
GORM's `Assign()` and `FirstOrCreate()`, making it first-write-wins —
when the record was found, `FirstOrCreate` populated the struct with DB
values before `Assign` could apply the updates
- Fix: use a map for `Assign()` so update values are independent of the
struct pointer
## Test plan
- [x] Added `TestStore_UpsertSuiteUpdatesName` — upserts a suite, then
upserts again with a different name, asserts the name is updated
- [x] All existing indexstore tests pass1 parent 9bfe80c commit a2dc276
2 files changed
Lines changed: 37 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
| 681 | + | |
| 682 | + | |
681 | 683 | | |
682 | 684 | | |
683 | 685 | | |
684 | | - | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
685 | 692 | | |
686 | 693 | | |
687 | 694 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
0 commit comments