Guard the remaining unguarded os.link() calls in test_awc_names.py, test_gamedata_graph.py, test_navmesh_decode.py, test_restofworld_index.py, test_rtti_scan.py, test_save_keys.py, test_swizzle_search.py, and test_tex_headers_report_paths.py with try/except (OSError, NotImplementedError) so only the hard-link subtest/check is skipped when hard links are unavailable and the rest of each test still runs.
Two occupied slots with the same key and distinct payload indices passed
values_bijective, then folded into one dict entry in _grid_slots, so the
octree check passed and the depth and leaf counts lost an entry
(reported by Oblyterium on #3622). Require len(keys) == entries.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--deep now checks that every grid key is a sentinel-bit octree key (root 1,
child = parent << 3 | octant, every parent present) and that every inner
node's u32 word is 0x0000ff00, and reports key depths, the inner-node count
and leaf words by low byte. docs/navmesh.md records the measured layout;
the x/y order of octant bits 0/1 and the leaf fields' meaning stay open.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both tools validate --out and --csv against the input (they must not overwrite
it) but never against the filesystem object itself, so pointing --out at an
existing directory opened it for writing and ended the run in a
PermissionError traceback after the scan was already done:
Traceback (most recent call last):
...
PermissionError: [Errno 13] Permission denied: '../reports'
Refuse it up front with the flag name, like the neighbouring checks do, so it
costs one line and the scan never starts.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
The archive guard cannot see individual inputs in a carved directory. Use the same file selection for scanning and report validation so an output cannot replace a carved stream under either name.
A stream that starts inside a --limit window but ends past it was counted in carver_streams with
all its stored bytes, so stored + zero_padding + unread could exceed the span (up to 122% on a
2 MiB window of navmeshes.rpf). navmesh_index.py (#766) does not count such a stream; its bytes
inside the window are left to the tail. navmesh_decode now does the same and reports those
streams under past_window / past_window_stored instead of dropping them. Decoding is unchanged: a
resource that starts inside the window is still read to its end.
Real data (counts only), four 2 MiB windows of navmeshes.rpf: byte classes now add up to exactly
the span (main: 121.97%, 119.01%, 100.23%, 103.64%), and streams, stored, inflated, zero_padding
and unread equal navmesh_index.py's on every window.
Tests: the window-limit test now expects 1 carved stream + 1 past_window (main: 2); a new test
ends the window inside a stream and checks nothing is carved and the classes sum to the span.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`--out <the archive>` (and `--csv <the archive>`) opened the input for
writing after the scan and replaced it with the JSON summary, exit 0, no
warning. Refuse the combination up front, as the --out/--csv collision
already is, so the archive is never touched.
The scan finished, then a report path in a folder that did not exist ended
the run in a FileNotFoundError traceback and threw away the summary. Create
the parent folder at write time, as navmesh_index.py already does.
_psin_state() walked the section list and reported a resource complete when
the walk ended exactly at the end of the data. A PSIN header with no section
at all ends there too, so it was counted complete with 0 sections. At least
one section is now required.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>