feat(vnext): define normalized syntax contract#176
Conversation
|
@cubic-dev-ai review please |
@Light2Dark I have started the AI code review. It will take a few minutes to complete. |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
Pull request overview
Defines a new internal vNext “normalized syntax” contract for SQL statement parsing, with runtime-authenticated artifacts/diagnostics/analyses and a single parser runner that validates and normalizes backend behavior. This fits the codebase’s vNext direction by tightening the boundary between lexical eligibility (statement indexing) and parser evidence, while keeping stable vNext exports unchanged.
Changes:
- Adds
src/vnext/syntax.ts: branded/opaque identities, statement-relative ranges, normalized artifact + diagnostic + analysis constructors, andrunSqlStatementParserto authenticate/normalize parser output. - Adds comprehensive runtime tests (
vitest) and compile-time type tests (d.ts) to enforce the contract’s invariants and impossible-state exclusions. - Documents the boundary via ADR 0002 and links it from ADR 0001.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/vnext-types/syntax.test-d.ts | Type-level assertions ensuring the normalized syntax contract types can’t be fabricated and impossible combinations are rejected. |
| src/vnext/syntax.ts | Core implementation of the normalized syntax contract (brands, identities, constructors, authenticated runner, and bounded inputs/collections). |
| src/vnext/tests/syntax.test.ts | Runtime unit tests validating invariants, rejection behavior, and runner normalization/authentication semantics. |
| docs/adr/0002-normalized-syntax-contract.md | New ADR specifying the internal contract, invariants, and non-goals. |
| docs/adr/0001-language-service-and-session.md | References ADR 0002 as the first internal syntax boundary. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Safety and correctness
Validation
Scope
Internal contract only. This PR does not add a parser adapter, cache/session wiring, catalog types, or stable public exports.
Summary by cubic
Defines an internal normalized SQL syntax contract with a single parser runner that authenticates outputs and separates lexical eligibility from parser analysis. Strengthens cancellation: preserves the exact
AbortSignalreason, rejects pre-aborted requests without invoking the backend, and races cancellation vs. backend completion correctly; public vNext exports stay the same and ADR 0002 documents the boundary.New Features
Safety
AbortSignalsurface validated (cross-realm supported); preserves exact abort reason; pre-aborted requests skip backend; late aborts don’t override completed backend outcomes.Written for commit ed58bac. Summary will update on new commits.