Repository navigation
Conversation
…bits, not mkstemp's 0600 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested 1a4c18f on Arch Linux, Python 3.14.10, CPU only: pass — tests/test_timecycle_pairs.py 6/6 OK (incl. both new ReportModeTests; pytest agrees). Negative control: tool swapped to merge-base → both new tests fail ('0o600' != '0o640', mkstemp's 0600 leaks); restored, green again. No game files. AI-assisted. |
devnull34
approved these changes
Nov 23, 2026
devnull34
left a comment
There was a problem hiding this comment.
Verified: passes all tests in tests/test_timecycle_pairs.py. Calling published_mode(path) before os.replace ensures atomic staging via mkstemp does not restrict the target report's mode bits to 0600.
This was referenced Nov 23, 2026
Open
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed on #7333 (timecycle_pairs).
What was wrong.
_write_json_atomicstages the report withtempfile.mkstemp, which creates the file 0600, andos.replaces it onto--out. Every other report writer that stages this way gives the staged file the destination's bits throughfile_mode.published_mode(#1082); this one did not, so a new report came out 0600 whereopen(path, "w")gives 0644 under umask 022, and a replaced report lost its previous mode (a 0640 report became 0600).Hand-built input.
tp._write_json_atomic(path, {})in a fresh temp folder with umask 022 gave0o600; after the fix it gives0o644, the same as a plainopen()in that folder. A report that already exists with mode 0640 keeps 0640. Two new tests intests/test_timecycle_pairs.py(ReportModeTests) cover the new-file and replaced-file cases; both failed before the change.Tests (Linux, Python 3.14, CPU only, no GPU):
python3 -I tests/test_timecycle_pairs.py: 6 tests OK (2 new ones failed before the fix)python3 -m compileall -q make_game.py tools testspython3 -I scripts/check_no_game_data.py tools/timecycle_pairs.py tests/test_timecycle_pairs.py: cleantests/test_text_write_line_endings.pyfails ontools/leonida_tui.py:753andtools/wave_diff.py:373; both fail on main without this change and have open fixes (leonida_tui: write stage logs with LF line endings #7050, wave_diff: write case files with LF line endings (test_text_write_line_endings) #7188).AI-assisted.
🤖 Generated with Claude Code