Commit e14d516
fix(databases): preserve runtime-only relationship attrs on resetDatabases() (RE-7)
The removal loop in initStores() was dropping runtime-only attributes — like
relationship attrs added via GraphQL `@relationship` — because table()'s
persistence loop intentionally `continue`s past them (databases.ts:1138), so
they appear in `existingAttributes` (table.attributes) but not in the
`attributes` list rebuilt from attributesDbi. updatedAttributes() then stripped
the resolver/search support, breaking nested GraphQL queries after any
resetDatabases() / hot-reload — the symptom that showed up in CI as 8 failing
`handles query by nested attribute` assertions in graphql-querying-test and the
404/501 RESTProperties failures.
Also fixes a splice-while-iterating bug in the same loop: splicing the array
being walked by `for...of` skipped the next element, so two adjacent removals
(e.g. `breed` and `age` in the regression test) only dropped one. The loop now
collects into `toRemove` and applies the splices after iteration.
Adds a unit test that injects a relationship attr and asserts it survives a
resetDatabases() call, and extends the removal test's comment to explain why
the two-adjacent-removal pattern is intentional.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 86d89be commit e14d516
2 files changed
Lines changed: 47 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
641 | 645 | | |
642 | 646 | | |
643 | 647 | | |
| |||
658 | 662 | | |
659 | 663 | | |
660 | 664 | | |
661 | | - | |
662 | | - | |
| 665 | + | |
663 | 666 | | |
664 | | - | |
665 | | - | |
666 | | - | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
667 | 674 | | |
668 | 675 | | |
669 | 676 | | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
670 | 681 | | |
671 | 682 | | |
672 | 683 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
453 | | - | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
454 | 457 | | |
455 | 458 | | |
456 | 459 | | |
| |||
467 | 470 | | |
468 | 471 | | |
469 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
470 | 500 | | |
471 | 501 | | |
472 | 502 | | |
| |||
0 commit comments