Repository navigation
Preserve mathematical backslashes in reviewer JSON - #426
Conversation
|
Advisory cross-file review against Lean Pool's supervisory rubric. This is not by itself a significance, source-verification, or merge verdict. The PR is not safe to merge until common LaTeX commands such as Findings
Summary
Reviews (1) · Last reviewed commit: "Preserve literal mathematical backslashe..." |
| try: | ||
| return json.loads(source) | ||
| except json.JSONDecodeError as error: | ||
| if error.msg != "Invalid \\escape": | ||
| raise | ||
| # Consume valid escape pairs intact, including already escaped backslashes. |
There was a problem hiding this comment.
Common LaTeX escapes still break
When review evidence contains common literal LaTeX commands, this decoder can still corrupt or reject it. Commands such as \frac, \neq, \rightarrow, and \times begin with valid JSON escape letters, so the first json.loads succeeds and converts them into control characters before the repair runs. Commands such as \underbrace and \uparrow instead produce an Invalid \uXXXX escape, which this handler does not repair. As a result, ordinary mathematical evidence can still be changed or cause the full-source review to fail. The related tests cover \lambda and \set, but not these cases.
The full-source re-review of #395 failed after a model call because the JSON string contained an invalid backslash escape in its evidence. Preserve such literal Lean/LaTeX backslashes while decoding the inner review JSON. Valid JSON escapes remain unchanged, and other malformed JSON still fails.
Validation: all 379 Python tests pass; Ruff check/format and diff checks pass. Regressions cover mixed literal/valid escapes, Unicode, and malformed structure. The standalone Azure worker is deployed with the same source hash, and the decoder regression passes on the VM.