Skip to content

fix(core): parse grouped glyph scripts in linear time - #124

Merged
viktar-b merged 2 commits into
mainfrom
codex/fix-glyph-regex-redos
Nov 6, 2026
Merged

viktar-b merged 2 commits into
mainfrom
codex/fix-glyph-regex-redos

Conversation

@viktar-b

@viktar-b viktar-b commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Summary

Replace the grouped-script regex with a forward scan that preserves existing code names, including empty, nested and mismatched delimiters. Collapse underscores before trimming so malformed glyphs cannot trigger repeated scans during cleanup.

scan to the next script opener
  consume through the first closing delimiter
  if no closer exists, preserve the remaining suffix and stop
join replacements, normalize separators, trim edges

Addresses code-scanning alert 4. Based directly on main; no changes from the method-table branch.

Evidence

  • Before: The new 300 KB unmatched-glyph regression fails against main when its child process exceeds the five-second deadline.
  • After: All 203 core tests pass, including the bounded child-process regression for plaintext, glyph and ID fallbacks. A 300 KB malformed glyph with surrounding letters completes in about 30 ms locally on Node 24.
  • 100,000 deterministic generated compatibility cases match the previous implementation.
  • Passed npm test --workspace @cs-object/core, npm run typecheck --workspace @cs-object/core, and npm run lint --workspace @cs-object/core. Lint retains three existing warnings and a Biome schema-version notice outside the changed files.
  • Passed npm run test:integration -- tests/integration/python-export-runtime-names.test.ts, all six tests, plus formatting and git diff --check.
  • GitHub CI and CodeQL results are pending. The alert has not been dismissed manually.

Merge Danger

Door: two-way

Revert restores the prior implementation. No schema, dependency or public API changes.

Blast Radius: core

Glyph-derived code names used by JSON sheet conversion and Python export. Compatibility cases and existing export tests retain prior naming behavior.

@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
calculation-source-object Ready Ready Preview Nov 6, 2026 9:07am UTC

Request Review

@viktar-b
viktar-b merged commit 6b2b4b0 into main Nov 6, 2026
13 checks passed
@viktar-b
viktar-b deleted the codex/fix-glyph-regex-redos branch November 6, 2026 09:11

This branch was successfully deployed

1 active deployment
Preview — 32caecd7 Deployed Nov 6, 2026 by vercel[bot]
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