Reduce rpf9-explorer workspace validation allocations (RPF9-WORKSPACE-VALIDATION) #3207

Open
FlipkPL wants to merge 1 commit from upstream-pr/3207 into main
FlipkPL commented 2026-12-02 19:17:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by FlipkPL on 2026-12-02T19:17:34Z.


Claimed in the coordination issue as: RPF9-WORKSPACE-VALIDATION

What and why

Advance third_party/rpf9-explorer from cab9bb6 to 2957dd4. The update checks DDS layout from the header and file length, validates UTF-8 incrementally, and reuses SHA-256 read buffers. Full checksums and existing format checks are retained.

In local synthetic runs, managed allocations dropped from 32.1 MiB to 12.6 KiB for a 32 MiB DDS and from 71.0 MiB to 8.5 MiB when opening a project with 1,000 entries. The pinned commit is retained on the contributor branch. A fresh recursive shallow checkout fetched it through the canonical submodule URL. Module diff

Tested

  • dotnet build tools/rpf9dump/rpf9dump.csproj -c Release from a fresh recursive checkout on Windows, with zero warnings.
  • dotnet run --project third_party/rpf9-explorer/Tools/WorkspaceValidationTests -c Release. The allocation test failed on the original pin and passed on the new pin. Generated fixtures checked decoded DDS pixels, strict UTF-8, bounds, and detection of a changed asset.
  • Clean-room and whitespace checks passed. Test inputs were generated locally without game files.

GPUs tested: n/a (CPU-only validation).

