[PR #272] raytracing: fix BVH index building and validation #324

Open
opened 2026-11-26 20:17:30 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/272
Author: @kotekompotek
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: work/build-1533-bvh-index


📝 Commits (1)

  • 070f952 bvh_index: require 208-byte head and mark truncated heads (BUILD-1533)

📊 Changes

2 files changed (+26 additions, -1 deletions)

View changed files

📝 tests/test_bvh_index.py (+23 -0)
📝 tools/bvh_index.py (+3 -1)

📄 Description

Claimed in the coordination issue as: BUILD-1533 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140050149)

What and why

  • Rebased onto current main (commit ccafaeeaa).
  • Guards classify() in tools/bvh_index.py on < 208-byte payloads so instance208 does not crash with struct.error, falling back to descriptor when >= 0x30 descriptor header bytes are available, and marks raw < min(size, HEAD) heads with signature="truncated-head" and truncated_head=True.
  • Added regression coverage (test_truncated_head_on_208_byte_payload_does_not_crash and CLI --max-inflate 128 checks on instance_payload and bvh_payload) in tests/test_bvh_index.py.

Tested

  • python -I tests/test_bvh_index.py (45 tests OK, 1 skipped without game archive) on commit ccafaeeaa.
  • All 12 tests/test_docs_*.py (OK) on commit ccafaeeaa.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/272 **Author:** [@kotekompotek](https://github.com/kotekompotek) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `work/build-1533-bvh-index` --- ### 📝 Commits (1) - [`070f952`](https://github.com/ubiquitarianism/leonida/commit/070f9521bdd1b2839ecaddc4bfa15170ea5f1606) bvh_index: require 208-byte head and mark truncated heads (BUILD-1533) ### 📊 Changes **2 files changed** (+26 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_bvh_index.py` (+23 -0) 📝 `tools/bvh_index.py` (+3 -1) </details> ### 📄 Description Claimed in the coordination issue as: BUILD-1533 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140050149) ### What and why - Rebased onto current `main` (commit `ccafaeeaa`). - Guards `classify()` in `tools/bvh_index.py` on `< 208`-byte payloads so `instance208` does not crash with `struct.error`, falling back to `descriptor` when `>= 0x30` descriptor header bytes are available, and marks raw `< min(size, HEAD)` heads with `signature="truncated-head"` and `truncated_head=True`. - Added regression coverage (`test_truncated_head_on_208_byte_payload_does_not_crash` and CLI `--max-inflate 128` checks on `instance_payload` and `bvh_payload`) in `tests/test_bvh_index.py`. ### Tested - `python -I tests/test_bvh_index.py` (`45 tests OK, 1 skipped` without game archive) on commit `ccafaeeaa`. - All 12 `tests/test_docs_*.py` (`OK`) on commit `ccafaeeaa`. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#324
No description provided.