mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:15:51 +01:00
[PR #2373] page_index: take a continuation shorter than 64 bytes (PAGE-INDEX-TINY-CONTINUATION) #2378
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2378
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2373
Author: @syfyra
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/page-index-tiny-continuation📝 Commits (1)
a05681dpage_index: take a continuation shorter than 64 bytes (PAGE-INDEX-TINY-CONTINUATION)📊 Changes
2 files changed (+33 additions, -2 deletions)
View changed files
📝
tests/test_page_index.py(+22 -0)📝
tools/page_index.py(+11 -2)📄 Description
Claimed in the coordination issue as: PAGE-INDEX-TINY-CONTINUATION (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7197610793)
What and why
tools/page_index.pyreads the RPF9 data area as a sequence of zlib streams, andscan_rpfdropped every stream that inflates to fewer than 64 bytes (the carver's cutoff). Such a stream can be exactly the continuation a page needs:docs/navmesh.mdrecovers 10 continuations of 16-48 bytes innavmeshes.rpf, 3 of them0DRPpages', andtools/navmesh_decode.pyaccepts short streams "strictly as continuations" for that reason.page_index skipped the short stream and took the next stream as the continuation instead. The page was reported complete, with that unrelated stream's bytes as its continuation, its
target_streamand its record payload. Synthetic case: a page whose last record runs 0x20 bytes past its stream, then a 0x28-byte stream, then an unrelated 0x100-byte stream → the 0x100-byte stream was reported as the continuation.scan_rpfnow yields short streams too, andindex_streamstakes one only while a page waits for a continuation, asnavmesh_decode.pydoes. On its own a short stream is never a page (the header alone is 0x60 bytes) and is not counted insummary.streams, so an archive without short streams reports exactly as before. A carved directory holds no short streams (the carver drops them), so that mode is unchanged. The docstring says so.This merges cleanly with my #2371 (same loop, a directory page is never a continuation) and with #1566; with #2371 merged in,
tests/test_page_index.pypasses.Tested
Windows 11, Python 3.14.7, synthetic RPF streams only:
python -I tests/test_page_index.py: 22 tests OK. Newtest_a_continuation_under_64_bytes_is_taken_only_as_one: a 0x20-byte stream before the page (skipped, not counted), the page, a 0x28-byte continuation and a 0x100-byte stream. It expects the 0x28-byte continuation,target_stream1, span 0x120 andstreams2. Onmainit fails with the 0x100-byte stream reported as the continuation.tests/test_csv_line_endings.pyOK;python -m compileall;scripts/check_no_game_data.pyon both files.Not measured: the effect on a real
navmeshes.rpf(no game files here); the expected change is that the 3 pages docs/navmesh.md names get their own short continuation.GPUs tested: n/a (CPU-only tool)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.