Commit 0f350ef
authored
feat(vnext): expose session relation completion (#197)
## Summary
- expose one framework-independent completion lifecycle through
`SqlDocumentSession.complete()` and `onDidChange()`
- compose visible CTEs with one bounded catalog page using deterministic
ranking, proven shadowing, original-document UTF-16 edits, and closed
incomplete reasons
- share catalog scheduling/cache/epoch ownership at service scope while
keeping request, refresh intent, and terminal-loading lifecycle
session-local
- make the public completion result extensible with a `kind: "relation"`
item discriminant
- document the consumer contract and add cold/warm local plus
cold/cached catalog benchmarks
## Why
The lower catalog scheduler and parser-independent query-site work were
not yet usable through the public session. This slice connects those
layers without exposing coordinator identities, epochs, timers, or
CodeMirror state. It gives adapters a bounded local-first response and
an explicit revision event when catalog evidence becomes usable.
Catalog scope is treated as a live connection incarnation. Loading,
partial, paginated, failed, overloaded, and timed-out evidence remains
explicit, so unresolved marimo metadata cannot be mistaken for a
complete empty catalog.
## Evidence
- 1,989 unit tests pass with one expected failure
- changed production files: 98.02% statements, 95.13% branches, 100%
functions, 98.23% lines
- strict and loose-optional vNext type fixtures pass
- source, test, and demo typechecks pass
- oxlint and test-integrity checks pass
- 10 KiB completion benchmark: cold p99 about 1.5 ms; warm p99 below 0.8
ms
- two independent exact-head reviews approved the final lifecycle, API,
timer, and consumer semantics
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Exposes a session-based, framework-independent relation completion API
with deterministic CTE + catalog suggestions and clear change events.
Aligns CI bundle budgets for both the core and the worker fixture to
match the new relation service.
- **New Features**
- `SqlDocumentSession.complete(request)` returns `SqlCompletionResult`
with `kind: "relation"` items.
- `SqlDocumentSession.onDidChange(listener)` emits
`SqlSessionChangeEvent` when catalog evidence becomes usable.
- Deterministic ranking for local CTEs plus a bounded catalog page;
supports cancellation and response budgets.
- `createSqlLanguageService({ catalog, completion: {
catalogResponseBudgetMs } })` to configure a catalog and timing.
- Docs updated in `@marimo-team/codemirror-sql/vnext`; added unit tests
and a 10 KiB session completion benchmark.
- CI: set core bundle allocation to 48 KiB gzip (180 KiB raw) and raised
worker fixture ceiling to 160 KiB gzip (700 KiB raw); updated worker
README and capability charter.
- **Migration**
- Rename `SqlRelationCompletionItem` → `SqlCompletionItem` and
`SqlRelationCompletionList` → `SqlCompletionList`.
- Update CodeMirror resolver signatures to accept `SqlCompletionItem`.
<sup>Written for commit c66cffc.
Summary will update on new commits.</sup>
<a
href="https://cubic.dev/pr/marimo-team/codemirror-sql/pull/197?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 f0f4d5e commit 0f350ef
18 files changed
Lines changed: 4884 additions & 170 deletions
File tree
- docs/vnext
- scripts
- src/vnext
- __tests__
- codemirror
- state/artifacts/reports
- test
- vnext-types
- worker-placement
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| 242 | + | |
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
59 | 126 | | |
60 | 127 | | |
61 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
41 | | - | |
42 | | - | |
| 41 | + | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
0 commit comments