Windows report artifacts can exceed the 60,000-byte workflow limit
The report renderer enforces the 60,000-byte artifact limit using UTF-8 \n lengths, but on Windows the final Path.write_text() call translates those newlines to \r\n before the artifact is uploaded.
That means a report which fits the limit in _fit_to_budget() can become larger than the limit on disk and is rejected by the trusted comment workflow.
I reproduced this on Windows with Python 3.13 from a clean checkout of the current staging branch. The existing boundary test also exposes it:
pytest -q tests/test_action_render.py::test_written_artifact_never_exceeds_the_consumer_cap
... FAILED
E assert 61399 <= 60000A minimal version of the same reproduction is:
from pathlib import Path
p = Path("comment.md")
p.write_text("x\n" * 1000, encoding="utf-8")
print(len(p.read_bytes())) # 3000 on Windows, 2000 on POSIXIn scripts/render_pr_comment.py, _fit_to_budget() reserves one byte for the trailing newline and measures the body as UTF-8 bytes. main() then writes it with Path.write_text(_artifact_text(body), encoding="utf-8"). On Windows, text-mode newline conversion adds one byte for every line. With a report close to the 60,000-byte boundary, the extra bytes are enough to make crg-comment.md exceed MAX_REPORT_BYTES=60000 in .github/workflows/pr-review-comment.yml.
This only affects Windows runners, but it makes the size guard unreliable exactly for the largest reports. The workflow later checks report_file.stat().st_size, so the oversized artifact is rejected before the comment can be posted.
The renderer should write the already-serialized artifact as bytes (for example, Path(...).write_bytes(_artifact_text(body).encode("utf-8"))) or otherwise disable newline translation. The regression test should exercise the actual file-writing path on Windows rather than only measuring the in-memory string.
Source: tirth8205/code-review-graph