Commit 5ad22fd
authored
feat(vnext): prepare catalog epoch transitions (#194)
Part of #169. Follows #193.
- Add a package-private synchronous epoch-transition hook so shared
catalog work can retire before session revision listeners observe an
accepted epoch.
- Preserve deterministic prepare/commit/dispatch ordering for provider
invalidations and higher response epochs.
- Tighten provider cleanup and transition dispatch to an exact
`undefined` contract, with fail-closed quarantine for invalid returns.
- Dispose before inspecting invalid thenables, closing the hostile
getter reentrancy window identified after #193 merged.
- Keep the no-hook and null-transition paths allocation-free and add a
configured-hook storm benchmark.
- Extend ADR 0005, type fixtures, lifecycle tests, and adversarial
Promise/thenable coverage.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds a package-private, synchronous epoch-transition hook that runs
after epoch install to retire catalog work before session listeners.
Enforces exact-return contracts and fail-closed handling to harden
reentrancy, cleanup, and poisoned-thenable edge cases; supports #169.
- **New Features**
- Added `SqlCatalogEpochTransitionTarget` that may return a dispatch
closure or `null`; dispatch must return exactly `undefined` (sync only).
- Preserved strict ordering: transition-prepare → revision-prepare →
producer settle → transition-dispatch → revision-dispatch; reentrant
dispatch queues behind current dispatch.
- Snapshots the revision audience before transition; producers/aborts
see prepared revisions; listeners see already-retired work.
- Rejects non-function transition targets during coordinator creation
(`reason: "invalid-transition-target"`); any thrown preparation, thrown
dispatch, or non-`undefined` return disposes fail-closed and discards
response decisions.
- Drains detached Promise/thenable results for cleanup and transition
returns after disposal, avoiding hostile getter reentrancy; no-hook and
`null`-dispatch paths allocate nothing. Updated ADR 0005, added a
configured-hook storm benchmark, and expanded adversarial tests.
- **Migration**
- Update `SqlCatalogSubscriptionCleanup` to be synchronous and return
`undefined` only (no Promises or other return values).
<sup>Written for commit 9d7c9c3.
Summary will update on new commits.</sup>
<a
href="https://cubic.dev/pr/marimo-team/codemirror-sql/pull/194?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->1 parent ffa8229 commit 5ad22fd
6 files changed
Lines changed: 778 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
466 | 488 | | |
467 | 489 | | |
468 | 490 | | |
| |||
523 | 545 | | |
524 | 546 | | |
525 | 547 | | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
533 | 563 | | |
534 | 564 | | |
535 | 565 | | |
| |||
Lines changed: 32 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
113 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
| |||
141 | 145 | | |
142 | 146 | | |
143 | 147 | | |
| 148 | + | |
144 | 149 | | |
145 | 150 | | |
146 | 151 | | |
| |||
416 | 421 | | |
417 | 422 | | |
418 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
419 | 450 | | |
420 | 451 | | |
421 | 452 | | |
| |||
0 commit comments