Skip to content

test(tools): compare run report fixtures with LF line endings on Windows checkouts - #14369

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
roboterspinne:test/tools-run-report-fixtures-lf
Nov 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
roboterspinne:test/tools-run-report-fixtures-lf

Conversation

@roboterspinne

Copy link
Copy Markdown
Contributor

What

On 26fa121 (line numbers below refer to it) FixtureTests.test_every_fixture_validates_and_fits_the_size_limit fails for all ten fixtures on a default Windows checkout, although the fixtures in Git are correct. The test reads each file with read_bytes() (tools/tests/test_run_report_schema.py:178) and requires the text to equal json.dumps(..., indent=2, ensure_ascii=False) + "\n" (:181), which always uses LF. The repository has no .gitattributes, so with core.autocrlf=true, Git for Windows' default, git ls-files --eol docs/run-report-fixtures shows i/lf w/crlf for 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.yml on ubuntu-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 in tools/: #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.yml and adds tools/tests/test_run_report_docs.py, but does not touch tools/tests/test_run_report_schema.py or the fixtures.

  • Rule. On Windows (os.name == "nt") the test converts CRLF to LF right after reading a fixture, undoing the checkout conversion, so the size check against MAX_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 with core.autocrlf off. Fixtures, schema, workflow and the pinned-validator test are unchanged, and no .gitattributes is added.
  • Tests. The existing fixture test is the test: 10 failing subtests before the change on a Windows checkout with core.autocrlf=true, passing after. With the test module's os replaced by an object whose name is posix, the same Windows checkout still fails all 10 subtests, so the strict byte check outside Windows is kept.
  • Overlap. pr_overlap.py --branch compares all 1643 open pull requests against main and 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):

  • Counter-check on 26fa121: python -m unittest tools.tests.test_run_report_schema.FixtureTests gives Ran 9 tests, FAILED (failures=10), all ten in test_every_fixture_validates_and_fits_the_size_limit with AssertionError: '{\r\n "format": "anyps5-report",\r\n "ver[...]\r\n' != '{\n "format": "anyps5-report",\n "version[...]n}\n'.
  • With this change: python -m unittest -v tools.tests.test_run_report_schema.FixtureTests gives Ran 9 tests, OK.
  • The whole module, python -m unittest tools.tests.test_run_report_schema: Ran 27 tests, FAILED (failures=1). The one failure is test_validator_matches_the_pinned_requirement ('4.25.0' != '4.23.0'): the local jsonschema is 4.25.0 and tools/requirements-run-report.txt pins 4.23.0. It is unrelated and fails the same way on 26fa121.
  • Strict check off Windows: running the fixture test with the module's os replaced by an object whose name is posix gives FAILED (failures=10) on this CRLF checkout, as before the change.
  • python tools/check_conventions.py --base 26fa1212b8 --head HEAD with this title and description passed.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

…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 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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...3a3de438abe27b6f595a59ff4bac8a006e04a0e2

The 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

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.

@MarcZX10 MarcZX10 mentioned this pull request Nov 1, 2026
12 tasks done
xdCloudy added a commit to xdCloudy/AnyPS5 that referenced this pull request Nov 1, 2026
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.
@oneandonlydean oneandonlydean self-assigned this Nov 5, 2026
@gabichuuuuu

Copy link
Copy Markdown
Contributor

Windows check of head 3a3de438ab, merged onto main 31b4aa91e8 (clean merge, built together with other open PRs that touch different files).

Setup: Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 (r7), Ninja, Release, -DANYPS5_RELINKER_ONLY=ON, BUILD_TESTING=ON, Python 3.15.

  • tools/select_tests.py explain selected no test whose build inputs include this PR's files, so no test was run for it. This is not a pass or a failure.

AI-assisted: yes.

@oneandonlydean
oneandonlydean merged commit 85350e2 into boykopovar:main Nov 14, 2026
14 checks passed
@roboterspinne
roboterspinne deleted the test/tools-run-report-fixtures-lf branch November 14, 2026 08:41
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.

4 participants