make_game: stage the runtime install before replacing the old files (RT-249) #204

Closed
Andretuta wants to merge 5 commits from upstream-pr/204 into main
Andretuta commented 2026-11-24 02:43:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:43:08Z.


Carried over from old PR 9937 by LouisRiverstone in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9937, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
LouisRiverstone: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

RT-249: the runtime stage of make_game.py can leave --out half replaced.

Re-submission of #5278. #5278 was closed unmerged during the 2026-11-23 22:45 UTC cleanup, along with the other open PRs. This is the same branch, now merged with current main.

Checked on #5278 by: King1565 (Linux), Atomic258 (Windows Server 2022), JRamos1993 (Windows 11), kapitche (Linux).

No game files.

AI-assisted (Claude Code): I reviewed the change and re-ran its tests on the merge with main.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465085736 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/204). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:43:08Z. --- > Carried over from **old PR 9937** by `LouisRiverstone` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9937`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `LouisRiverstone`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): RT-249: the runtime stage of `make_game.py` can leave `--out` half replaced. Re-submission of `#5278`. `#5278` was closed unmerged during the 2026-11-23 22:45 UTC cleanup, along with the other open PRs. This is the same branch, now merged with current `main`. Checked on `#5278` by: King1565 (Linux), Atomic258 (Windows Server 2022), JRamos1993 (Windows 11), kapitche (Linux). No game files. AI-assisted (Claude Code): I reviewed the change and re-ran its tests on the merge with `main`.
sodove commented 2026-11-24 06:25:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-24T06:25:08Z.


Native Windows finding on 560c3fa924, Windows 11 build 26100, Python 3.12. The nine stock runtime-staging tests pass.

The current file's recovery copy is lost if the new install and the inner rollback are both blocked. I used two synthetic files and inserted a synchronization point after moving the second old file to staging. At that point a contender created the destination and held it without FILE_SHARE_DELETE. The actual Windows renames for publishing and restoring that file both failed.

The first file rolled back correctly. The second old file had never been added to the rollback list, so publish raised PermissionError and install_runtime deleted staging, including the only .old copy. The expected result here is IncompleteRollback with that copy preserved.

I verified a temporary local correction. Record an old file in the rollback list immediately after moving it aside, and let the outer rollback handle it if publishing fails. For a file with no previous copy, add it to the list only after successfully publishing it. The lock tests went from 2/3 to 3/3 with this change and the stock suite stayed at 9/9. The test with no previous copy also confirmed that rollback leaves a contending file alone.

Synthetic files only. AI-assisted verification.

Current main comparison at 8f481cf16f. With the second of two synthetic destinations already locked for reading, main raises PermissionError after replacing the first file, leaving mixed versions. This PR leaves both originals in place for that case. The separate test that locks the destination after the backup rename still reproduces the missing recovery copy on this PR head.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7123912053 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/204#issuecomment-7123912053). Originally posted by [sodove](https://github.com/sodove) on 2026-11-24T06:25:08Z. --- Native Windows finding on 560c3fa9246a2f07d1c75c449f1c2fe7376e1aa8, Windows 11 build 26100, Python 3.12. The nine stock runtime-staging tests pass. The current file's recovery copy is lost if the new install and the inner rollback are both blocked. I used two synthetic files and inserted a synchronization point after moving the second old file to staging. At that point a contender created the destination and held it without FILE_SHARE_DELETE. The actual Windows renames for publishing and restoring that file both failed. The first file rolled back correctly. The second old file had never been added to the rollback list, so publish raised PermissionError and install_runtime deleted staging, including the only .old copy. The expected result here is IncompleteRollback with that copy preserved. I verified a temporary local correction. Record an old file in the rollback list immediately after moving it aside, and let the outer rollback handle it if publishing fails. For a file with no previous copy, add it to the list only after successfully publishing it. The lock tests went from 2/3 to 3/3 with this change and the stock suite stayed at 9/9. The test with no previous copy also confirmed that rollback leaves a contending file alone. Synthetic files only. AI-assisted verification. Current main comparison at 8f481cf16f261c7f37458aeb45e8f4e19994146d. With the second of two synthetic destinations already locked for reading, main raises PermissionError after replacing the first file, leaving mixed versions. This PR leaves both originals in place for that case. The separate test that locks the destination after the backup rename still reproduces the missing recovery copy on this PR head.
LouisRiverstone commented 2026-11-25 00:24:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-11-25T00:24:36Z.


Taken over by its author in #1446 (rebased on main). This draft can be closed.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7148479753 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/204#issuecomment-7148479753). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-11-25T00:24:36Z. --- Taken over by its author in #1446 (rebased on main). This draft can be closed.
Andretuta commented 2026-11-27 04:01:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-27T04:01:47Z.


Closing carried-over draft: taken over by original author in #1446 (OLD-9937).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7209461188 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/204#issuecomment-7209461188). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-27T04:01:47Z. --- Closing carried-over draft: taken over by original author in #1446 (OLD-9937).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!204
No description provided.