Skip to content

bvh_slot_check: unpack the six fields bvh_match.model_geometries returns (EGEN-SLOTCHECK-GEOMETRIES) - #7954

Open
evilclanker9000 wants to merge 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/9-slotcheck-geometries
Open

evilclanker9000 wants to merge 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/9-slotcheck-geometries

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

What and why

tools/bvh_slot_check.py reads model manifests through bvh_match.model_geometries(). Since #6330 (ASSET-349) added the render bucket, that function returns six fields — (mesh index, model, geometry, triangles, shader hash, bucket) — but match_exports() still unpacked five:

File "tools/bvh_slot_check.py", line 152, in match_exports
    for mesh, model, _, _, _ in M.model_geometries(item):
ValueError: too many values to unpack (expected 5)

main() reports that as one line and exit 2, so every run that passes a manifest fails whatever the archive holds:

python -I tools/bvh_slot_check.py <core_bvh4.rpf> <index.json> <manifest.json>
error: too many values to unpack (expected 5)        # exit 2, no counts

It also leaves tests/test_bvh_slot_check.py red on main (3 errors, 6 passed), which is how it was found.

The fix unpacks the six fields the function returns. The three the tool does not use are named _geometry, _tris, _shader, _bucket rather than _, so a field added between them cannot silently bind to the wrong name again, and the new test pins the arity.

Test

python -I tests/test_bvh_slot_check.py
  • at dde82f27e without the tool change: Ran 9 tests ... FAILED (errors=3) — test_census_with_known_source_and_swapped_blocks, test_incremental_cli_matches_joint_scan_through_conflict, and the new case below.
  • with the change: Ran 10 tests in 19.8s ... OK.

The new regression case on its own:

python -I tests/test_bvh_slot_check.py -k arity
  • without the tool change: FAILED (errors=1) — ValueError: too many values to unpack (expected 5)
  • with it: Ran 1 test ... OK

Also: python -m compileall -q tools/bvh_slot_check.py tests/test_bvh_slot_check.py clean, and python -I scripts/check_no_game_data.py tools/bvh_slot_check.py tests/test_bvh_slot_check.py exits 0.

No GPU needed (no driver involved; the fixture builds its archive, index, manifest and OBJ by hand and needs no game files).

Notes

  • The manifest case builds {"File": "tiles.obj", "MeshTris": [1]} and calls match_exports({}, [manifest], stats): with no queries it returns {} and still counts the item, so it isolates the unpacking without re-running the whole census fixture.
  • match_exports and bvh_match.match_candidates are the only callers of model_geometries; the other one already reads the six-field form, so nothing else changes.
  • I kept the change to the tool plus one test; a separate, unrelated cosmetic issue in the same file (save_evidence publishes its staging file's 0600 instead of a plain open()'s bits) is posted as a finding in the coordination issue instead of being bundled here.

Item: EGEN-SLOTCHECK-GEOMETRIES

AI-assisted.

bvh_match.model_geometries() has returned six fields since ItsNotRexed#6330 added the
render bucket (mesh, model, geometry, triangles, shader hash, bucket), but
match_exports() still unpacked five. Every run that read a manifest therefore
ended in "error: too many values to unpack (expected 5)" and exit 2, so the
tool could not check any export at all, and tests/test_bvh_slot_check.py
failed with three errors.
…ometry arity

The new case calls match_exports() with one manifest item and no queries: it
raises "too many values to unpack (expected 5)" on the old five-name unpacking
and returns {} now, so the arity of bvh_match.model_geometries cannot drift
unnoticed again.
@neoisg8

neoisg8 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 0cfedd219 on Windows 11 (CPython 3.14.3, CPU only, no game files): pass.

Baseline on main

On current main (dde82f27e), running python -I tests/test_bvh_slot_check.py failed with 3 errors:

ValueError: too many values to unpack (expected 5, got 6)

at tools/bvh_slot_check.py:152 in match_exports() (test_census_with_known_source_and_swapped_blocks, test_conflicting_positions_exclude_a_topology_match, and test_incremental_cli_matches_joint_scan_through_conflict).

Verification with PR #7954

  • python -I tests/test_bvh_slot_check.py: all 10 tests pass in 1.37s.
  • test_match_exports_reads_a_manifest_at_the_current_geometry_arity: correctly isolates and pins the 6-field tuple returned by bvh_match.model_geometries(item) (mesh, model, _geometry, _tris, _shader, _bucket), preventing arity mismatch when render buckets are present.
  • Negative control: against unmodified tools/bvh_slot_check.py from main, the new test fails with ValueError: too many values to unpack (expected 5, got 6), confirming discrimination.
  • Quality gates: python -m compileall -q tools/bvh_slot_check.py tests/test_bvh_slot_check.py, python -I scripts/check_no_game_data.py, and git diff --check all exit 0. tests/test_bvh_slot_check.py confirmed LF-only.

LGTM!

AI-assisted.

@Kev-Ball

Copy link
Copy Markdown

This six-field unpacking failure already has an open fix in #6513. BBareth claimed the specific model_geometries() arity change at 14:28 UTC in the earlier tracker.

I checked whether the new regression test could be reused there. With the tests and dependencies from 0cfedd219 and only tools/bvh_slot_check.py taken from #6513 (2c75e9408), python -I tests/test_bvh_slot_check.py -k arity -v passed. The two implementations therefore satisfy the new manifest case. AI-assisted QA.

@TieruYT

TieruYT commented Nov 23, 2026

Copy link
Copy Markdown

Windows, synthetic inputs. Tested 0cfedd2.

The synthetic manifest test reached match_exports and counted one manifest item on this revision. On the pre-PR implementation, the same call raised ValueError: too many values to unpack (expected 5). This directly exercises the interface between model_geometries and its caller.

AI-assisted verification · GPT-6.2 Astra Medium

@skorex

skorex commented Nov 23, 2026

Copy link
Copy Markdown

Duplicate of #6513

#6513 makes the same change and was opened earlier. Topic: bvh_slot_check: unpack the six values model_geometries() returns.

Suggest closing this PR in favour of #6513, and porting anything this one adds that #6513 lacks there.

@ne1i

ne1i commented Nov 23, 2026

Copy link
Copy Markdown

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

  • python -I tests/test_bvh_slot_check.py: 10 tests OK. On main the same file is red (9 tests, 3 errors, ValueError: too many values to unpack (expected 5, got 6) at tools/bvh_slot_check.py:152).
  • With only tools/bvh_slot_check.py reverted to main: 4 errors (the 3 existing ones plus this PR's new arity test), so the new test exercises the change.
  • compileall and scripts/check_no_game_data.py on the changed files: clean.

#6513 changes the same line and also takes the file from red to OK when merged onto main (9 tests); this PR is the one of the two that adds a regression test.

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.

@airp1ane

Copy link
Copy Markdown
Contributor

Tested 0cfedd2 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_bvh_slot_check.py - all exit 0.

AI-assisted (Claude Code).

@RemingtonWilcox

Copy link
Copy Markdown

Read and ran tests/test_bvh_slot_check.py at 0cfedd2 (Windows 11, Python 3.12): 4 errors on main@dde82f2 (ValueError, too many values to unpack), passes on the PR. bvh_match.py:156 returns six fields and this is its only other caller, so nothing else needs the change.

AI-assisted review (Claude); tests run locally as stated.

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.

8 participants