You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
- publish the minimal `SqlTextRange` UTF-16 contract and make
`SqlTextChange` extend it
- add internal immutable identity/masked source snapshots with explicit
`originalText` and `analysisText`
- validate and freeze bounded embedded regions without invoking
accessors or Proxy `get` traps
- preserve length and every CR/LF offset while masking every other
UTF-16 code unit
- store source snapshots in document sessions, reusing them only for
context-only updates
- document the intentional boundary: no public transformer or source-map
SPI yet
- request Copilot once per PR, without later re-requests
## Invariants and risk
- ranges are safe-integer, in-bounds, half-open UTF-16 offsets
- embedded regions are non-empty, ordered, non-overlapping, and capped
at 10,000
- source text is capped at 16 Mi UTF-16 code units
- masking uses bounded 64 Ki-code-unit chunks and cannot allocate per
newline
- arbitrary values thrown by hostile Proxy traps are normalized without
inspecting them
- document updates create a new source snapshot; context-only updates
retain the exact source identity
## Evidence
- `pnpm run typecheck`
- `pnpm exec oxlint`
- `pnpm run test:coverage` (713 passed, 1 governed expected failure)
- changed runtime coverage: 98.78% statements, 97.75% branches, 100%
functions, 98.76% lines
- deterministic randomized UTF-16 masking/range round trips
- full 16,777,216-code-unit CRLF mask and 10,000-region smoke cases
- full-limit newline mask succeeds under `node --max-old-space-size=128`
- `pnpm run test:browser`
- `pnpm run test:package`
- `pnpm run test:integrity`
- `pnpm run demo`
## Adversarial review
Two independent exact-head reviewers challenged correctness and
performance/API design. The first loop found a newline-density memory
amplification and hostile thrown-Proxy escape. Both were redesigned and
regression-tested. Both reviewers approve exact SHA
`1993a6cdca85ec9d3b8a1ddaab5dda0188b85fab` with no blocker, high, or
medium findings.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Add internal source coordinate primitives and length-preserving masking
to support safe UTF-16 ranges and embedded-region analysis. Export
`SqlTextRange` and update sessions to use immutable source snapshots,
reusing them for context-only updates.
- New Features
- Export `SqlTextRange`; make `SqlTextChange` extend it.
- Add immutable source snapshots with `originalText` and `analysisText`,
plus length-preserving masking of embedded regions (CR/LF offsets
preserved). No transformer or source-map SPI yet.
- Validate and freeze inputs with strict caps (16 Mi code units, 10k
regions) and accessor-safe normalization.
- Store source snapshots in document sessions and reuse them on
context-only updates.
<sup>Written for commit 1993a6c.
Summary will update on new commits.</sup>
<a
href="https://cubic.dev/pr/marimo-team/codemirror-sql/pull/173?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. -->
0 commit comments