Skip to content

ps_sweep: a readback the tool cannot open is a class, not a traceback - #7886

Open
evilclanker9000 wants to merge 4 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/10-pssweep-oserror
Open

evilclanker9000 wants to merge 4 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/10-pssweep-oserror

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

ps_sweep.py compare reads each draw's .raw readback to classify it, and all four readers caught only
FileNotFoundError. Anything else — a folder where the readback should be (IsADirectoryError on Linux,
PermissionError on Windows), or a permission failure on the file itself — escaped as a traceback and ended the
whole compare before any report was written. That is exactly the damaged or incomplete readback the classes exist
for, so it should be a class and not an abort.

What changed in tools/ps_sweep.py:

reader before after
classify_pair (tolerance compare) FileNotFoundError -> invalid readback, every other OSError -> traceback other OSError -> invalid readback, reason <tag>: unreadable output
exact_pair (--exact) FileNotFoundError -> missing, other OSError -> traceback other OSError -> incompatible
depth_measurements (--depth) FileNotFoundError -> depth_class: missing, other OSError -> traceback other OSError -> depth_class: incompatible
depth_measurements, two-clear control reads same same

A missing file keeps its existing class, so nothing that classified before changes. docs/shader_validation.md
names the new case next to the classes it describes.

Test

tests/test_ps_sweep.py gains one case per reader (5 new tests). Each makes a temp folder named <i>.raw,
<i>.raw.depth or <i>.raw.zero.depth where the tool expects a file, so the open raises PermissionError on
Windows and IsADirectoryError on Linux — both OSError, neither FileNotFoundError.

Before (tests added, tool unchanged):

python -I tests/test_ps_sweep.py
ERROR: test_unreadable_output_is_an_invalid_readback (__main__.Classification...)
  PermissionError: [Errno 13] Permission denied: '...\unreadable.raw'
ERROR: test_unreadable_exact_and_depth_readbacks (__main__.CompareCommand...)
  PermissionError: [Errno 13] Permission denied: '...\0.raw'
ERROR: test_unreadable_two_clear_depth_readback (__main__.CompareCommand...)
  PermissionError: [Errno 13] Permission denied: '...\0.raw.zero.depth'
Ran 26 tests in 0.506s
FAILED (errors=3, skipped=3)

The first version of the case file had one test covering exact_pair and the first depth read; I split those per
reader for the three commits, so the final file has 5 new cases and 27 tests.

After:

python -I tests/test_ps_sweep.py
Ran 27 tests in 0.546s
OK (skipped=3)             # the 3 GPU cases, PS_SWEEP_TEST_EXE unset

End to end with the same damaged output, both modes now report instead of raising:

python -I tools/ps_sweep.py compare --exact --out <dir> --tags a b
draws total 1
  incompatible: 1

python -I tools/ps_sweep.py compare --out <dir> --tags a b
variant z total 1
  invalid readback: 1
    invalid readback / a: unreadable output: 1

python -m compileall -q tools tests, python -I scripts/check_no_game_data.py tools/ps_sweep.py tests/test_ps_sweep.py docs/shader_validation.md and python -I tests/test_docs_links.py also run here; the last
one fails only on the pre-existing docs/dev-tools.md -> runtime/README.md#a-600-frame-headless-guest-scene
anchor (an unclosed fence on main, open PR #7351), not on this change.

No GPU needed: the readers are pure file I/O with synthetic readbacks. Everything above ran on Windows 11 with
Python 3.12.

Notes

  • incompatible rather than missing for the non-FileNotFoundError cases of --exact and --depth: the path
    exists but is not a usable readback, which is what those classes already mean for a wrong length.
  • classify_pair gets a reason of its own (unreadable output) so the existing missing output still means the
    file is absent.
  • I did not touch load_results or the result-log readers: those parse what this tool itself wrote, so a folder
    there is a different failure, not a damaged worker readback. Say so if you want the same treatment.

Task: EGEN-PSSWEEP-OSERROR in #7804 (posted there as a finding: first).

AI-assisted.

… a traceback

classify_pair caught only FileNotFoundError, so a folder named <i>.raw or a permission failure on the output ended the whole compare with PermissionError/IsADirectoryError. Catch OSError after it and report the same class with a reason of its own.
…ible

exact_pair returned missing for FileNotFoundError and let every other OSError escape, so --exact stopped on the first folder or unreadable .raw instead of classifying it.
Both depth reads and the two-clear control reads let a PermissionError or IsADirectoryError through, so --depth ended with a traceback where it should have said incompatible.
… an abort

ps_sweep compare now reports a folder or a permission failure where a .raw file should be as invalid readback (incompatible for --exact and --depth); say so where the classes are described.
@TieruYT

TieruYT commented Nov 23, 2026

Copy link
Copy Markdown

Windows, Python 3.13.7, synthetic inputs. Tested 12d09c4 with the same focused tests against the implementation at dde82f2.

All four focused readback tests passed. Unreadable input reached the invalid-readback classification, and exact, depth and two-clear-depth comparisons returned incompatible. The earlier implementation failed the same suite. These were filesystem and classification checks on CPU.

AI-assisted verification · GPT-6.2 Astra Medium

@thehollowedone

Copy link
Copy Markdown

I checked the CLI report path on Windows at 12d09c4d, in addition to the focused tests above. A directory at an expected readback path raised PermissionError, and both comparisons still wrote their reports. Tolerance mode recorded invalid readback, exact mode recorded incompatible, and the valid control compared as expected.

One wording detail in docs/shader_validation.md: the updated paragraph groups missing files with unreadable files under incompatible. Exact mode keeps the separate missing class when the file is absent. The depth code makes the same distinction. Splitting those cases in the paragraph would match the report.

Synthetic inputs only. AI-assisted.

@morodirule

Copy link
Copy Markdown

Tested 12d09c4 on Arch Linux, Python 3.14.10, CPU only: pass — first Linux check. tests/test_ps_sweep.py 27/27 (3 skipped) OK. Negative control: base tool → 4 errors (IsADirectoryError tracebacks instead of classified invalid-readback); restored, green again. No game files. AI-assisted.

@azterixx

Copy link
Copy Markdown

checked: #7886 | with: python -I -m unittest discover -s tests -p test_ps_sweep.py | on: Debian 13, Intel i7-8700, CPython 3.13.5, head 12d09c4, CPU only | result: pass (27 tests, 3 skipped; main@dde82f27e: Ran 23 tests OK (skipped=3))

@airp1ane

Copy link
Copy Markdown
Contributor

Tested 12d09c4 on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass.

Ran the test files this PR adds or changes, from a clean checkout of the PR head: test_ps_sweep.py - all exit 0.

AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants