Commit 6ba0023
fix(query-engine): consistent hard-fail semantics across #586's invariant checks
Second round of review findings on #586:
- The chronological-fold precondition (a bucket can't remove a key the fold
doesn't yet believe present) was a debug_assert! while check_disjoint (same
bucket, same key in both added/removed) was a hard Err -- inconsistent, and
the debug_assert's panic bypassed the Ok/Err handling callers already have
in place around this fold (simple_engine's keys-merge match arms never see
a panic). Converted to an Err, matching check_disjoint.
- check_disjoint now also warn!s before returning its Err, since callers
vary in how loudly they surface a returned Err and this should never
happen -- confirmed one such caller (worker.rs's merge_panes_for_window)
was silently discarding it via .unwrap_or(existing) with zero logging;
added a warn! there too.
- get_keys()'s disjointness check downgraded to debug_assert! (previously
warn! + None, before #586 rewrote this function) -- restored warn! + None
instead of self-healing via difference(), consistent with "should never
happen, fail loudly" for every other invariant check in this file.
- simple_engine's keys-merge Err branch logged at debug! -- bumped to warn!
so a failure that should never happen doesn't stay quiet in production
logs.
- Documented (not code-changed) why sort_buckets_chronologically can't be
skipped even absent epoch rotation: the current epoch's own
range_query_into returns raw insertion order, not sorted, so a
no-sealed-epochs shortcut would silently reintroduce a different ordering
gap. Rust's sort_by_key is already adaptive/near-O(n) on typically
chronological input, so there's little to gain from an explicit
pre-check.
Deliberately NOT changed: check_disjoint's blast radius (it fails the whole
per-key merge over one corrupted key, rather than self-healing just that
key) -- accepted trade-off, since silently salvaging a merge that hit
supposedly-impossible corrupted state is worse than losing that one key's
history loudly.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 4f6751c commit 6ba0023
4 files changed
Lines changed: 78 additions & 27 deletions
File tree
- asap-query-engine/src
- engines/simple_engine
- precompute_engine
- precompute_operators
- stores/simple_map_store
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1758 | 1758 | | |
1759 | 1759 | | |
1760 | 1760 | | |
1761 | | - | |
| 1761 | + | |
1762 | 1762 | | |
1763 | 1763 | | |
1764 | 1764 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1019 | 1019 | | |
1020 | 1020 | | |
1021 | 1021 | | |
1022 | | - | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
1023 | 1032 | | |
1024 | 1033 | | |
1025 | 1034 | | |
| |||
Lines changed: 57 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
260 | 265 | | |
261 | 266 | | |
262 | 267 | | |
| |||
313 | 318 | | |
314 | 319 | | |
315 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
316 | 324 | | |
317 | 325 | | |
318 | 326 | | |
319 | 327 | | |
320 | | - | |
| 328 | + | |
321 | 329 | | |
322 | 330 | | |
323 | | - | |
324 | | - | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
325 | 334 | | |
326 | 335 | | |
327 | 336 | | |
| |||
340 | 349 | | |
341 | 350 | | |
342 | 351 | | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
350 | 364 | | |
351 | 365 | | |
352 | 366 | | |
| |||
494 | 508 | | |
495 | 509 | | |
496 | 510 | | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
497 | 528 | | |
498 | 529 | | |
499 | 530 | | |
| |||
533 | 564 | | |
534 | 565 | | |
535 | 566 | | |
536 | | - | |
537 | | - | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
538 | 570 | | |
539 | | - | |
540 | | - | |
541 | | - | |
| 571 | + | |
542 | 572 | | |
543 | 573 | | |
544 | 574 | | |
| |||
548 | 578 | | |
549 | 579 | | |
550 | 580 | | |
551 | | - | |
| 581 | + | |
552 | 582 | | |
553 | 583 | | |
554 | | - | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
555 | 587 | | |
556 | 588 | | |
557 | 589 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
16 | 26 | | |
17 | 27 | | |
18 | 28 | | |
| |||
0 commit comments