test: exercise AWC manifest staged cleanup on all hosts #249
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/249"
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 Andretuta on 2026-11-24T02:53:16Z.
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Claim: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116927597
What and why
test_failed_replace_of_read_only_manifest_removes_writable_tempmade the destination read-only before callingwrite_manifest. On macOS the preliminaryos.open(destination, os.O_WRONLY)correctly rejects that destination, so the test failed before it could exercise staged-file cleanup. The test now keeps the destination writable, makes the synthetic staged file read-only inside the failed-replace callback, and verifies the cleanup restores its writable mode, leaves the previous manifest intact, and removes the temporary file. Production code is unchanged.Tested
macOS, Python 3.12, synthetic AWC data only; no GPU or game files:
python3.12 -I tests/test_awc_manifest.py: 1 failure of 22 at the staged cleanup assertion.python3.12 -I tests/test_awc_manifest.py: 22/22 pass.test_file_mode.py5 pass;test_replace_retry.py8 pass/2 expected skips;test_awc_names.py35 pass/1 expected skip;test_awc_shorts.py15 pass/1 expected skip.python3.12 -I scripts/check_no_game_data.py tests/test_awc_manifest.py,python3.12 -m compileall -q tests/test_awc_manifest.py, andgit diff --checkpass.AI-assisted: yes.
Imported from ubiquitarianism/leonida. Originally posted by Headache3318 on 2026-11-24T09:52:53Z.
Tested at your head
6c8151d6e:python3 -I tests/test_awc_manifest.pyOK, andtest_awc_opus,test_saves(1 skip),test_text_write_line_endingsandtest_report_pathsall OK there too.Direction is right: replacing the two split assertions with one that drives a denied publish while the staged file carries the read-only mode restores the coverage the merged
1fa09754cleft behind - that a failed publish keeps the previous report and clears the staged mode before deleting it, which is what Windows needs.Two things block it as written: it branches from a much older
main(against7430f59b2the diff is 261 files with 23,025 deletions, i.e. most of currentmainis missing, so it needs a rebase before anyone can read it), and it deletestest_read_only_manifest_is_refused_without_staging_a_file- the assertion that the writer's permission check runs before anything is staged. If that is deliberate because the tool no longer depends on it, say so in the commit message; otherwise both guarantees should stay in the file.An independent second implementation on this box took the same route and found two details worth folding in: patching
published_modeto return0o444(a real read-only destination is now refused earlier, so the mode the staged file gets has to come from that mock), and anos.unlinkstand-in that raisesPermissionErrorwhen a file has no write bits - that is what actually exercises the clear-then-delete cleanup on Linux, where a read-only file is still deletable.AI-assisted (Hermes agent on behalf of @Headache3318), Arch Linux, python 3.14.9; the Windows read-only attribute is simulated here, not measured, so the "on all hosts" claim still needs a Windows or Wine run.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:38:51Z.
Draft PR review note: this carried-over PR currently conflicts with
mainintests/test_awc_manifest.pyand has no CI run.main(tests/test_awc_manifest.py:392-410) still testsreplace_retrywithout forcing the staged file read-only, so the improved staged-cleanup test is still distinct. Please rebase onto currentmain, mark ready for review, and run CI if you want to land it.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:16:56Z.
Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.
(AI-assisted triage.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:58:57Z.
Review: DISMISSED
Now ready for review, requesting changes before merge:
CONFLICTING/DIRTY): conflicts withmainintests/test_awc_manifest.py(the staged cleanup test here remains distinct fromtests/test_awc_manifest.py:392-410).mainand get fresh green CI.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:28:15Z.
Rebased onto current
main(d2a564b66) at15396d111, resolving the conflict intests/test_awc_manifest.pywhile preservingtest_read_only_manifest_is_refused_without_staging_a_fileand all post-branch tests.Verified locally on Linux (Python 3, synthetic AWC data only, no game files or GPU):
python3 -I tests/test_awc_manifest.py: 26/26 passedpython3 -m compileall -q make_game.py tools tests: passedpython3 -I scripts/check_no_game_data.py: passedgit diff --check origin/main..HEAD: clean(AI-assisted rebase.)