[PR #2346] REPLACE-RETRY-LOCK-VIOLATION-AND-SECONDS-VALIDATION #2349

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2346
Author: @kirigayakazima
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fix/replace-retry-lock-and-bounds


📝 Commits (1)

  • 8d0c278 REPLACE-RETRY-LOCK-VIOLATION-AND-SECONDS-VALIDATION

📊 Changes

2 files changed (+105 additions, -3 deletions)

View changed files

➕ tests/test_replace_retry_bounds.py (+98 -0)
📝 tools/replace_retry.py (+7 -3)

📄 Description

Claimed in the coordination issue as: REPLACE-RETRY-LOCK-VIOLATION-AND-SECONDS-VALIDATION (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7194632590)

What and why

  • Add Windows ERROR_LOCK_VIOLATION (33) alongside 5 and 32 in _TRANSIENT_WINERRORS in tools/replace_retry.py so transient byte-range lock conflicts retry cleanly instead of failing immediately.
  • Validate optional seconds up front in replace() so booleans, non-numeric values, negative numbers, NaN, and infinities raise ValueError before calling os.replace or entering the retry loop (avoiding silent no-sleep returns or infinite NaN deadline loops).
  • Add unit tests in tests/test_replace_retry_bounds.py.

Tested

  • python -I tests/test_replace_retry_bounds.py -v: 3 passed, 0 failed (detached upstream/main baseline with only the new test file fails: 6 failures, 2 errors across subtests).
  • python -I tests/test_replace_retry.py -v: 10 passed, 0 failed.
  • python -I tests/test_ci_registration.py: 16 passed.
  • python -I tests/test_text_write_line_endings.py: 3 passed.
  • python -I scripts/check_no_game_data.py, python -I -m compileall -q tools/replace_retry.py tests/test_replace_retry_bounds.py, and git diff --cached --check: passed.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

🔄 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/2346 **Author:** [@kirigayakazima](https://github.com/kirigayakazima) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/replace-retry-lock-and-bounds` --- ### 📝 Commits (1) - [`8d0c278`](https://github.com/ubiquitarianism/leonida/commit/8d0c2788642b1194ca3f31b3eb5d32a0a0f83cf9) REPLACE-RETRY-LOCK-VIOLATION-AND-SECONDS-VALIDATION ### 📊 Changes **2 files changed** (+105 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `tests/test_replace_retry_bounds.py` (+98 -0) 📝 `tools/replace_retry.py` (+7 -3) </details> ### 📄 Description Claimed in the coordination issue as: REPLACE-RETRY-LOCK-VIOLATION-AND-SECONDS-VALIDATION (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7194632590) ### What and why - Add Windows `ERROR_LOCK_VIOLATION` (`33`) alongside `5` and `32` in `_TRANSIENT_WINERRORS` in `tools/replace_retry.py` so transient byte-range lock conflicts retry cleanly instead of failing immediately. - Validate optional `seconds` up front in `replace()` so booleans, non-numeric values, negative numbers, `NaN`, and infinities raise `ValueError` before calling `os.replace` or entering the retry loop (avoiding silent no-sleep returns or infinite `NaN` deadline loops). - Add unit tests in `tests/test_replace_retry_bounds.py`. ### Tested - `python -I tests/test_replace_retry_bounds.py -v`: 3 passed, 0 failed (detached `upstream/main` baseline with only the new test file fails: 6 failures, 2 errors across subtests). - `python -I tests/test_replace_retry.py -v`: 10 passed, 0 failed. - `python -I tests/test_ci_registration.py`: 16 passed. - `python -I tests/test_text_write_line_endings.py`: 3 passed. - `python -I scripts/check_no_game_data.py`, `python -I -m compileall -q tools/replace_retry.py tests/test_replace_retry_bounds.py`, and `git diff --cached --check`: passed. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. --- <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#2349
No description provided.