Skip to content

Add string literal regression coverage - #8605

Open
cknitt wants to merge 2 commits into
masterfrom
codex/string-literal-regression-coverage
Open

Add string literal regression coverage#8605
cknitt wants to merge 2 commits into
masterfrom
codex/string-literal-regression-coverage

Conversation

@cknitt

@cknitt cknitt commented Sep 1, 2026

Copy link
Copy Markdown
Member

This is the first PR in the String Theory series and the base of a two-PR stack addressing #8602.

It adds characterization and regression coverage for string literals before changing their compiler representation. Some tests intentionally capture existing incorrect behavior and document the corresponding JavaScript semantics.

Coverage includes:

  • escape sequences, Unicode, surrogate pairs, and line continuations
  • equivalent string spellings in pattern matching
  • JavaScript UTF-16 string semantics
  • ordinary, backquoted, tagged, JSON, and raw literals
  • the frozen AST v0/PPX bridge
  • parsing, diagnostics, constant folding, and generated JavaScript

The second PR in the stack, #8606, normalizes the representation and updates the expectations for the bugs fixed there.

Testing

  • make test
  • make test-syntax
  • make test-gentype
  • make test-analysis

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T11:05:01.724402Z 0e82fe3 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59ed00eacc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/tests/src/test_string_switch.res Outdated
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.00%. Comparing base (ebc61dd) to head (0e82fe3).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8605      +/-   ##
==========================================
+ Coverage   76.97%   77.00%   +0.03%     
==========================================
  Files         467      467              
  Lines       62452    62461       +9     
==========================================
+ Hits        48070    48100      +30     
+ Misses      14382    14361      -21     
Files with missing lines Coverage Δ
tests/ounit_tests/ounit_ast_mapper0_tests.ml 87.87% <100.00%> (+1.21%) ⬆️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cknitt

cknitt commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

@codex review

@pkg-pr-new

pkg-pr-new Bot commented Sep 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@8605

@rescript/belt

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/belt@8605

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@8605

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@8605

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@8605

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@8605

@rescript/runtime

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@8605

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@8605

commit: 0e82fe3

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 97fb7655a4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

@cknitt
cknitt force-pushed the codex/string-literal-regression-coverage branch from 97fb765 to 0e82fe3 Compare September 2, 2026 10:23
@cknitt
cknitt requested a review from cristianoc September 2, 2026 10:24
@cknitt

cknitt commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 0e82fe38c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cristianoc cristianoc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed as the base of the two-PR stack. Test-only: the diff outside tests/ is empty, and CI is green across the board.

The structure is the part worth calling out. These are characterization tests that pin the current, wrong behaviour and say so explicitly in comments — "Known bug: constant folding compares the encoded spelling instead of the decoded string value", and "This characterization intentionally expects the incorrect result, 4; the JavaScript UTF-16 length is 2". Landing them first means every behaviour change in #8606 shows up as an expectation flip in a diff rather than as new tests appearing alongside the code that makes them pass. That is a much easier thing to audit, and I would like to see more changes of this shape split this way.

I checked that the pins actually flip: constantSwitch() 4 -> 1, stringLength(semanticEmoji) 4 -> 2, and the classifyEquivalentEscape guards 5,5,,5,5 -> 0,1,,3,4, each with the "known bug" comment removed in #8606. The coverage also reaches the places that turned out to matter — the ast0 bridge, raw/ffi/re payload spelling, and constant folding — which is why the follow-up PR's behaviour changes were straightforward to reason about.

Incidentally, this branch got a lot of unintended exercise: I used it as the baseline for all of my differential testing of #8606, so it has been built from scratch, had the runtime and the 356-module tests/tests/src corpus compiled against it, and been run through identity-PPX round trips. Nothing anomalous surfaced.

One caveat on my own coverage: I did not run make test locally, so for the suite actually passing I am relying on CI rather than on my own run.

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