Skip to content

fix(eval): add dotAll flag to regex grading for multiline answers - #13530

Closed
KooshaPari wants to merge 1 commit into
diegosouzapw:release/v3.8.51from
KooshaPari:pr-13138-eval-dotall
Closed

KooshaPari wants to merge 1 commit into
diegosouzapw:release/v3.8.51from
KooshaPari:pr-13138-eval-dotall

Conversation

@KooshaPari

Copy link
Copy Markdown
Contributor

Fixes #13138

Changes

  • Added s (dotAll) flag to regex compilation in evaluateCase() so . matches newlines
  • Applied to both the RegExp object branch and the string branch
  • Added two test cases verifying multiline matching works correctly

Root Cause

Eval regex grading compiled string patterns with no flags, leaving dotAll off. Since LLM answers are routinely multi-line, the . metacharacter failed to match newlines, causing correct answers to be marked wrong.

fixes diegosouzapw#13138)

Eval regex grading compiled string patterns with no flags, leaving dotAll off.
This meant '.' did not match newlines, causing correct multi-line LLM answers
to be marked wrong. The fix adds the 's' (dotAll) flag to both the RegExp
object and string branches of the regex evaluator.

Also adds two test cases verifying multiline matching works for both string
patterns and RegExp objects.
Copilot AI lite review requested due to automatic review settings September 13, 2026 07:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks! #13413, also from you, fixes #13138 together with #13137, including the dotAll flag on both RegExp and string patterns, and it is being merged. Closing as a duplicate.

diegosouzapw pushed a commit that referenced this pull request Sep 15, 2026
…otAll regex (#13413)

Eval runner: a case whose upstream call failed can no longer score as passed when the grading regex happens to match the error text (#13137), and regex grading compiles with dotAll so `.` spans newlines in multi-line answers, for both string and `RegExp` patterns (#13138). Chosen over #13542 / #13530, which each covered half.

Validated in one consolidated batch of this series (37 PRs boarded together on `release/v3.8.51`): `typecheck:core`, `check:open-sse-typecheck` and `check:dashboard-typecheck` clean; ESLint clean on every changed file; file-size, complexity, cognitive-complexity, changelog-integrity, docs-counts, docs-sync and migration-numbering gates green (only the pre-existing `open-sse/utils/stream.ts` file-size red remains, inherited from the base); 3,743 focused `node:test` cases plus 34 vitest cases green.

Thanks @KooshaPari!
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…otAll regex (diegosouzapw#13413)

Eval runner: a case whose upstream call failed can no longer score as passed when the grading regex happens to match the error text (diegosouzapw#13137), and regex grading compiles with dotAll so `.` spans newlines in multi-line answers, for both string and `RegExp` patterns (diegosouzapw#13138). Chosen over diegosouzapw#13542 / diegosouzapw#13530, which each covered half.

Validated in one consolidated batch of this series (37 PRs boarded together on `release/v3.8.51`): `typecheck:core`, `check:open-sse-typecheck` and `check:dashboard-typecheck` clean; ESLint clean on every changed file; file-size, complexity, cognitive-complexity, changelog-integrity, docs-counts, docs-sync and migration-numbering gates green (only the pre-existing `open-sse/utils/stream.ts` file-size red remains, inherited from the base); 3,743 focused `node:test` cases plus 34 vitest cases green.

Thanks @KooshaPari!
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.

fix(backend): Eval regex grading compiles without dotAll — correct multi-line answers are marked wrong

3 participants