Skip to content

FIX: Normalize newlines and tabs in MathObfuscationConverter (#4059) - #4060

Merged
Roman Lutz (romanlutz) merged 2 commits into
microsoft:mainfrom
Kaap10:fix/math-obfuscation-crlf-tab-4059
Nov 9, 2026
Merged

Roman Lutz (romanlutz) merged 2 commits into
microsoft:mainfrom
Kaap10:fix/math-obfuscation-crlf-tab-4059

Conversation

@Kaap10

Copy link
Copy Markdown
Contributor

Description

Fixes MathObfuscationConverter to normalize line endings (\r\n and \r) and handle horizontal tabs (\t), eliminating corrupted algebraic identity equations for control characters.

  • Pre-normalized line endings in the input prompt with prompt.replace("\r\n", "\n").replace("\r", "\n") so carriage returns do not produce \r = ... equation lines.
  • Treated horizontal tabs \t as whitespace word separators alongside spaces " " so tabs append blank lines rather than generating \t = ... equation lines.
  • Added unit tests in test_math_obfuscation_converter.py covering CRLF, standalone CR, horizontal tabs, and mixed control whitespace.

Demonstration

  • Prompt: "A\r\nB\tC"
    • Before: Output contained \r = 4\r - 3\r and \t = 3\t - 2\t lines that corrupt console/log rendering and pollute algebraic variable mapping.
    • After: Output cleanly formats as:
      A = 4A - 3A
      
      B = 3B - 2B
      
      C = 6C - 5C
      

Closes #4059

Copilot AI balanced review requested due to automatic review settings November 8, 2026 08:29

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 insufficient remaining quota. Try requesting a review at a lower effort level.

@romanlutz Roman Lutz (romanlutz) self-assigned this Nov 8, 2026
@romanlutz
Roman Lutz (romanlutz) merged commit 526fc2b into microsoft:main Nov 9, 2026
59 checks passed
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.

BUG: MathObfuscationConverter generates corrupted equations for carriage returns and tabs

3 participants