Commit 846c90b
authored
feat(vnext): add atomic document sessions (#172)
## Summary
- add the framework-independent `@marimo-team/codemirror-sql/vnext`
entry point
- implement immutable dialect registration, one session per document,
opaque revision identity/metadata, discriminated atomic updates, and
terminal disposal
- validate and own bounded plain-data contexts; normalize hostile
JavaScript inputs and guard reentrant update/open lifecycle races
- add compile-only API tests, 83 runtime invariant tests, current-API
documentation, and packed isolation smoke coverage without CodeMirror or
node-sql-parser available
## Evidence
- `pnpm run typecheck`
- `pnpm exec oxlint`
- `pnpm run test:coverage` (670 passed, 1 governed expected failure)
- changed vNext runtime coverage: 99% statements, 98.47% branches, 100%
functions, 98.99% lines
- `pnpm run test:browser`
- `pnpm run test:package`
- `pnpm run test:integrity`
- `pnpm run demo`
## Adversarial review
Two independent reviewers challenged correctness and API design. The
first loop found and reproduced reentrant revision overwrite,
service-open disposal, dialect TOCTOU, variance, and optional-property
issues. The implementation and tests were redesigned; both reviewers now
approve with no blocker/high findings.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds vNext atomic document sessions in
`@marimo-team/codemirror-sql/vnext` with immutable dialects,
per-document sessions, and strict revision/lifecycle invariants.
Strengthens smoke tests with dependency isolation and rollback checks,
and exports `./vnext` for consumers.
- **New Features**
- Public service/session operations are exposed as readonly, bound
function fields to remain safe when passed as callbacks or destructured.
- Packaging/docs/tests: new session primitives guide, `package.json`
`./vnext` subpath export, and smoke tests that run without `@codemirror`
or `node-sql-parser`, verify `vnext` exports, revision identity, and
validate isolation rollback.
- **Bug Fixes**
- Hardened API invariants: reentrant-update guard, early stale-revision
checks before context inspection, idempotent terminal disposal for
session/service, stricter optional-field handling
(`exactOptionalPropertyTypes`), and consistent `SqlSessionError` codes
when normalizing accessors/proxies.
<sup>Written for commit ce6d09a.
Summary will update on new commits.</sup>
<a
href="https://cubic.dev/pr/marimo-team/codemirror-sql/pull/172?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 c96bbeb commit 846c90b
11 files changed
Lines changed: 2651 additions & 22 deletions
File tree
- docs
- adr
- vnext
- scripts
- src/vnext
- __tests__
- test/vnext-types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
128 | 129 | | |
129 | 130 | | |
| 131 | + | |
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
| |||
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
150 | | - | |
| 152 | + | |
151 | 153 | | |
152 | | - | |
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
156 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
157 | 161 | | |
158 | 162 | | |
159 | 163 | | |
| |||
251 | 255 | | |
252 | 256 | | |
253 | 257 | | |
254 | | - | |
| 258 | + | |
255 | 259 | | |
256 | | - | |
| 260 | + | |
257 | 261 | | |
258 | | - | |
| 262 | + | |
259 | 263 | | |
260 | | - | |
| 264 | + | |
261 | 265 | | |
262 | | - | |
| 266 | + | |
263 | 267 | | |
264 | | - | |
| 268 | + | |
265 | 269 | | |
266 | | - | |
| 270 | + | |
267 | 271 | | |
268 | | - | |
| 272 | + | |
269 | 273 | | |
270 | | - | |
| 274 | + | |
271 | 275 | | |
272 | | - | |
| 276 | + | |
273 | 277 | | |
274 | | - | |
| 278 | + | |
275 | 279 | | |
276 | | - | |
| 280 | + | |
277 | 281 | | |
278 | | - | |
| 282 | + | |
279 | 283 | | |
280 | | - | |
281 | | - | |
| 284 | + | |
| 285 | + | |
282 | 286 | | |
283 | 287 | | |
284 | 288 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
593 | 606 | | |
594 | 607 | | |
595 | 608 | | |
| |||
801 | 814 | | |
802 | 815 | | |
803 | 816 | | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
808 | 822 | | |
809 | 823 | | |
810 | 824 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
| |||
0 commit comments