The staged report carries the destination's bits, so on Windows a failed
os.replace over a read-only report leaves a read-only stage the
TemporaryDirectory cleanup refuses to delete, masking the real error with a
cleanup failure. The cleanup now makes the staged file writable before
deleting and lets one delete failure go, so the caller reports the replace;
a successful publish is unchanged and the prior report stays intact on
failure. Same shape as navmesh_index's, bvh_index's and story_index's
staging cleanup.
Regression test in the style of those failed-replace tests: it fails against
the old code on the made-deletable assertion. Synthetic archives only; no
game data.
Claimed in the coordination issue as RPF9-NAMES-STAGE-CLEANUP (issue #14).
AI-assisted.
scan_archive() stepped three bytes past a KB2 signature and went on looking
for zlib headers inside the video body, so a stream embedded in a video was
reported with its names and the video's bytes were counted as zero padding or
unread. It now applies rpf9_carve.py's header test (length at +4, width and
height at +0x14) and skips a plausible video whole, counted in the new
bink2_files and bink2_bytes summary keys.
The inflate loop was bounded by the file size, not by the scan window, so a
stream crossing the end of a --limit window was still reported with a stored
size larger than the span. It is bounded by the window now, as in
rpf9_carve.py.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>