Commit 6e0e234
authored
refactor(vnext): extract realm-neutral parser backend (#179)
## Summary
- extract module decoding, parser invocation, result validation, and
error normalization into an internal realm-neutral backend
- preserve Node-specific realm validation, module loading, cleanup,
parser authority, and private AST ownership in the existing adapter
- add exhaustive backend contract tests covering bounds, cancellation
checkpoints, retry caching, hostile values, and ambient neutrality
- document the host/engine responsibility boundary
No public export, session wiring, worker protocol, or user-visible API
is added.
## Validation
- 1,041 unit tests passed; 1 intentional expected failure
- vNext coverage: 98.54% statements, 97.06% branches, 100% functions,
98.53% lines
- new backend coverage: 100% statements, branches, functions, and lines
- source and test TypeScript checks
- oxlint and test-integrity checks
- Chromium browser tests
- exact packed-consumer smoke test
- isolated worker placement and bundle-budget harness
- demo production build
- parser adapter benchmark
- git diff check
## Independent review
Two independent adversarial reviewers approved exact commit 96bd2ce with
zero actionable findings.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Extracted a new internal backend for `node-sql-parser` and rewired the
Node adapter to call it. No public API changes.
- **Refactors**
- New `node-sql-parser-backend`: decodes module, runs `astify`,
validates output, and normalizes errors; no Node/window/worker refs.
- Node adapter now only handles realm checks, `require` loading,
cleanup, parser authority, and private AST ownership; uses backend
outcomes.
- Unified backend outcomes; concurrent load de‑dup and retry cache;
enforces `MAX_NODE_SQL_PARSER_STATEMENT_LENGTH`.
- Accepts constructor/`default`/`module.exports`/named `Parser`; ignores
accessors/proxies and redacts private data.
- Added backend tests (bounds, cancellation, retry, hostile values,
ambient neutrality) and documented the host/engine boundary.
- **Bug Fixes**
- Validate AST array lengths, rejecting spoofed or non‑integer length
descriptors.
<sup>Written for commit 08a9d67.
Summary will update on new commits.</sup>
<a
href="https://cubic.dev/pr/marimo-team/codemirror-sql/pull/179?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 a775bf4 commit 6e0e234
4 files changed
Lines changed: 1366 additions & 390 deletions
File tree
- docs/vnext
- src/vnext
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
48 | 56 | | |
49 | 57 | | |
50 | 58 | | |
| |||
0 commit comments