Commit a5c4e86
authored
feat(vnext): add private parser worker protocol (#180)
## Summary
- add a strict private parser worker wire protocol and browser worker
endpoint
- load only literal PostgreSQL and BigQuery parser modules inside the
isolated worker
- fail closed on malformed messages, unsafe realms, overlap, and
poisoned parser descriptors
- add Node and Chromium coverage plus package artifact assertions
## Validation
- 1,159 Node tests passed with one intentional expected failure
- 4 Chromium worker tests passed
- typecheck, oxlint, test integrity, demo, package smoke, worker
placement, and changed coverage passed
- changed production coverage: 99.46% statements/lines and 100%
branches/functions
- exact-head adversarial review approved by architecture/security,
lifecycle/session, and packaging/browser reviewers
## Scope
Private infrastructure only: no public exports, session wiring, semantic
extraction, cache, or API compatibility commitment.
## Review policy
Copilot review is requested once for this PR. It will not be
re-requested after later pushes.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds a private, versioned wire protocol and a dedicated module-worker
endpoint for `node-sql-parser` to run parsing in an isolated browser
worker. The endpoint now guards the entire backend operation and uses
stricter, bounded wire decoding; artifacts are production-shaped but
still private.
- **New Features**
- Closed protocol v1 for parse requests/responses; no AST, source text,
or raw errors on the wire; retryability derived from failure code.
- Dedicated worker endpoint that lazily loads `bigquery`/`postgresql`,
reuses the backend normalizer, and restores exact
`NodeSQLParser`/`global` descriptors around module load, decode, parser
construction, parse, and normalization.
- Single-flight only: one in-flight request; malformed or overlapping
requests emit a protocol error and then close.
- Outcomes include normalized statement kind, bounded unsupported
reasons, or bounded failure codes.
- **Bug Fixes**
- Guarded the full worker backend parse and permanently poison on
restoration failure; close the generation on `module-load` failures.
- Bounded and hardened wire decoding: accept only closed plain records,
enforce key limits, and avoid accessor traps.
<sup>Written for commit e06a42f.
Summary will update on new commits.</sup>
<a
href="https://cubic.dev/pr/marimo-team/codemirror-sql/pull/180?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 6e0e234 commit a5c4e86
12 files changed
Lines changed: 2803 additions & 5 deletions
File tree
- docs
- adr
- vnext
- scripts
- src/vnext
- __tests__
- browser_tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
120 | 122 | | |
121 | 123 | | |
122 | 124 | | |
| |||
139 | 141 | | |
140 | 142 | | |
141 | 143 | | |
142 | | - | |
| 144 | + | |
143 | 145 | | |
144 | 146 | | |
145 | 147 | | |
| |||
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
153 | 160 | | |
154 | 161 | | |
155 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
| 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 | + | |
64 | 101 | | |
65 | 102 | | |
66 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
172 | 187 | | |
173 | 188 | | |
174 | 189 | | |
| |||
0 commit comments