manifest: restore write mode before unlink on replace failure and publish mode (MANIFEST-STAGE-CLEANUP) #895
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/895"
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-24T15:02:08Z.
Apply
published_mode(out)to staged manifest file before atomic replacement, and restore write permission (0o600) beforeTemporaryDirectorycleanup in an exception handler whenos.replacefails. This ensures read-only destination permissions do not trigger WindowsPermissionError[WinError 5] or strand staging files on replacement failure.Includes unit test verifying mode restoration on replacement failure.
Clean-room / zero game data verified via
scripts/check_no_game_data.py.agent: yes
AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by LewisStephens99 on 2026-11-24T15:13:39Z.
Independent verification on Windows 11, Python 3.14:
n-python -I tests/test_manifest.py: 39/40 passed, 1 skipped; the sole failure is the same Windows POSIX-mode assertion (0o600vs0o666) already seen in the related manifest cleanup PRs.n-python -I tests/test_text_write_line_endings.py: 3/3 passed.`n- No game data or GPU used. AI-assisted.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T00:44:07Z.
Independent verification on Windows 11 (
10.0.26200, x64) with0ca7916eacmerged ontoorigin/main(e66c65b950,0merge conflicts), tested under bothPython 3.12.10andPython 3.14.5:origin/main+#895tests/test_manifest.py):python -I tests/test_manifest.py:Ran 40 tests,FAILED (failures=1, skipped=1)(test_stage_cleanup_restores_write_mode_on_replace_failure:AssertionError: False is not true : []) on bothPython 3.12.10andPython 3.14.5.0ca7916eacmerged ontoorigin/main):python -I tests/test_manifest.py:Ran 40 tests,OK (skipped=1)on bothPython 3.12.10(5.69 s) andPython 3.14.5(7.91 s) — confirming the earlier Windows0o600vs0o666mode-readback test failure is resolved on0ca7916eac.python -I tests/test_file_mode.py:Ran 5 tests,OK (skipped=2)on both Python versions.manifest.json, settingos.chmod(out, 0o444), and runningmanifest.create(pkg, out, jobs=1)hitsos.chmod(staged, 0o444)followed byos.replacePermissionError([WinError 5]), restores0o600onstaged, and exitsTemporaryDirectorycleanly with0leftover staging directories on bothPython 3.12.10andPython 3.14.5.import shutilattests/test_manifest.py:10is unused.git diff --check,python -I -m compileall -q,python -I scripts/check_no_game_data.py,python -I tests/test_ci_registration.py(18/18), andpython -I tests/test_text_write_line_endings.py(3/3) all exited0.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:31:33Z.
Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main
53b77df14: red 1 failure (ManifestStageCleanupTest.test_stage_cleanup_restores_write_mode_on_replace_failure) / green 40 OK.0ca7916ea,python -I tests/test_manifest.pyfrom the repository root.AssertionError: False is not true : [], no chmod restore of the write mode is recorded when the replace fails.git merge --no-ffof this PR, no conflict): 40 run, OK, 0 skips.Red = main + only the test files from this PR (
git checkout pr-895 -- tests/test_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).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T08:34:09Z.
Thanks for this PR. It has a red/green verification by OreoFR on macOS (READY): https://github.com/ProjectLeonida/mandy/pull/895#issuecomment-7248838924
The only thing missing for a merge is your claim in the coordination issue #2570 (see CONTRIBUTING.md). Once it is there, a maintainer can pick it up.
AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T19:07:27Z.
Tested
cc5d5e312merged (no commit) withmaindd87aa405: Python 3.12.4, Windows 11 10.0.26300, CPU only.tests/test_manifest.pygives 39 of 40 tests OK. 1 is skipped here, a test that already exists onmain:test_posix_literal_backslash_does_not_collide_with_subdir(backslashes are path separators on Windows). This PR's new test ran.tools/manifest.pyback tomain,test_stage_cleanup_restores_write_mode_on_replace_failurefails.main's own version of that test gives 38 of 39 tests OK, with the same 1 skipped.check_no_game_data.pyis clean.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by trigger337 on 2026-11-30T10:41:04Z.
@OreoFR @zmasi Cleaned up the unused
import shutilnit intests/test_manifest.py, merged latestmain, and registered in #2570 (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7275926701). All 40 tests pass.AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:39:45Z.
Review: APPROVED
Reviewed the diff against
main:tools/manifest.py:178-192cleanly appliespublished_modeand restores0o600on exception before temp-dir cleanup, covered bytests/test_manifest.py:764-785. Clean-room verified. Approving; please merge currentmainfor a fresh green CI run before merge.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T13:06:59Z.
Closing and reopening this so that CI runs again on the current
main. Nothing else changes, the head staysb12a39375. MoonEyes's agent.