Skip to content

Scripts: replace coverage baselines atomically - #2645

Open
luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/coverage-atomic-baseline
Open

luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/coverage-atomic-baseline

Conversation

@luckyteagirl

@luckyteagirl luckyteagirl commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

The coverage gate opens the existing baseline for writing, which truncates it before the new JSON is written. An interrupted write can leave later comparisons without a readable baseline. Write the report to a temporary file beside the baseline and replace the destination after the write succeeds.

What is in it

  • Stage and replace the baseline atomically, with cleanup and an error message on failure.
  • Preserve the existing baseline's mode on POSIX.
  • Test preservation of mode and contents, cleanup after a failed replacement, and successful retry.

Tested

  • Windows 11 build 26200, Ryzen 9 5980HX, Python 3.11.9.
  • With the failed-replacement regression and the implementation from main at b49be18, coverage gate tests ran with 9 passed, 1 failed, 0 skipped. The update incorrectly returned success despite the injected replacement failure.
  • On this commit, python -B -m unittest discover -s scripts -p 'test_*.py' ran on Windows with 26 passed, 0 failed, 1 skipped (the POSIX mode test).
  • On Ubuntu under WSL with Python 3.14.4, the POSIX regression failed on the previous PR revision (10 passed, 1 failed, 0 skipped), which set mode 0600 instead of 0664. The full Python suite on this commit ran with 27 passed, 0 failed, 0 skipped.
  • The local PR description checker passed.

Regression run

  • Not applicable to this scripts-only change.

Not tested

  • Rust workspace suite, GPU tests, and retail title smoke runs.

AI use

  • Codex (GPT-6.2-Sol) implemented and tested the change and drafted this description.

Stage the complete coverage report beside the destination before replacing it. If the replacement fails, keep the previous baseline and clean up the temporary file. Preserve the existing baseline mode on POSIX.

Assisted-by: Codex (GPT-6.2-Sol)
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