world_archetypes: read a carved resource's continuation file too (WORLD-ARCHETYPES-FOLDER-CONTINUATION) #2382
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2382
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/world-archetypes-folder-continuation"
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 successfully merged and closed
Claimed in the coordination issue as: WORLD-ARCHETYPES-FOLDER-CONTINUATION (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7197984448)
What and why
tools/world_archetypes.pyreads archetype definitions (CMapTypes) and, with--check-extents, map entity blocks, from an RPF9 window, a carved file or a folder of carved streams.On a folder,
iter_resourcestakes the rows fromworld_index.scan_path, which joins a0DRPzresource whose blocks run past its stream with the carved file of the stream that followed it. It finds that file through rpf9_carve'sindex.json(_carve_successors, asscan_rpfdoes in an archive). The row then carries the joined length assizebut only the first file asfile.iter_resourcesre-read that first file alone, so every block stored in the continuation was lost without a warning:--check-extentscompares.The same two streams inside an RPF9 window are joined by
WC.assembleand read in full.docs/world_census.mdcounts 2,868 maps that join a continuation, and a large CMapTypes or interior resource runs past its first stream the same way.iter_resourcesnow joins the same files: it follows the carve's successors while the data is shorter than the row'ssize. Single carved files, folders withoutindex.jsonand resources that fit in one stream read exactly as before.Different topic from #1555 (identity quaternion, nameless definitions, atomic writes; same files); the two merge cleanly.
Tested
Windows 11, Python 3.14.7, synthetic resources only:
python -I tests/test_world_archetypes.py: 20 tests OK. Newtest_folder_joins_a_continuation_file_as_world_index_does: a carve folder as rpf9_carve writes it (<offset>.binper stream plusindex.json). The CMapTypes resource's last block runs 0x10 bytes into the next stream, and the map file is a separate stream. It asserts thatscan_pathjoins the two (row size = whole resource) and that the CLI then reports the same summary as the RPF9-window test (2 archetypes, extents checked). Onmainit gets(maptypes, archetypes, names) = (1, 0, 0).main, and 40 from both with the fix (review repro).python -m compileall;scripts/check_no_game_data.pyon both files.Not measured: how many archetypes this recovers from a real carve (no game files here).
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
VERIFY-2382 — Linux, Python 3.15, CPU only, no game files
Claimed as
VERIFY-2382(+18/-0 test, +14/-1 tool). Two-step method: merge into a clean worktree atmain(9d231d37), then take only the test file onto cleanmain.python -I tests/test_world_archetypes.pymainmain+ this pull requestmain+ only this pull request's test fileThe failure on the last row is an
AssertionError, not an import or attribute error, so the test is exercising the changed code rather than merely failing to load it. Reverse control holds: the change is what turns it green.Verified. Nothing found against it; merges cleanly with
mainat9d231d37.AI-assisted: yes — MiMo-V2.6-Flash (OpenCode).
Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.
(AI-assisted triage.)
Now ready for review and
MERGEABLE. Clean-room verified: reading carved resource continuation files intools/world_archetypes.py:130-149with tests intests/test_world_archetypes.pyis clean and verified with positive + negative control (@imShangLi).Approving — ready to merge once CI runs green on current
main.(AI-assisted review.)
I extended the synthetic check to split both the definition resource and the map resource across two continuations each. The same six streams were written as an archive and as an indexed carve folder. At
e801a13a+9f27ba2e, the public--check-extentscommand reported two archetypes and one matching conjugate-rotation case in each mode. The reassembled byte strings and the semantic JSON fields matched between modes. Onmain, archive mode produced the same correct values, while carved mode produced zero archetypes and zero matching rotations.python -I tests/test_world_archetypes.pypassed 24/24 with the PR and 23/23 onmain. MEASURED on Linux, CPython 3.14.10, with synthetic fixtures. AI-assisted (Codex).