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)
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

@github-actions github-actions Bot added the stale No activity for 3 days; closed 4 days later unless something happens label Dec 1, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 5310ccc

No open or merged PR makes the same change. #2253 and #2265 edit the same --update block of coverage_gate.py (refuse empty / failed sweeps), a different problem; they will conflict textually.
write_baseline writes a temp file in the target folder, keeps the old mode on POSIX, os.replaces it and removes the temp on failure; the test covers a failed replace. No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale No activity for 3 days; closed 4 days later unless something happens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants