world_archetypes: read a carved resource's continuation file too (WORLD-ARCHETYPES-FOLDER-CONTINUATION) #2382

Open
github-bot wants to merge 1 commit from github-bot/gh-2382 into main AGit
Owner

@⁠syfyra on GitHub · 2026-11-26 16:42 UTC · original
syfyra:fix/world-archetypes-folder-continuation → main · +32 −1 · 2 files · 1 commits · draft

Claimed in the coordination issue as: WORLD-ARCHETYPES-FOLDER-CONTINUATION (#1608)

What and why

tools/world_archetypes.py reads 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_resources takes the rows from world_index.scan_path, which joins a 0DRPz resource whose blocks run past its stream with the carved file of the stream that followed it. It finds that file through rpf9_carve's index.json (_carve_successors, as scan_rpf does in an archive). The row then carries the joined length as size but only the first file as file. iter_resources re-read that first file alone, so every block stored in the continuation was lost without a warning:

  • archetype definitions;
  • the map entity blocks --check-extents compares.

The same two streams inside an RPF9 window are joined by WC.assemble and read in full. docs/world_census.md counts 2,868 maps that join a continuation, and a large CMapTypes or interior resource runs past its first stream the same way.

iter_resources now joins the same files: it follows the carve's successors while the data is shorter than the row's size. Single carved files, folders without index.json and 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. New test_folder_joins_a_continuation_file_as_world_index_does: a carve folder as rpf9_carve writes it (<offset>.bin per stream plus index.json). The CMapTypes resource's last block runs 0x10 bytes into the next stream, and the map file is a separate stream. It asserts that scan_path joins the two (row size = whole resource) and that the CLI then reports the same summary as the RPF9-window test (2 archetypes, extents checked). On main it gets (maptypes, archetypes, names) = (1, 0, 0).
  • A 40-definition resource split the same way gives 0 archetypes from the folder and 40 from the equivalent RPF9 archive on main, and 40 from both with the fix (review repro).
  • python -m compileall; scripts/check_no_game_data.py on 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

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

**@⁠syfyra** on GitHub · 2026-11-26 16:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2382) `syfyra:fix/world-archetypes-folder-continuation` → `main` · +32 −1 · 2 files · 1 commits · draft Claimed in the coordination issue as: WORLD-ARCHETYPES-FOLDER-CONTINUATION (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why `tools/world_archetypes.py` reads 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_resources` takes the rows from `world_index.scan_path`, which joins a `0DRPz` resource whose blocks run past its stream with the carved file of the stream that followed it. It finds that file through rpf9_carve's `index.json` (`_carve_successors`, as `scan_rpf` does in an archive). The row then carries the joined length as `size` but only the first file as `file`. `iter_resources` re-read that first file alone, so every block stored in the continuation was lost without a warning: - archetype definitions; - the map entity blocks `--check-extents` compares. The same two streams inside an RPF9 window are joined by `WC.assemble` and read in full. `docs/world_census.md` counts 2,868 maps that join a continuation, and a large CMapTypes or interior resource runs past its first stream the same way. `iter_resources` now joins the same files: it follows the carve's successors while the data is shorter than the row's `size`. Single carved files, folders without `index.json` and 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. New `test_folder_joins_a_continuation_file_as_world_index_does`: a carve folder as rpf9_carve writes it (`<offset>.bin` per stream plus `index.json`). The CMapTypes resource's last block runs 0x10 bytes into the next stream, and the map file is a separate stream. It asserts that `scan_path` joins the two (row size = whole resource) and that the CLI then reports the same summary as the RPF9-window test (2 archetypes, extents checked). On `main` it gets `(maptypes, archetypes, names) = (1, 0, 0)`. - A 40-definition resource split the same way gives 0 archetypes from the folder and 40 from the equivalent RPF9 archive on `main`, and 40 from both with the fix (review repro). - `python -m compileall`; `scripts/check_no_game_data.py` on 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 - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On a folder of carved streams, world_index.scan_path joins a 0x7a
resource whose blocks run past its stream with the file of the stream
that followed it (rpf9_carve's index.json), and reports the joined
length as the row's size but only the first file as its "file".
iter_resources then re-read that first file alone, so every block in
the continuation was lost without a warning: archetype definitions and,
for --check-extents, map entity blocks. The same two streams in an RPF9
window are joined by WC.assemble and read in full. docs/world_census.md
counts 2,868 maps that join a continuation.

Join the same files in iter_resources: follow the carve's successors
while the data is shorter than the row's size.

Tested: new test_folder_joins_a_continuation_file_as_world_index_does
(on main the folder gives 0 archetypes instead of 2).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 16:46:49 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2382/head:github-bot/gh-2382'
git switch 'github-bot/gh-2382'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2382'
git switch 'github-bot/gh-2382'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2382'
git switch 'github-bot/gh-2382'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2382'
git switch 'main'
git merge --squash 'github-bot/gh-2382'
git switch 'main'
git merge --ff-only 'github-bot/gh-2382'
git switch 'main'
git merge 'github-bot/gh-2382'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.