Commit 8219721
authored
fix(run-store,webapp): correct split-database read routing, write residency, and batches list ordering (#4272)
## Summary
Correctness and performance fixes for deployments that split run data
across more than one database. Single-database / self-hosted deployments
are unaffected (they collapse to a single read/write path).
- **Batches list (dashboard):** for some organizations the Batches list
could hide older batches or show them out of order. It now orders and
paginates by creation time (with the id as a stable tiebreak), so every
batch appears exactly once, newest first. The pagination cursor format
changes; older in-flight cursors simply restart from the first page.
- **Reads:** waitpoint and snapshot lookups that are keyed by a single
run now read only the database that holds that run instead of querying
both, removing redundant queries on hot paths (unblock, snapshot reads).
- **Writes:** environment-scoped writes with no owning run (standalone
wait tokens, waitpoint tags, idempotency-key resets) now land in the
same database as that environment's runs, rather than defaulting to the
other one. An idempotency-key reset also falls back to the other
database when it matches nothing, so a reset still clears the key
wherever the run actually lives.
## Notes
Verified end-to-end against multi-database setups: run-keyed reads and
env-scoped writes land on the correct database with no cross-database
writes, and the batches list surfaces every batch in creation order. New
tests cover the batches ordering/reachability and the write-residency
routing.1 parent 0ff0abd commit 8219721
16 files changed
Lines changed: 1265 additions & 134 deletions
File tree
- apps/webapp
- app
- models
- presenters/v3
- routes
- v3/services
- test
- internal-packages
- run-engine/src/engine
- systems
- run-store/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
27 | 35 | | |
28 | 36 | | |
29 | 37 | | |
| |||
Lines changed: 69 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
46 | 68 | | |
47 | 69 | | |
48 | 70 | | |
| |||
86 | 108 | | |
87 | 109 | | |
88 | 110 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
97 | 119 | | |
98 | | - | |
99 | | - | |
| 120 | + | |
100 | 121 | | |
101 | 122 | | |
102 | 123 | | |
| |||
107 | 128 | | |
108 | 129 | | |
109 | 130 | | |
110 | | - | |
111 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
112 | 134 | | |
113 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
114 | 141 | | |
115 | 142 | | |
116 | 143 | | |
| |||
212 | 239 | | |
213 | 240 | | |
214 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
215 | 246 | | |
216 | 247 | | |
217 | 248 | | |
218 | 249 | | |
219 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
220 | 264 | | |
221 | 265 | | |
222 | 266 | | |
| |||
230 | 274 | | |
231 | 275 | | |
232 | 276 | | |
233 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
234 | 281 | | |
235 | 282 | | |
236 | 283 | | |
| |||
248 | 295 | | |
249 | 296 | | |
250 | 297 | | |
251 | | - | |
| 298 | + | |
| 299 | + | |
252 | 300 | | |
253 | 301 | | |
254 | 302 | | |
255 | 303 | | |
256 | | - | |
| 304 | + | |
257 | 305 | | |
258 | | - | |
| 306 | + | |
259 | 307 | | |
260 | 308 | | |
261 | 309 | | |
262 | 310 | | |
263 | 311 | | |
264 | | - | |
265 | | - | |
| 312 | + | |
| 313 | + | |
266 | 314 | | |
267 | | - | |
| 315 | + | |
268 | 316 | | |
269 | 317 | | |
270 | 318 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
61 | 72 | | |
62 | 73 | | |
63 | 74 | | |
| |||
74 | 85 | | |
75 | 86 | | |
76 | 87 | | |
| 88 | + | |
77 | 89 | | |
78 | 90 | | |
79 | 91 | | |
| |||
88 | 100 | | |
89 | 101 | | |
90 | 102 | | |
| 103 | + | |
91 | 104 | | |
92 | 105 | | |
93 | 106 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
12 | 27 | | |
13 | 28 | | |
14 | 29 | | |
15 | 30 | | |
16 | 31 | | |
17 | 32 | | |
| 33 | + | |
18 | 34 | | |
19 | 35 | | |
20 | 36 | | |
| |||
80 | 96 | | |
81 | 97 | | |
82 | 98 | | |
| 99 | + | |
83 | 100 | | |
84 | 101 | | |
85 | 102 | | |
| |||
0 commit comments