AI-assisted: yes (GPT-6, independent review by GPT-6.2 Sol).

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys, or decryption.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5613094440 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3207). Originally posted by [FlipkPL](https://github.com/FlipkPL) on 2026-12-02T19:17:34Z. --- Claimed in the coordination issue as: [RPF9-WORKSPACE-VALIDATION](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7355488575) ### What and why Advance `third_party/rpf9-explorer` from `cab9bb6` to `2957dd4`. The update checks DDS layout from the header and file length, validates UTF-8 incrementally, and reuses SHA-256 read buffers. Full checksums and existing format checks are retained. In local synthetic runs, managed allocations dropped from 32.1 MiB to 12.6 KiB for a 32 MiB DDS and from 71.0 MiB to 8.5 MiB when opening a project with 1,000 entries. The pinned commit is retained on the [contributor branch](https://github.com/FlipkPL/rpf9-explorer/tree/codex/rpf9-workspace-validation). A fresh recursive shallow checkout fetched it through the canonical submodule URL. [Module diff](https://github.com/FlipkPL/rpf9-explorer/compare/cab9bb6...codex/rpf9-workspace-validation) ### Tested - `dotnet build tools/rpf9dump/rpf9dump.csproj -c Release` from a fresh recursive checkout on Windows, with zero warnings. - `dotnet run --project third_party/rpf9-explorer/Tools/WorkspaceValidationTests -c Release`. The allocation test failed on the original pin and passed on the new pin. Generated fixtures checked decoded DDS pixels, strict UTF-8, bounds, and detection of a changed asset. - Clean-room and whitespace checks passed. Test inputs were generated locally without game files. GPUs tested: n/a (CPU-only validation). AI-assisted: yes (GPT-6, independent review by GPT-6.2 Sol). ### Checklist - [x] Based on current `main`. - [x] One topic. - [x] No game data, keys, or decryption.
merzleckeier commented 2026-12-02 19:26:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T19:26:14Z.


Independent check on e626f5de9 / submodule 2957dd44. A new empty Git repository fetched the pin directly by SHA from the canonical URL in .gitmodules. The contributor branch linked in the PR also points to that exact commit.

On Linux x64 with .NET SDK 8.0.428, I ran the new WorkspaceValidationTests against the previous pin and against the proposed pin. The previous pin reached the allocation assertions and failed. On the new pin the complete suite passed, including the DDS pixel check, UTF-8 across read boundaries, and changed-asset checks. In that run, the synthetic DDS fixture’s AssetPath allocation went from 8,530,160 B to 9,696 B. Mandy’s rpf9dump also restored from the existing lock file and built in Release with zero warnings and errors. Synthetic inputs only.

AI-assisted: OpenAI Codex (GPT-6).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7356171445 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3207#issuecomment-7356171445). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T19:26:14Z. --- Independent check on `e626f5de9` / submodule `2957dd44`. A new empty Git repository fetched the pin directly by SHA from the canonical URL in `.gitmodules`. The contributor branch linked in the PR also points to that exact commit. On Linux x64 with .NET SDK 8.0.428, I ran the new `WorkspaceValidationTests` against the previous pin and against the proposed pin. The previous pin reached the allocation assertions and failed. On the new pin the complete suite passed, including the DDS pixel check, UTF-8 across read boundaries, and changed-asset checks. In that run, the synthetic DDS fixture’s `AssetPath` allocation went from 8,530,160 B to 9,696 B. Mandy’s `rpf9dump` also restored from the existing lock file and built in Release with zero warnings and errors. Synthetic inputs only. AI-assisted: OpenAI Codex (GPT-6).
fiestorra commented 2026-12-02 20:33:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T20:33:57Z.


VERIFY-3207 — el puntero y su contenido, con el test del propio bump ejecutado aquí

Merge base b41763227 = current main
Old pointer cab9bb6e
New pointer 2957dd44 (present in the submodule clone: git cat-file -t → commit; parent clean)

What the bump brings (git log cab9bb6e..2957dd44):

2957dd4  Bound memory used by workspace asset validation
6abc4f8  Normalize line endings in ReplacementWorkspace

The first is the substance: pooled reads for SHA-256, DDS layouts inspected from headers instead of decoding the texture, incremental UTF-8 validation — plus a new Tools/WorkspaceValidationTests console project. The second is a pure line-ending commit that rewrites 965 lines of ReplacementWorkspace.cs; it makes the bump look enormous in a --stat and hides the 232-line real change. Worth folding into the same commit upstream (or dropping) so the next reviewer does not have to -w it.

Ran here (dotnet 10.0.404, the new submodule commit checked out)

dotnet run --project Tools/WorkspaceValidationTests -c Release
  AssetPath managed allocation: DDS 8.256 B, UTF-8 73.768 B, binary 8.096 B
  Workspace validation passed.        exit 0

Those numbers are the claim: per asset path, 8 KiB for a 2048x1024 DDS, 74 KiB for a UTF-8 file, 8 KiB for a binary one — the memory is bounded, not proportional to the asset the way the old reader was.

What I could not test

  • The old side of the measurement: the test project is added by the same commit, so running it on cab9bb6e is impossible without writing one; the "before" numbers in the upstream commit message are the author's.
  • The application itself: this bump touches Core/ and adds a console test; I did not launch RpfPreview.

Verdict: the pointer is valid, the change is real and its own allocation test passes on this machine; the line-ending commit is the one thing I would send back.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7357942836 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3207#issuecomment-7357942836). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T20:33:57Z. --- ## VERIFY-3207 — el puntero y su contenido, con el test del propio bump ejecutado aquí | | | |---|---| | Merge base | `b41763227` = current `main` | | Old pointer | `cab9bb6e` | | New pointer | `2957dd44` (present in the submodule clone: `git cat-file -t` → commit; parent clean) | **What the bump brings** (`git log cab9bb6e..2957dd44`): ``` 2957dd4 Bound memory used by workspace asset validation 6abc4f8 Normalize line endings in ReplacementWorkspace ``` The first is the substance: pooled reads for SHA-256, DDS layouts inspected from headers instead of decoding the texture, incremental UTF-8 validation — plus a new `Tools/WorkspaceValidationTests` console project. **The second is a pure line-ending commit** that rewrites 965 lines of `ReplacementWorkspace.cs`; it makes the bump look enormous in a `--stat` and hides the 232-line real change. Worth folding into the same commit upstream (or dropping) so the next reviewer does not have to `-w` it. **Ran here (dotnet 10.0.404, the new submodule commit checked out)** ``` dotnet run --project Tools/WorkspaceValidationTests -c Release AssetPath managed allocation: DDS 8.256 B, UTF-8 73.768 B, binary 8.096 B Workspace validation passed. exit 0 ``` **Those numbers are the claim**: per asset path, 8 KiB for a 2048x1024 DDS, 74 KiB for a UTF-8 file, 8 KiB for a binary one — the memory is bounded, not proportional to the asset the way the old reader was. ## What I could not test - **The old side of the measurement**: the test project is added by the same commit, so running it on `cab9bb6e` is impossible without writing one; the "before" numbers in the upstream commit message are the author's. - **The application itself**: this bump touches `Core/` and adds a console test; I did not launch RpfPreview. Verdict: **the pointer is valid, the change is real and its own allocation test passes on this machine**; the line-ending commit is the one thing I would send back. Written with an AI assistant.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3207:upstream-pr/3207'
git switch 'upstream-pr/3207'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3207'
git switch 'upstream-pr/3207'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3207'
git switch 'upstream-pr/3207'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3207'
git switch 'main'
git merge --squash 'upstream-pr/3207'
git switch 'main'
git merge --ff-only 'upstream-pr/3207'
git switch 'main'
git merge 'upstream-pr/3207'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!3207
No description provided.