Skip to content

fix(report): escape sample text in the terminal report - #67

Merged
MattFisher merged 3 commits into
mainfrom
fix/report-markup
Oct 8, 2026
Merged

MattFisher merged 3 commits into
mainfrom
fix/report-markup

Conversation

@MattFisher

@MattFisher MattFisher commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

inspect-dataset scan crashed on MacBench. Its answers are wrapped in [ANSWER]…[/ANSWER], and a finding's explanation quotes the sample's text. print_report passed that explanation to rich unescaped, so rich read [/ANSWER] as a closing tag and raised MarkupError: closing tag '[/ANSWER]' … doesn't match any open tag. The findings files had already been written, but the command exited 1, so callers treated the whole scan as failed. That includes inspect_audit's sweep, where MacBench was the one eval that crashed inspect-dataset itself.

The explanation and the sample id are now escaped, as the "not applicable" line a few lines above already is. The header's dataset, split and scorer names are identifiers, not sample text, and are left as they are.

Testing

tests/test_report.py::test_terminal_report_prints_sample_text_that_looks_like_markup reproduces the crash, failing with the same MarkupError, and now passes. It checks that both the explanation and a bracketed sample id print literally. Suite: 637 passed, excluding the browser e2e test. basedpyright: 0 errors. pre-commit passes.

🤖 Generated with Claude Code

A finding quoting MacBench's [ANSWER]...[/ANSWER] crashed print_report with a rich MarkupError.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MattFisher
MattFisher enabled auto-merge October 8, 2026 04:50
@MattFisher
MattFisher merged commit e2c5d17 into main Oct 8, 2026
1 check passed
@MattFisher
MattFisher deleted the fix/report-markup branch October 8, 2026 04:53
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.

1 participant