Commit 1ee9a05
authored
feat(vnext): sketch relation completion contracts (#183)
## Summary
- add package-private provisional contracts for relation catalog search,
epochs, path authority, dialect-owned decoding/rendering, completion
results, and session lifecycle
- migrate catalog search paths from dot-joined strings to decoded
identifier-component paths with quote provenance
- add a runtime-free marimo-shaped core fixture covering atomic
document/context/region transactions, providers, subscriptions,
completion results, and negative type guarantees
- add a separate CodeMirror fixture requiring explicit disposal for
custom rich-info resources
These declarations intentionally remain outside the `./vnext` public
export surface until the complete vertical slice, two provider shapes,
hostile decoding, packed marimo integration, and lifecycle/performance
gates pass.
## Design constraints
- provider authoring is strongly typed, but runtime ingress will be
erased to `unknown` and strictly decoded
- providers return decoded role-bearing canonical paths and positive
addressability evidence; only dialect runtime data may decode SQL
identifiers or render insertion text
- provider requests contain only bounded catalog/query data; provider
cancellation is passed separately
- consumer results do not expose epochs, scheduler work IDs, deadlines,
configuration identity, or terminal-vs-soft loading causes
- every `catalog-loading` issue carries a bounded remaining intent lease
- custom CodeMirror rich info must return `{ dom, destroy }`, enabling
late-result draining and React-root unmounting
## Validation
- `pnpm run typecheck`
- `pnpm exec oxlint`
- `pnpm run test:integrity`
- `pnpm test` — 1,248 passed, 1 expected failure
- `pnpm run test:browser` — 7 passed
- `pnpm run test:package`
- changed coverage — 100% statements, branches, functions, and lines
- exact-head adversarial approval from SQL/API and marimo ergonomics
reviewers at `d5a38af2804c928bc8acf7f7a0ae91a759f3de24`
Part of #169.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds provisional, strongly typed contracts for SQL relation completion,
including catalog search, dialect decoding/rendering, completion
items/results, and session lifecycle. Migrates identifier handling to
decoded `SqlIdentifierPath` components and adds a disposable CodeMirror
resolver for custom info. Part of #169.
- New Features
- Relation catalog contracts: search request/response, epochs, coverage
(complete/partial/paginated), provider reports.
- Dialect runtime for identifier decode/render and CTE identifier
equality.
- Completion model for CTEs and catalog relations, with issues and
ready/unavailable/cancelled/failed results.
- Session API with transactional updates, completion, change events, and
disposal.
- CodeMirror `SqlCompletionInfoResolver` returning `{ dom, destroy }`.
- Export `SqlIdentifierComponent` and `SqlIdentifierPath` from
`src/vnext/index.ts`.
- Migration
- Replace dot-joined search paths with `SqlIdentifierPath`; use
`SqlIdentifierComponent` for all name parts.
- Providers are async, take `AbortSignal` separately, and return decoded
paths (no SQL insert text); rendering moves to the dialect runtime.
- Embedded regions are readonly; document updates must pass the full
`embeddedRegions` set.
- Incomplete completion lists must include at least one issue;
`catalog-loading` issues include `remainingIntentLeaseMs`.
<sup>Written for commit 2d0bade.
Summary will update on new commits.</sup>
<a
href="https://cubic.dev/pr/marimo-team/codemirror-sql/pull/183?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 88f9c6f commit 1ee9a05
6 files changed
Lines changed: 803 additions & 1 deletion
File tree
- src/vnext
- codemirror
- test/vnext-types
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
0 commit comments