tools/first_light: write manifest.json atomically (FIRST-LIGHT-ATOMIC-MANIFEST) #2299
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2299
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/first-light-atomic-manifest"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as: FIRST-LIGHT-ATOMIC-MANIFEST (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7192791901)
What and why
Writes \manifest.json\ atomically in \ ools/first_light.py\ via _write_json_atomic\ (\os.path.realpath\ + \ empfile.mkstemp\ + \sync\ + \published_mode\ +
eplace_retry\ with cleanup on failure), preserving symlinks and permissions. Adds a regression test in \ ests/test_first_light.py.
Tested
GPUs tested: n/a (CPU-only Python tool & unit tests)
AI-assisted: yes
Checklist
eeds rebase).
Two findings from local verification of
04a204bc0againstmainatfac8b4bb9:run_draw()now uses_write_json_atomic, butmain()still opensmanifest.jsondirectly with"w"attools/first_light.py:1195(1164onmain), so an interrupted regeneration there can still truncate an existing manifest._write_json_atomicdirectly rather than thatmain()call path—routingmain()through_write_json_atomicand adding a synthetic regression test verifying the prior manifest survives a write/replace failure would close the gap.Checks run on macOS 27.3 arm64 (Python 3.14.3): claim confirmed in #1608, patch applies cleanly, no overlap with #2040. On plain
main, the PR'stests/test_first_light.pyhad 44 passed, 4 skipped, 1 error (missing helper); with the patch,test_first_light.py(45 passed, 4 skipped),test_text_write_line_endings.py(3/3),test_report_paths.py(23 passed, 1 skipped),check_no_game_data.py, andcompileallall passed.Synthetic fixtures only; no game data. GPUs tested: N/A (CPU-only). AI-assisted review.
Approving 04a204bc0.
Both writes of
manifest.jsongo through a temp file in the same folder, fsync andreplace_retry, with the repo'spublished_mode; on any failure the temp file is removed. An interrupted run can no longer leave a truncated manifest.Merged onto
maind1dff7949together with #2403, #2410, #2297, #2330 and #2286 (no conflicts), on Linux with Python 3.13.tests/test_first_light.py: 45 passed, 4 skipped (main: 44). AI-assisted (Claude Code, Claude Opus 5.5).#2299 | head
04a204bc0e7b57153e04cdad34b79038d9eae9e1|python3 -I tests/test_first_light.py -v| red: 49 run, 1 error, 4 skips | green: 45 passed, 4 skipped | Baseline exception → passOn main the new atomic writer was missing. Three checks requiring a First Light fixture directory and one optional native harness check skipped on both sides.
Pinned main
33db04a7010e81c40a7a6a15624525aa0c4a3a58, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Merged, thank you @Ch1mpleo!
What it does: tools/first_light: write manifest.json atomically (FIRST-LIGHT-ATOMIC-MANIFEST)
How it was checked: sodove tested this PR at head
04a204bc0on main33db04a70: the PR's own test fails on main and passes with this PR merged in (his result is linked from the batch summary in #1608). We then re-ran the same test locally on Windows 11 and got the same verdict: on main, red (1 error); with the PR, green (49 OK, 8 skips).CI: the red jobs on this PR fail the same way on main, or on the older main it was built on (the
cs_dpp_cmp.asmtranslator fixture, since fixed on main, and the Windows runner's Visual Studio setup), so none comes from this change.Merged one by one with 20 other PRs of the same reviewed batch, pinned to the tested head.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.