Skip to content

refactor(vnext): share bounded lexical primitives - #185

Merged
Light2Dark merged 3 commits into
dev-refactorfrom
codex/vnext-shared-lexical-core
Jul 24, 2026
Merged

refactor(vnext): share bounded lexical primitives#185
Light2Dark merged 3 commits into
dev-refactorfrom
codex/vnext-shared-lexical-core

Conversation

@Light2Dark

@Light2Dark Light2Dark commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary

  • extract dialect lexical profiles and shared UTF-16 identifier, quote, block-comment, and dollar-quote scanners from the statement index
  • preserve statement-index behavior while adding explicit upper bounds needed by the parser-independent query-site recognizer
  • make bounded dollar-quote opener/closer classification prefix-deterministic and keep partial close search bounded
  • add direct boundary regressions for quotes, block comments, dollar quotes, UTF-16 identifiers, and SQL whitespace

This is a private prerequisite for ADR 0005 step 3; it adds no public package export.

Validation

  • pnpm run typecheck (strict and loose optional-property modes)
  • pnpm exec oxlint
  • pnpm run test:integrity
  • 1,272 Node tests passed + 1 expected failure
  • 7 Chromium tests passed
  • packed-package smoke passed
  • worker-placement/runtime evidence passed
  • demo build passed
  • changed coverage: 98.51% statements, 96.75% branches, 100% functions, 98.50% lines
  • three independent exact-head adversarial approvals at 652b108

Review history

Adversarial review found a dollar-opener read beyond an explicit scan limit. The final head guards the opener before inspecting a suffix and includes bounded-prefix equivalence coverage. No additional Copilot request will be made after the one request for this PR.


Summary by cubic

Shares SQL lexical primitives and adds explicit scan limits to prevent over-reads while keeping statement-index behavior. Also preserves fast, bounded ASCII word scans and fixes dollar-quote opener detection.

  • Refactors

    • Moved scanners for quotes, block comments, dollar quotes, UTF‑16 identifiers, and SQL whitespace into src/vnext/lexical.ts with explicit limit handling; preserved fast ASCII word scanning in statement-index.ts for performance.
    • Centralized dialect profiles and helpers; statement-index.ts now imports these and drops duplicate logic.
  • Bug Fixes

    • Dollar-quote opener classification is now prefix-bounded; no suffix reads beyond the scan limit.
    • Quote and block comment scanners respect limits, including line-break and backslash cases.
    • Dollar-quote tags over 256 chars return delimiterTooLong instead of scanning unbounded.

Written for commit 3600269. Summary will update on new commits.

Review in cubic

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 98.28% (🎯 91%) 400 / 407
🔵 Statements 98.28% (🎯 91%) 402 / 409
🔵 Functions 100% (🎯 90%) 46 / 46
🔵 Branches 96.58% (🎯 85%) 368 / 381
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/vnext/lexical.ts 99.17% 98.29% 100% 99.15% 71
src/vnext/statement-index.ts 97.91% 95.83% 100% 97.91% 177, 560, 741, 762, 850, 901
Generated in workflow #714 for commit 3600269 by the Vitest Coverage Report Action

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

@Light2Dark
Light2Dark merged commit ef47c7f into dev-refactor Jul 24, 2026
9 checks passed
@Light2Dark
Light2Dark deleted the codex/vnext-shared-lexical-core branch July 24, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant