Scripts: replace coverage baselines atomically #2635
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2645"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T04:54:44Z.
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
Tested
b49be183, coverage gate tests ran with 9 passed, 1 failed, 0 skipped. The update incorrectly returned success despite the injected replacement failure.python -B -m unittest discover -s scripts -p 'test_*.py'ran on Windows with 26 passed, 0 failed, 1 skipped (the POSIX mode test).Regression run
Not tested
AI use
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:32:05Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:33:18Z.
Triage (#1607) – head
5310cccNo open or merged PR makes the same change. #2253 and #2265 edit the same
--updateblock ofcoverage_gate.py(refuse empty / failed sweeps), a different problem; they will conflict textually.write_baselinewrites 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.
Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T09:00:55Z.
merge-check
base:
1c8b551475head:
5310ccce9fmerge: clean (
git merge --no-editonto1c8b5514,git diff --checkclean;scripts/coverage_gate.pyandscripts/test_coverage_gate.py, +72/-3)build: not run (Tier 0 Python script diff; no Rust code changed)
tests:
python -m unittest discover -s scripts -p "test_coverage_gate.py" -v-> 10 passed, 0 failed, 1 skipped (test_replacement_preserves_the_previous_baseline_mode: requires POSIX file modes; base1c8b5514: 9 passed; newtest_failed_replacement_preserves_the_previous_baselinepassed);python -m unittest discover -s scripts -p "test_*.py"-> 66 passed, 1 skipped, 1 error (test_discord_mirror.pyon Windows, same failure on base1c8b5514). Rust workspace tests not run (Tier 0).review: Read the full diff (+72/-3).
write_baseline(scripts/coverage_gate.py:57-76) stages JSON into a same-directory temp file (delete=False), preserves existing file mode on POSIX, atomically swaps withos.replace, cleans up the temp file infinallyon failure, and exits 2 cleanly onOSErrorinmain(). Note: the POSIX chmod branch was not executed on Windows (skipped cleanly viaskipUnless). No problems found.performance: none (offline script in
scripts/; zero runtime impact)verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Python 3.15.2, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.