[PR #777] anim_move: restore write mode before unlink on replace failure and publish mode on Windows (ANIM-MOVE-STAGE-CLEANUP) #815

Open
opened 2026-11-26 20:19:08 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/777
Author: @trigger337
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: fix/anim-move-stage-cleanup


📝 Commits (1)

  • efe0568 anim_move: restore write mode before unlink on replace failure and publish mode on Windows (ANIM-MOVE-STAGE-CLEANUP)

📊 Changes

2 files changed (+40 additions, -2 deletions)

View changed files

📝 tests/test_anim_move.py (+35 -0)
📝 tools/anim_move.py (+5 -2)

📄 Description

In tools/anim_move.py, _write_json_atomic creates a temporary file and previously skipped applying published_mode on Windows because os.unlink in the finally block fails with PermissionError (WinError 5) if replace_retry fails on read-only destinations.

Align with the repository standard:

  1. In finally, restore write permissions (try: os.chmod(staged.name, 0o600); except OSError: pass) before unlinking.
  2. Apply published_mode(destination) unconditionally so Windows outputs receive proper permissions instead of keeping NamedTemporaryFile's default 0o600 mode.
  3. Add synthetic regression tests verifying PermissionError handling and Windows published_mode application.

Tests pass (12/12 in test_anim_move.py), scripts/check_no_game_data.py passes cleanly.

agent: yes
AI-assisted: yes


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/777 **Author:** [@trigger337](https://github.com/trigger337) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/anim-move-stage-cleanup` --- ### 📝 Commits (1) - [`efe0568`](https://github.com/ubiquitarianism/leonida/commit/efe05681d9b5eec0d67eb078674f6e09d7ddcb68) anim_move: restore write mode before unlink on replace failure and publish mode on Windows (ANIM-MOVE-STAGE-CLEANUP) ### 📊 Changes **2 files changed** (+40 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_anim_move.py` (+35 -0) 📝 `tools/anim_move.py` (+5 -2) </details> ### 📄 Description In `tools/anim_move.py`, `_write_json_atomic` creates a temporary file and previously skipped applying `published_mode` on Windows because `os.unlink` in the `finally` block fails with `PermissionError` (WinError 5) if `replace_retry` fails on read-only destinations. Align with the repository standard: 1. In `finally`, restore write permissions (`try: os.chmod(staged.name, 0o600); except OSError: pass`) before unlinking. 2. Apply `published_mode(destination)` unconditionally so Windows outputs receive proper permissions instead of keeping `NamedTemporaryFile`'s default `0o600` mode. 3. Add synthetic regression tests verifying `PermissionError` handling and Windows `published_mode` application. Tests pass (12/12 in `test_anim_move.py`), `scripts/check_no_game_data.py` passes cleanly. agent: yes AI-assisted: yes --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#815
No description provided.