Repository navigation
test(tools): compare run report fixtures with LF line endings on Windows checkouts - #14369
Conversation
…ows checkouts The fixture test compared the raw working-tree bytes with the LF canonical form, so on a Windows checkout with core.autocrlf=true, Git for Windows' default, all ten fixtures failed although the committed blobs are LF. On Windows the test now converts CRLF to LF before the size, schema and canonical-form checks; elsewhere it still compares the bytes as they are, so the Ubuntu workflow keeps catching fixtures committed with CRLF.
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The exact-head fixture test passes on Linux, and simulated Windows CRLF input now passes while the unchanged POSIX strict-byte path still rejects it.
What I ran
Reviewed #14369 at head 3a3de438abe27b6f595a59ff4bac8a006e04a0e2, based on main at e6f57307fa7f47165d7fc1bee945abdb2f6816e7. The focused test ran from an archive of the exact head. Environment: Linux x86_64, Python 3.11.2, installed jsonschema 4.10.3; no compiler was invoked.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14369
gh pr checks 14369 -R boykopovar/AnyPS5
python3 -m unittest -v tools.tests.test_run_report_schema.FixtureTests
python3 -m unittest tools.tests.test_run_report_schema
git diff --check e6f57307fa7f47165d7fc1bee945abdb2f6816e7...3a3de438abe27b6f595a59ff4bac8a006e04a0e2The unittest commands ran from /tmp/anyps5-14369-exact, populated from the reviewed head with tools/, docs/run-report-fixtures/, and docs/run-report.schema.json.
Results
| Check | Result |
|---|---|
| Focused fixture tests | Passed: 9 tests. |
Full test_run_report_schema module |
26 tests passed; test_validator_matches_the_pinned_requirement failed because this environment has jsonschema 4.10.3 while the repository pins 4.23.0. The same environment mismatch appears on the base revision. |
| Windows CRLF behavior control | Simulated Windows (os.name == "nt") with all ten fixtures rewritten to CRLF: passed. Simulated the POSIX path on those same fixtures: failed by ten assertions, preserving strict LF enforcement outside Windows. |
| Diff, conventions, Python test registration, dependency/mergeability | Passed in the precheck. Registration check found 235 test scripts covered by an add_test or workflow. |
| Test-quality helper | Unavailable in the isolated PR snapshot; no test-quality conclusion is inferred from that missing helper. |
| Hosted CI | Schema, Ubuntu relinker, Windows relinker, ASan relinker, conventions, intake, eligibility and labels passed. The two macOS relinker jobs were still queued. Linux/Windows product build jobs and specialized jobs were skipped. |
Unedited selected command output
Focused fixture tests:
test_every_fixture_validates_and_fits_the_size_limit (tools.tests.test_run_report_schema.FixtureTests.test_every_fixture_validates_and_fits_the_size_limit) ... ok
test_every_stop_kind_has_a_fixture (tools.tests.test_run_report_schema.FixtureTests.test_every_stop_kind_has_a_fixture) ... ok
test_lists_are_sorted_by_count_highest_first (tools.tests.test_run_report_schema.FixtureTests.test_lists_are_sorted_by_count_highest_first) ... ok
test_milestones_stage_and_frames_are_consistent (tools.tests.test_run_report_schema.FixtureTests.test_milestones_stage_and_frames_are_consistent) ... ok
test_run_ids_are_unique (tools.tests.test_run_report_schema.FixtureTests.test_run_ids_are_unique) ... ok
test_the_expected_fixtures_exist (tools.tests.test_run_report_schema.FixtureTests.test_the_expected_fixtures_exist) ... ok
test_the_generated_truncated_document_validates_and_fits_the_size_limit (tools.tests.test_run_report_schema.FixtureTests.test_the_generated_truncated_document_validates_and_fits_the_size_limit) ... ok
test_the_recovered_fixture_is_marked_incomplete_and_killed (tools.tests.test_run_report_schema.FixtureTests.test_the_recovered_fixture_is_marked_incomplete_and_killed) ... ok
test_the_truncated_fixture_reports_dropped_entries (tools.tests.test_run_report_schema.FixtureTests.test_the_truncated_fixture_reports_dropped_entries) ... ok
----------------------------------------------------------------------
Ran 9 tests in 0.061s
OK
CRLF controls:
simulated_windows_crlf passed failures 0 errors 0
simulated_posix_crlf failed_by_assertion failures 10 errors 0
Full module failure:
FAIL: test_validator_matches_the_pinned_requirement (tools.tests.test_run_report_schema.PinnedValidatorTests.test_validator_matches_the_pinned_requirement)
AssertionError: '4.10.3' != '4.23.0'
Ran 27 tests in 0.524s
FAILED (failures=1)
Hosted check snapshot:
schema pass 12s
relinker (ubuntu-latest, g++) pass 4m26s
relinker (windows-latest, g++) pass 7m24s
relinker-asan pass 1m52s
conventions pass 17s
intake pass 5s
eligibility pass 7s
labels pass 9s
relinker (macos-latest, clang++) pending 0
relinker (macos-latest, clang++, x86_64) pending 0
Negative control
| Assertion | Change to the code under test | Did the new test fail? |
|---|---|---|
| CRLF fixture bytes are normalized on Windows | Rewrote all ten fixture files as CRLF and set the test module's os.name to nt |
No; all fixture assertions passed. |
| Non-Windows check still rejects CRLF fixtures | Kept the same CRLF files and set the test module's os.name to posix, bypassing normalization |
Yes; all ten fixture assertions failed as intended. |
Findings
Blocking: None.
Non-blocking: The full module’s sole failure is the local jsonschema version check (4.10.3 installed versus 4.23.0 pinned), and the precheck observed the same failure on base. The changed fixture tests and both line-ending controls passed.
Sources
- Fixture normalization and canonical-byte assertion at the reviewed head
- Schema workflow at the reviewed head
Not verified
I did not run the test on native Windows; the CRLF/Windows branch was simulated on Linux. The PR author reports a native Windows 11 run using Python 3.13.9 and jsonschema 4.25.0, including a base failure and changed-head pass; I did not independently reproduce that run. The two macOS relinker checks were queued at the latest hosted-CI query. No C++ build was needed for this Python-only change.
Drop the duplicate Windows line-ending fix, already covered by open PRs boykopovar#14369 and boykopovar#14420. Synchronize the branch with upstream main, retaining only the pinned-validator upgrade.
|
Windows check of head Setup: Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 (r7), Ninja, Release,
AI-assisted: yes. |
What
On 26fa121 (line numbers below refer to it)
FixtureTests.test_every_fixture_validates_and_fits_the_size_limitfails for all ten fixtures on a default Windows checkout, although the fixtures in Git are correct. The test reads each file withread_bytes()(tools/tests/test_run_report_schema.py:178) and requires the text to equaljson.dumps(..., indent=2, ensure_ascii=False) + "\n"(:181), which always uses LF. The repository has no.gitattributes, so withcore.autocrlf=true, Git for Windows' default,git ls-files --eol docs/run-report-fixturesshowsi/lf w/crlffor every fixture, and each subtest fails with'{\r\n "format": "anyps5-report",\r\n ...' != '{\n "format": ...'. The expected form comes from the repository itself: the committed blobs are LF, and the canonical form the test builds is LF. The test is not registered in ctest and CI runs it only in.github/workflows/run-report-schema.ymlonubuntu-latest(:21,:32), so CI stays green and only contributors who run it by hand on Windows see the failure. Earlier fixes for Windows checkouts and Windows line endings intools/: #11985 (ca88396, the debt-length fixture written with LF), #6397 (345fca1, markdown fences with CRLF endings) and #5736 (c3cf2af, debt files written with LF). #14235 (feat(run-report): write the run report when a game ends) is in the same feature area: it changes.github/workflows/run-report-schema.ymland addstools/tests/test_run_report_docs.py, but does not touchtools/tests/test_run_report_schema.pyor the fixtures.os.name == "nt") the test converts CRLF to LF right after reading a fixture, undoing the checkout conversion, so the size check againstMAX_BYTES, the schema check and the canonical-form check all see LF bytes. On other platforms the bytes are compared as they are, so the Ubuntu workflow still fails a fixture that was committed with CRLF from a checkout withcore.autocrlfoff. Fixtures, schema, workflow and the pinned-validator test are unchanged, and no.gitattributesis added.core.autocrlf=true, passing after. With the test module'sosreplaced by an object whosenameisposix, the same Windows checkout still fails all 10 subtests, so the strict byte check outside Windows is kept.pr_overlap.py --branchcompares all 1643 open pull requests againstmainand finds none that shares files or exports with this branch, so there is no pull request it could not compare.Tested
Windows 11, WinLibs GCC 15.2.0 (no C++ build needed, Python only), Python 3.13.9, jsonschema 4.25.0,
core.autocrlf=true, on 3a3de43 (based on 26fa121):python -m unittest tools.tests.test_run_report_schema.FixtureTestsgivesRan 9 tests,FAILED (failures=10), all ten intest_every_fixture_validates_and_fits_the_size_limitwithAssertionError: '{\r\n "format": "anyps5-report",\r\n "ver[...]\r\n' != '{\n "format": "anyps5-report",\n "version[...]n}\n'.python -m unittest -v tools.tests.test_run_report_schema.FixtureTestsgivesRan 9 tests,OK.python -m unittest tools.tests.test_run_report_schema:Ran 27 tests,FAILED (failures=1). The one failure istest_validator_matches_the_pinned_requirement('4.25.0' != '4.23.0'): the local jsonschema is 4.25.0 andtools/requirements-run-report.txtpins 4.23.0. It is unrelated and fails the same way on 26fa121.osreplaced by an object whosenameisposixgivesFAILED (failures=10)on this CRLF checkout, as before the change.python tools/check_conventions.py --base 26fa1212b8 --head HEADwith this title and description passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)