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

Open
opened 2026-11-26 21:21:03 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2382
Author: @syfyra
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fix/world-archetypes-folder-continuation


📝 Commits (1)

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

📊 Changes

2 files changed (+32 additions, -1 deletions)

View changed files

📝 tests/test_world_archetypes.py (+18 -0)
📝 tools/world_archetypes.py (+14 -1)

📄 Description

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.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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2382 **Author:** [@syfyra](https://github.com/syfyra) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/world-archetypes-folder-continuation` --- ### 📝 Commits (1) - [`e801a13`](https://github.com/ubiquitarianism/leonida/commit/e801a13a2e7f85d3a63c900de3b870545698db2e) world_archetypes: read a carved resource's continuation file too (WORLD-ARCHETYPES-FOLDER-CONTINUATION) ### 📊 Changes **2 files changed** (+32 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_world_archetypes.py` (+18 -0) 📝 `tools/world_archetypes.py` (+14 -1) </details> ### 📄 Description 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.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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2384
No description provided.