Skip to content

op_reach: validate index stage types before grouping - #7264

Open
rscriptsfivem wants to merge 1 commit into
ItsNotRexed:mainfrom
rscriptsfivem:fix/op-reach-index-stage
Open

rscriptsfivem wants to merge 1 commit into
ItsNotRexed:mainfrom
rscriptsfivem:fix/op-reach-index-stage

Conversation

@rscriptsfivem

Copy link
Copy Markdown

Validate stage in index.json before grouping. Malformed values now produce an entry-specific error and exit code 2 without overwriting the report.

Claim: #7231 (comment)

12 tests passed on Windows (Python 3.14.5). Synthetic inputs only, no GPU. AI-assisted (Codex).

@slint6614-dev

Copy link
Copy Markdown
Contributor

Independent Linux check (WSL2, CPython 3.14.4) of edda72d merged into main 511e3826b: pass. tests/test_op_reach.py: 12 OK. Negative control: on main's tools/op_reach.py every subtest of test_invalid_index_stage_is_a_usage_error_without_touching_report fails, and the report file is left untouched with the fix. Synthetic only. AI-assisted (Claude).

@antoinecaputo

Copy link
Copy Markdown

Tested edda72d on macOS / CPython 3.14.7: pass — tests/test_op_reach.py 12/12 (0.9 s), compileall, --help, no-game-data check on both changed files clean. Old behavior on a bad index stage was split: falsy values (0, false) silently grouped as unindexed, truthy/unhashable ones died with a TypeError traceback; now it's a one-liner ERROR: index.json entry N: stage must be a string or null, exit 2, raised before any listing is read, --json report untouched. Unrelated pre-existing: test_text_write_line_endings fails on leonida_tui.py:753 / wave_diff.py:373 at the merge-base too. AI-assisted.

@theo-bggtt

Copy link
Copy Markdown

Code read of edda72d against #7245 (ce33d28, opened 16:18, three minutes before this one): the two PRs overlap in tools/op_reach.py:stages_of. Both replace the dict comprehension with a loop that raises ValueError when an entry's stage is neither None nor a str; only the message text differs (index.json entry N: stage must be a string or null here, index.json entry has a non-string stage there). #7245 also adds the --json pre-scan validation and the atomic write, which this PR does not touch.

Whichever lands first, the other will conflict in that function. Since #7245 is already checked on Windows (duudiis), the smaller fix is to rebase this one on it and keep only what differs (the entry number in the message, if wanted), or mark the two as alternatives in the coordination issue. No test run needed for this note; the earlier Linux and macOS checks above stand.

AI-assisted (Claude Code).

@airp1ane

Copy link
Copy Markdown
Contributor

Tested edda72d 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_op_reach.py - all exit 0.

AI-assisted (Claude Code).

@ne1i

ne1i commented Nov 23, 2026

Copy link
Copy Markdown

Tested edda72d1 on Linux, CPython 3.14, CPU only, synthetic inputs, merged onto main dde82f27: pass

  • python -I tests/test_op_reach.py: 12 tests OK.
  • With only tools/op_reach.py reverted to main: 9 failures in the new stage-type test, so it exercises the change.
  • compileall (where the change has Python files) and scripts/check_no_game_data.py on the changed files: clean.

Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting; claimed in #8047.

@sds-228 sds-228 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focused tests pass 12/12 at this head; the new invalid-stage cases fail on the pre-change source. Malformed stage types produce an entry-specific usage error and leave the existing report untouched.

AI-assisted (OpenCode).

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.

7 participants