Skip to content

fix(tools): reject non-finite First Light clear values (Codex) - #5782

Open
evilclanker9000 wants to merge 1 commit into
ItsNotRexed:mainfrom
evilclanker9000:codex/first-light-finite-manifest-clear
Open

evilclanker9000 wants to merge 1 commit into
ItsNotRexed:mainfrom
evilclanker9000:codex/first-light-finite-manifest-clear

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: EGEN-FIRST-LIGHT-FINITE-MANIFEST-CLEAR

Depends on: #3771 (overlapping rewrite of the coverage checker and its tests)

What and why

Reject NaN and infinite clear values in the First Light manifest before counting readback coverage. A non-finite reference causes every finite background pixel to be counted as covered, so an incomplete textured draw can pass.

Tested

AI-assisted: yes

Checklist

  • No game data, keys or decryption.
  • Translator rule contract update (inapplicable to this oracle check).

A non-finite clear reference turns every background pixel into coverage and can hide an incomplete textured draw.
@LocranKing

Copy link
Copy Markdown
Contributor

Tested cf9dfe239 on Windows 11 Home (Build 26200 x64), NVIDIA GeForce RTX 3060 Ti (driver 621.01), Python 3.12.10: pass.

  • git diff --check HEAD~1..HEAD: clean
  • python -I -m compileall -q make_game.py tools tests: exit 0
  • python -I make_game.py --help: exit 0
  • python -I tests/test_first_light.py -v: 47 tests ran in 0.661s, OK (skipped=7) (3 skipped without LEONIDA_FIRST_LIGHT_DIR, 4 symlink subtests skipped on unprivileged Windows; test_textured_coverage_rejects_nonfinite_manifest_clear passed)

AI-assisted. No game files.

@leozinhoszg

Copy link
Copy Markdown
Contributor

Tested cf9dfe23 on Windows 11 Pro (26200), CPython 3.14.7, CPU only, no GPU, no game files: pass.

  • python -I tests/test_first_light.py: 47 OK (4 skipped). git diff --check origin/main...HEAD: clean.
  • Negative control: against main's tools/first_light.py, the new test fails for all three values (NaN, 1e999, -1e999).
  • Mechanism confirmed: _close (first_light.py:611) is math.isfinite(got) and abs(got - want) <= tol, so with want = NaN no pixel is ever "clear", and every background pixel counts as covered.
  • clear is a scalar compared per channel (:713, :729), so the isinstance(clear_val, float) guard covers every non-finite value JSON can produce here.
  • I also checked the other numeric fields in the same path. min_coverage / max_coverage fail closed with NaN, since not (min <= ratio <= max) raises when either bound is NaN. So clear was the only one that let an incomplete draw pass.

AI-assisted.

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.

3 participants