Repository navigation
heap_index_census: read a carve index saved with a UTF-8 BOM (EGEN-HEAP-INDEX-BOM, DeepSeek3) - #6051
Open
evilclanker9000 wants to merge 3 commits into
Open
evilclanker9000 wants to merge 3 commits into
evilclanker9000 wants to merge 3 commits into
Conversation
The census opened <work>/shaders/dxbc/index.json as utf-8, so an index a user re-saved with a BOM fell into the ValueError handler and the whole run stopped with "cannot read the carve index" and exit 2. utf-8-sig reads both forms. (EGEN-HEAP-INDEX-BOM, DeepSeek3)
Without the utf-8-sig read the CLI stops with "ERROR: cannot read the carve index ... Unexpected UTF-8 BOM" and exit 2; with it the census reads the same one-shader folder it reads from a BOM-free index. (EGEN-HEAP-INDEX-BOM, DeepSeek3)
…RROR line Negative controls for the utf-8-sig read: it must accept a BOM, not a broken index. Both cases keep exit 2 with a single "cannot read the carve index" line. (EGEN-HEAP-INDEX-BOM, DeepSeek3)
Contributor
|
Tested
AI-assisted. |
|
Verified at your head on main 561b65a: test_heap_index_census 16/16 (re-run) including the BOM round-trip and the two refusal cases, which produce exactly one ERROR line through the existing (OSError, ValueError, KeyError, TypeError) handler at heap_index_census.py:432 — asserted, not assumed. utf-8-sig is byte-identical for BOM-less input, so indexes without a BOM see no behavior change, and sampler_source_census inherits the fix via hic.stage_index. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tools/heap_index_census.py
opened the carve index (/shaders/dxbc/index.json) asutf-8, so an index the user re-saved from an editor that writes a UTF-8 BOM raisedUnexpected UTF-8 BOMinjson.load, fell into theValueErrorhandler and stopped the whole census with oneERROR: cannot read the carve indexline and exit 2. The file is a user-facing copy, so this is the same BOM class already fixed inclassify_carve,world_index,gamedata_indexand others. Reading it asutf-8-sig` accepts both forms.EGEN-HEAP-INDEX-BOM (found while working the small-tool bugs; posted as a
findingin #5934).Test
python -I tests/test_heap_index_census.py(no game files, no GPU):tools/heap_index_census.pyfrommain), new test only:FAIL: test_cli_reads_a_carve_index_saved_with_a_bom—AssertionError: 2 != 0 : ERROR: cannot read the carve index next to ...\disasm: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)Ran 16 tests ... OK(the 13 existing tests plus the BOM test and two negative controls).Notes
stage, with onecannot read the carve indexline and exit 2, so the BOM acceptance does not widen into accepting a corrupt index.docs/design.mdcontract row.stage_index();--jsonoutput staysutf-8without a BOM, as the other tools write reports.AI-assisted.