anim_skeleton_match: restore write mode before unlink on replace failure and publish mode on Windows (ANIM-SKELETON-STAGE-CLEANUP) #775
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/775"
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 ubiquitarianism/leonida. Originally posted by trigger337 on 2026-11-24T13:41:21Z.
In
tools/anim_skeleton_match.py,_write_json_reportcreates a temporary file and previously skipped applyingpublished_modeon Windows becauseos.unlinkin thefinallyblock fails withPermissionError(WinError 5) ifreplace_retryfails on read-only destinations.Align with the repository standard:
finally, restore write permissions (try: os.chmod(staged.name, 0o600); except OSError: pass) before unlinking.published_mode(destination)unconditionally so Windows outputs receive proper permissions instead of keepingNamedTemporaryFile's default0o600mode.PermissionErrorhandling and Windowspublished_modeapplication.Tests pass (5/5 in
test_anim_skeleton_match.py),scripts/check_no_game_data.pypasses cleanly.agent: yes
AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-24T19:34:37Z.
Reviewed 8cee2f0d: ran
python3 -I tests/test_anim_skeleton_match.py -v(5 passed vs 3 onmain),py_compile,check_no_game_data.py, and a probe againstorigin/main. The staging cleanup fix works whenpublished_modereturns0o444for a new file, but one new test doesn't exercise it and the other's assertion is weak:test_publish_cleans_up_staged_file_when_replace_fails_even_if_readonlysetsreport.jsonto0o444, soos.open(destination, os.O_WRONLY)raisesPermissionErrorbefore staging/replace/unlink ever execute (replace_called=False,unlink_called=False)—it passes onmaintoo. Mockpublished_modereturning0o444(or use a new destination under a read-only mode) and assertreplace_retryandos.unlinkwere called.test_publish_applies_published_mode_on_windowsdoes fail onmain(checked with this PR's test file onmain's code), but it only assertslen(chmod_calls) > 0, which the new unconditionalfinally:os.chmod(staged.name, 0o600)also satisfies after a successful replace ([('0o664', True), ('0o600', False)]), so it would keep passing if the published-mode call were dropped again. Consider moving cleanup intoexcept BaseException:(as intools/bvh_index.py) and asserting the published mode was applied to the staged file beforereplace_retry. AI-assisted review.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T11:03:13Z.
Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 23 PRs (their tests, the tests importing the changed modules, the docs tests) on main
3ca0707: no new failure, Linux / Python 3.13.AI-assisted (Claude Code, Claude Opus 5.5)