mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:25:52 +01:00
[PR #1597] mask_channels: validate dimensions/buffers and --json paths, preserve symlinks and /dev/null (MASK-CHANNELS-VALIDATION-AND-ATOMIC-IO) #1614
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#1614
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/1597
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/mask-channels-validation-and-atomic-io📝 Commits (1)
6a8b857mask_channels: validate dimensions/buffers and --json paths, preserve symlinks and /dev/null📊 Changes
2 files changed (+126 additions, -24 deletions)
View changed files
📝
tests/test_mask_channels.py(+65 -0)📝
tools/mask_channels.py(+61 -24)📄 Description
Item:
MASK-CHANNELS-VALIDATION-AND-ATOMIC-IO(unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touchtools/mask_channels.py).Summary
blobs()(len(mask) == width * height) andchannel_counts()(len(rgba) == width * height * 4) so zero/negative/mismatched inputs raiseValueErrorinstead ofZeroDivisionErroror silently skewed statistics.--jsonbefore decoding the DDS texture: reject empty/whitespace strings (""," ") and trailing-separator directory paths (new_dir/).--jsonpublishing via_write_json_report(): resolve symlinks so symlinked report paths update their target in place, write non-regular targets (such as/dev/null) directly, check write permissions on existing regular files before staging, usereplace_retry.replacewithallow_nan=Falseand trailing\n, and publish before printing stdout.Verification
python3 -W error -I tests/test_mask_channels.py -v: 13/13 passed.python3 -I tests/test_text_write_line_endings.py: 3/3 passed.python3 -I scripts/check_no_game_data.py tools/mask_channels.py tests/test_mask_channels.py: passed.python3 -m compileall -q tools/mask_channels.py tests/test_mask_channels.py: passed.tests/test_mask_channels.pyagainst unpatchedmain:tools/mask_channels.py):failures=10, errors=0across all 4 new regression tests.AI-assisted: yes
GPUs tested: none (CPU-only Python texture-mask analysis tool; synthetic RGBA8 DDS only, no game data)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.