mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:35:53 +01:00
[PR #1622] tile_probe: make an impossible --offset a usage error with exit 2 #1635
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#1635
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/1622
Author: @xel1uz
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/tile-arg-guards📝 Commits (1)
69e6b59tile_probe: reject a negative or past-the-end --offset with exit 2📊 Changes
2 files changed (+33 additions, -9 deletions)
View changed files
📝
tests/test_tile_probe.py(+23 -7)📝
tools/tile_probe.py(+10 -2)📄 Description
Item ID:
TILE-OFFSET-USAGE(new item; the coordination issue #14 is at GitHub's 2,500-comment cap, so the claim lives here)Claimed as:
TILE-OFFSET-USAGE- an offset outside the blob is reported as a run result (exit 1) while sibling tools treat it as usage (exit 2). Reproduced on42537e7b.What and why
An impossible
--offset(-1, or at/past the end) reached the read and thenraise SystemExit(... is outside ...)with exit 1, so a script could not separate a bad argument from a probe result. Validation now happens before--out, the numpy check and the read:ERROR: --offset must not be negativeandERROR: --offset N is past the end of <blob> (M bytes), both exit 2. Theno layout fitsresult path deliberately stays at exit 1 - the offset is valid there, only the sample is short - and an empty blob at offset 0 keeps that result path, while the same blob at offset 5 is a usage error. Both decisions are commented in the code.Note:
tools/f16misc_diff.pywas in this tree briefly and dropped again;fix/f16misc-arg-guardsowns it.Tested
pytest tests/test_tile_probe.py -qwith the tool at42537e7b: 4 failed, 12 passed, 1 skipped, 6 subtests passed.With this branch: 14 passed, 1 skipped, 8 subtests passed.
Real repro on a 4096-byte blob:
--offset -1and--offset 4096each print one ERROR line and exit 2.git diff --checkclean;python3 -I scripts/check_no_game_data.pyclean on the changed files.GPUs tested: n/a - CPU only, no Vulkan device involved.
AI-assisted: Yes.
Checklist
main(42537e7b) and merges cleanly.docs/design.md- not applicable, no translator change.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.