Commit 0141159
committed
fix: duplicate alias in sibling includes silently breaks nested children
When two sibling includes in .select() used the same alias (e.g.,
{ i: issues } and { i: tags }), nested child collections silently
produced empty results. The root cause was that all includes aliases
were flattened into a single namespace — sharing one D2 graph input
and one subscription, so the second sibling's collection data
overwrote the first.
Fix: give each includes subquery its own independent D2 input.
- extractCollectionAliases no longer traverses into IncludesSubquery
nodes, keeping collectionByAlias scoped to the top-level query.
- compileQuery accepts a createInput factory; when processing includes,
each child gets fresh inputs for its source aliases via
collectAllSourceAliases + createInput().
- compileBasePipeline merges the new inputs into inputsCache and
compiledAliasToCollectionId under unique keys (__inc_N_alias),
so each gets its own subscription feeding the correct collection.1 parent e8e029e commit 0141159
File tree
4 files changed
+168
-5
lines changed- packages/db
- src/query
- compiler
- live
- tests/query
4 files changed
+168
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
115 | 127 | | |
116 | 128 | | |
117 | 129 | | |
| |||
141 | 153 | | |
142 | 154 | | |
143 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
144 | 160 | | |
145 | 161 | | |
146 | 162 | | |
| |||
316 | 332 | | |
317 | 333 | | |
318 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
319 | 339 | | |
320 | 340 | | |
321 | 341 | | |
| |||
391 | 411 | | |
392 | 412 | | |
393 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
394 | 427 | | |
395 | 428 | | |
396 | 429 | | |
397 | | - | |
| 430 | + | |
398 | 431 | | |
399 | 432 | | |
400 | 433 | | |
| |||
405 | 438 | | |
406 | 439 | | |
407 | 440 | | |
| 441 | + | |
408 | 442 | | |
409 | 443 | | |
410 | | - | |
411 | | - | |
412 | | - | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
413 | 448 | | |
414 | 449 | | |
415 | 450 | | |
| |||
710 | 745 | | |
711 | 746 | | |
712 | 747 | | |
| 748 | + | |
| 749 | + | |
713 | 750 | | |
714 | 751 | | |
715 | 752 | | |
| |||
741 | 778 | | |
742 | 779 | | |
743 | 780 | | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
744 | 813 | | |
745 | 814 | | |
746 | 815 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
691 | 691 | | |
692 | 692 | | |
693 | 693 | | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
694 | 699 | | |
695 | 700 | | |
696 | 701 | | |
697 | 702 | | |
698 | 703 | | |
699 | 704 | | |
700 | 705 | | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
701 | 716 | | |
702 | 717 | | |
703 | 718 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
145 | 149 | | |
146 | | - | |
| 150 | + | |
147 | 151 | | |
148 | 152 | | |
149 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4061 | 4061 | | |
4062 | 4062 | | |
4063 | 4063 | | |
| 4064 | + | |
| 4065 | + | |
| 4066 | + | |
| 4067 | + | |
| 4068 | + | |
| 4069 | + | |
| 4070 | + | |
| 4071 | + | |
| 4072 | + | |
| 4073 | + | |
| 4074 | + | |
| 4075 | + | |
| 4076 | + | |
| 4077 | + | |
| 4078 | + | |
| 4079 | + | |
| 4080 | + | |
| 4081 | + | |
| 4082 | + | |
| 4083 | + | |
| 4084 | + | |
| 4085 | + | |
| 4086 | + | |
| 4087 | + | |
| 4088 | + | |
| 4089 | + | |
| 4090 | + | |
| 4091 | + | |
| 4092 | + | |
| 4093 | + | |
| 4094 | + | |
| 4095 | + | |
| 4096 | + | |
| 4097 | + | |
| 4098 | + | |
| 4099 | + | |
| 4100 | + | |
| 4101 | + | |
| 4102 | + | |
| 4103 | + | |
| 4104 | + | |
| 4105 | + | |
| 4106 | + | |
| 4107 | + | |
| 4108 | + | |
| 4109 | + | |
| 4110 | + | |
| 4111 | + | |
| 4112 | + | |
| 4113 | + | |
| 4114 | + | |
| 4115 | + | |
| 4116 | + | |
| 4117 | + | |
| 4118 | + | |
| 4119 | + | |
| 4120 | + | |
| 4121 | + | |
| 4122 | + | |
| 4123 | + | |
| 4124 | + | |
| 4125 | + | |
| 4126 | + | |
| 4127 | + | |
| 4128 | + | |
| 4129 | + | |
| 4130 | + | |
| 4131 | + | |
| 4132 | + | |
| 4133 | + | |
| 4134 | + | |
| 4135 | + | |
| 4136 | + | |
| 4137 | + | |
| 4138 | + | |
4064 | 4139 | | |
0 commit comments