Skip to content

fix(lexbench): version chart SVGs crash report builds under an ASCII locale #208

Closed

Description

@lanyue-llk

Problem

src/harness/lexbench/charts.py writes chart SVGs in render_chart with output.write_text(...) and no encoding. Chart text contains non-ASCII characters (for example † and Chinese legend notes), so harness.lexbench.report raises UnicodeEncodeError when the build runs under an ASCII locale such as LC_ALL=C with PYTHONUTF8=0 and PYTHONCOERCECLOCALE=0.

tests/test_explicit_utf8_io.py allows this call because charts.py is in HASH_BOUND with the reason "copied byte for byte into the public reproduction directory". The Lexbench report publishes it as reproduction/plot_version_summary.py.

Decision needed

Adding encoding="utf-8" fixes the crash, but it changes the bytes of that published copy. It would move the reproduction/plot_version_summary.py route in all three tests/golden/lexbench-{minimal,macos,linux}.json snapshots, and future report packages would differ from earlier ones in that file.

The owner decides whether to change the published copy. If so:

  • add the encoding in render_chart and in the read_text call in main, and lower or remove the charts.py entry in HASH_BOUND;
  • remove write_charts_as_utf8 from tests/lexbench_report_fixture.py, added in refactor(lexbench): split report main into named typed stages #207 so the snapshots stay locale-independent;
  • regenerate the affected Lexbench snapshots and explain the moved route in the PR.

Default if there is no objection: make the change, because a build that crashes on a locale is a defect and the published copy gains no behavior difference under UTF-8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions