awc_manifest: publish mode on Windows (AWC-MANIFEST-STAGE-CLEANUP) #779
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!779
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/awc-manifest-stage-cleanup"
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
In
tools/awc_manifest.py,write_manifestalready restored0o600before unlinking on failure in itsfinallyblock, but previously skipped applyingpublished_modeon Windows viaif os.name != "nt":.Remove the Windows skip so Windows outputs inherit published permissions consistently across platforms, and add synthetic regression tests for cleanup on replace failure and Windows
published_modeapplication.Tests pass (25/25 in
test_awc_manifest.py),scripts/check_no_game_data.pypasses cleanly.agent: yes
AI-assisted: yes
Approving. Merged into current main with no conflicts; the PR's tests pass (Linux, Python 3.13). Same pattern as the rest of the *-STAGE-CLEANUP series: the published mode now also applies on Windows (the os.name guard is gone), using file_mode.published_mode. Only the staging/permission lines change.
AI-assisted (Claude).
Tested on Windows 11, Python 3.12.10, with this PR merged onto upstream main b0f3d3998 (merge commit 1ed165078).
python -I tests/test_awc_manifest.py:WinError 1314, no symlink privilege). The 2 new tests run and pass.(AI-assisted test run; output checked by hand.)
Reviewed ff7a65d: I ran
python3 -I tests/test_awc_manifest.py(25/25 on the PR),test_csv_line_endings.py,test_file_mode.py,test_report_paths.pyandcheck_no_game_data.py(all clean) on Linux, plus a probe againstorigin/main. No product bug or behavioral difference in any reachable scenario - and on main with this PR's test file all 25 tests pass, so neither new test pins the diff: the cleanup test raises at the pre-stageos.opencheck before anything is staged (probe:staged file created: Falseon both trees) and cannot fail on main in any environment, the cleanup it names being already covered bytest_failed_replace_removes_the_staging_file_and_keeps_the_manifest; the os.name="nt" test passes on main because thefinally:chmod(0o600) still fires on the renamed-away staged name and the patched mock counts that call before its FileNotFoundError is swallowed. Suggested: drop the cleanup test and assert the published mode instead - over a 0o640 destination withos.name="nt", main republishes at 0o600 while this branch preserves 0o640. The guard drop itself is fine and consistent with bvh_index/anim_glb/awc_opus. AI-assisted review.Recommendation: Fix first
Confirming @PierreEbele's finding: with this PR's test file against main's tool, every test passes here too (Linux, run as root), so neither new test pins the change. My approval was for the guard removal, which is right and matches the other writers; I didn't check that the tests fail without it. Asserting the published mode over a non-default destination mode with
os.namepatched tont, as the review suggests, would pin it. AI-assisted (Claude).Independent verification on Windows 11 (
10.0.26200, x64) ofef0fb06124merged ontoorigin/main(e66c65b950,0merge conflicts) under bothPython 3.12.10andPython 3.14.5:ef0fb06124merged ontoorigin/main):python -I tests/test_awc_manifest.py:Ran 26 tests,OK (skipped=2)onPython 3.12.10(6.04 s) andPython 3.14.5(3.18 s; the 2 skips are the existingWinError 1314symlink privilege checks).python -I tests/test_file_mode.py:Ran 5 tests,OK (skipped=2)on both Python versions.manifest.jsonpublishes0o666, and attempting to overwrite a0o444manifest.jsonraisesPermissionErrorcleanly with0leftover.awc_manifest-*.tmpfiles.ef0fb06124test file againstorigin/maintools/awc_manifest.py):#779'stests/test_awc_manifest.pyagainst unpatchedorigin/maintools/awc_manifest.pyalso passes26/26(OK (skipped=2)) on bothPython 3.12.10andPython 3.14.5, confirming on native Windows what earlier Linux reviews noted onff7a65d:test_publish_cleans_up_staged_file_when_replace_fails_even_if_readonly, settingos.chmod(path, 0o444)causesos.close(os.open(destination, os.O_WRONLY))attools/awc_manifest.py:227to raisePermissionErrorbeforeNamedTemporaryFilecreates a staging file.test_publish_applies_published_mode_on_windows,self.assertTrue(len(chmod_calls) > 0)passes even whenif os.name != "nt":skips line237becausefinally:at line243callsos.chmod(staged.name, 0o600)afterreplace_retryrenamesstaged.name(track_chmodappends beforereal_chmodraisesFileNotFoundError). Stubbingpublished_modeto a distinct mode (e.g.0o640) and asserting(staged_name, 0o640)was passed beforereplace_retrywould pin the guard removal directly.git diff --check,python -I -m compileall -q, andpython -I scripts/check_no_game_data.pyall exited0.AI-assisted.
Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main 53b77df14 : red 26 OK (no failure) / green 26 OK.
python -I tests/test_awc_manifest.pyfrom the repository root.git merge --no-ffof this PR, no conflict): 26 run, OK, 0 skips.write_manifestalways callsos.chmod(staged.name, 0o600)in itsfinally, so the newtest_publish_applies_published_mode_on_windows, which only checks that some chmod call happened (len(chmod_calls) > 0), passes on main withos.namefaked as"nt"; it does not check for thepublished_modecall the fix restores.test_publish_cleans_up_staged_file_when_replace_fails_even_if_readonlyalso passes on main.Red = main + only the test files from this PR (
git checkout pr-779 -- tests/test_awc_manifest.py); green = main + the merged PR. When green runs more tests than red, it is because the merge keeps tests main added since the PR branched.AI-assisted: Claude Code (Claude Opus 5.5).
@PierreEbele @tiguan26 @OreoFR Updated
tests/test_awc_manifest.pysotest_publish_applies_published_mode_on_windowsasserts thatpublished_mode(0o640) was applied to the staged file rather than checkinglen(chmod_calls) > 0. Confirmed RED on unpatched main (AssertionError: False is not true : [('/tmp/.../.awc_manifest-...tmp', 384)]) and GREEN (26/26 tests OK) on the PR head. Also merged latestmainand registered in #2570 (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7275926701).AI-assisted: yes
Reviewed the diff against
main:tools/awc_manifest.py:236cleanly removes theos.name != "nt"guard sopublished_modeapplies on Windows too, andtests/test_awc_manifest.py:465-500verifies both read-only replace-failure cleanup and exactpublished_mode(0o640) application. Clean-room verified. Approving; please merge currentmainso CI re-runs green past the oldtools/d3d12_run_fps.pyfailure before merge.(AI-assisted review.)
Verified by MoonEyes (another person than the author) on head
d401ff120merged withmainc60ce461a: Windows 11, Python 3.14, CPU only. I read the whole diff.tests/test_awc_manifest.py26 OK (2 skipped); withtools/awc_manifest.pyback tomain, 1 failure. Neighbours OK.AI-assisted (Claude Code).
Closing and reopening this so that CI runs again on the current
main. Nothing else changes, the head staysd401ff120. MoonEyes's agent.Fresh CI checks are all green and the PR is
MERGEABLE/CLEANon currentmain. Merging now.(AI-assisted review.)