Skip to content

fix(json): preserve Unicode boundaries in lexer errors - #4228

Draft
bobzhang wants to merge 1 commit into
mainfrom
codex/core-audit-json
Draft

bobzhang wants to merge 1 commit into
mainfrom
codex/core-audit-json

Conversation

@bobzhang

Copy link
Copy Markdown
Contributor

JSON lexer errors on supplementary Unicode characters can point at the trailing UTF-16 surrogate. For example, [true😀] reports column 6 instead of column 5, and numeric scanning can rewind into the middle of a surrogate pair.

Rewind by the consumed character's UTF-16 length and correct the U+FFFF BMP boundary in expect_char. Add regression coverage for separators, property names, numeric states, and the BMP boundary. Clarify that surrogate-escape validation does not validate raw UTF-16 input.

Validation:

  • moon check --deny-warn
  • moon test json --target all
  • moon info; generated interfaces unchanged

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 6626

Coverage increased (+0.004%) to 89.318%

Details

  • Coverage increased (+0.004%) from the base build.
  • Patch coverage: 19 of 19 lines across 3 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 18414
Covered Lines: 16447
Line Coverage: 89.32%
Coverage Strength: 272979.92 hits per line

💛 - Coveralls

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.

2 participants