Commit d39d908
authored
feat(vnext): coordinate bounded catalog search work (#195)
## Summary
- add the package-private bounded catalog search-work coordinator
- compose provider authentication, epoch authority, latest-wins
ownership, cancellation, deadlines, and response publication
- harden hostile and reentrant lifecycle boundaries, including exact
disposal hooks and captured Promise intrinsics
- document the scheduler contract and deferred cache/session/UI
responsibilities in ADR 0005
- add strict API fixtures, invariant-heavy unit coverage, and
capacity/performance benchmarks
## Invariants
- at most 8 provider searches are active and 64 are queued
- owners join only exact structural request keys and supersede
independently
- scope epoch changes retire same-scope work without crossing scope
boundaries
- failed captures, invalid input, cancellation, disposal, overload, and
deadlines settle promptly and exactly once
- provider calls, timers, clocks, thenables, callbacks, and response
decoding may be hostile or reentrant without reviving retired work
- the authenticated dialect runtime is the sole dialect identity
authority
## Validation
- `vitest`: 1,856 passed, 1 expected failure
- changed coverage: 97.29% statements, 96.23% branches, 99.46%
functions, 97.73% lines
- search coordinator: 97.03% statements, 95.09% branches, 100%
functions, 97.84% lines
- epoch coordinator: 98.31% statements, 97.42% branches, 98.21%
functions, 98.89% lines
- strict source, tests, vNext API fixture, loose-optional fixture, and
demo typechecks
- zero-warning `oxlint`
- test-integrity gate
- 4 browser files / 7 browser tests
- exact-tarball package smoke test
- worker placement and bundle budgets
- production dependency audit: no known vulnerabilities
- catalog search-work benchmark suite
- two independent adversarial exact-head approvals
Part of #169.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds a package-private, bounded catalog search-work coordinator that
composes provider auth with epoch authority to run searches safely,
dedupe by exact keys, and enforce deadlines. Also centralizes catalog
scope validation to a shared boundary utility. Progress toward #169.
- **New Features**
- Added `createSqlCatalogSearchWorkCoordinator` with 8 active and 64
queued limits, exact-key in-flight sharing, and latest-wins per owner.
- Owners capture scope and dialect; the authenticated dialect runtime
defines the provider ID and epoch authority.
- Independent cancellation, queue and execution deadlines, and a small
synchronous budget; outcomes include usable, superseded, cancelled, and
unavailable.
- Safe response decoding and epoch publication; first baseline re-keys
unobserved work in the same scope.
- Benchmarks and strict unit/type tests for lifecycle, concurrency,
deadlines, and adversarial scenarios.
- ADR 0005 updated to document scheduler/deadlines and package-owned
disposal semantics.
- **Refactors**
- Epoch coordinator now accepts a package-owned disposal target, invokes
it exactly once, and drains non-undefined returns with captured Promise
intrinsics (resilient to a replaced global Promise).
- Centralized scope validation into `isValidSqlCatalogScope` in the
boundary; adopted by epoch and search-work paths with new tests.
- Hardened lifecycle boundaries and cleanup; exact disposal and hostile
thenable handling.
- Dialect runtime exposes a stable `id`; tests assert coherence and
deep-freeze properties.
<sup>Written for commit 061a3c6.
Summary will update on new commits.</sup>
<a
href="https://cubic.dev/pr/marimo-team/codemirror-sql/pull/195?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 5ad22fd commit d39d908
11 files changed
Lines changed: 5859 additions & 43 deletions
File tree
- docs/adr
- src/vnext
- __tests__
- test/vnext-types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
487 | 493 | | |
488 | 494 | | |
489 | 495 | | |
| |||
555 | 561 | | |
556 | 562 | | |
557 | 563 | | |
558 | | - | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
559 | 567 | | |
560 | 568 | | |
561 | 569 | | |
| |||
654 | 662 | | |
655 | 663 | | |
656 | 664 | | |
| 665 | + | |
| 666 | + | |
657 | 667 | | |
658 | 668 | | |
659 | 669 | | |
| |||
744 | 754 | | |
745 | 755 | | |
746 | 756 | | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
747 | 776 | | |
748 | 777 | | |
749 | 778 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
345 | 346 | | |
346 | 347 | | |
347 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
348 | 372 | | |
349 | 373 | | |
350 | 374 | | |
| |||
Lines changed: 102 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
239 | 341 | | |
240 | 342 | | |
241 | 343 | | |
| |||
0 commit comments