mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:30:52 +01:00
[PR #782] mask_channels: make the --json staging deletable when a replace fails (MASK-CHANNELS-STAGE-CLEANUP) #821
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#821
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/782
Author: @djrolfes
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:djrolfes/mask-channels-stage-cleanup📝 Commits (1)
9a3ee25mask_channels: make the --json staging deletable when a replace fails📊 Changes
2 files changed (+50 additions, -6 deletions)
View changed files
📝
tests/test_mask_channels.py(+34 -0)📝
tools/mask_channels.py(+16 -6)📄 Description
Claimed in the coordination issue as: MASK-CHANNELS-STAGE-CLEANUP (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7133242472)
Depends on: none
Fixes: none (the work item is the finding in issue #14; there is no separate issue to close)
Independent branch update
Head
9a3ee25fd, based one18b59a5b, contains exactly one topic commit. Removed the accidentally inherited #771 concurrency change and all sibling cleanup commits; this PR is now genuinely independent, soDepends on: noneis accurate. Retested on Linux: 10 tests pass, Python compileall, changed-file scanner and diff checks pass. Clean merge-tree against5da72d19f. Original head preserved; branch updated with an explicit lease. A passing label check is not full CI, and no hosted-suite pass is claimed. AI-assisted.What and why
tools/mask_channels.pypublishes--jsonthrough a staging file that is chmod'ed to the destination's permission bits beforeos.replace. When the replace fails over a read-only report on Windows, the staged file is read-only, so theTemporaryDirectorycleanup cannot delete it: the staging folder is stranded beside the report and the cleanup'sPermissionErrormasks the real failure, so the tool's one-ERROR:-line promise breaks exactly when it matters.This publishes through a named staging file (
mkstempnext to the destination, same folder creation and same report content) with an explicit cleanup in afinally: make the staged file writable (0o600) before unlinking and suppress the cleanup error, so a failed write is still oneERROR:line and exit 2, the old report stays in place, and aKeyboardInterruptmid-write still cleans up. The shape is the onenavmesh_index.pyandbvh_index.pyalready use for their staging cleanup.Tested
python3 -I tests/test_mask_channels.py: 10 tests OK, including the newtest_failed_replace_of_read_only_report_removes_writable_temp, which fails against the old code on the made-deletable assertion (it mocks the replace as failing over a0o444report, asserts exactly oneERROR:line naming the replace error, the old report untouched, no.mask-json-staging file left behind, and that the staged file was made deletable before unlinking).python3 -m compileall -q tools/mask_channels.py tests/test_mask_channels.pyclean;tests/test_report_paths.pyandtests/test_text_write_line_endings.pystill OK.python3 -I scripts/check_no_game_data.py tools/mask_channels.py tests/test_mask_channels.pypasses; synthetic images only.GPUs tested: n/a (standard-library tool; no game files, nothing online)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.