Skip to content

ASSET-411: Resolve authored ped outfit kits by ID - #5089

Open
dimaszoo wants to merge 8 commits into
ItsNotRexed:mainfrom
dimaszoo:feat/ped-catalogue-kits
Open

dimaszoo wants to merge 8 commits into
ItsNotRexed:mainfrom
dimaszoo:feat/ped-catalogue-kits

Conversation

@dimaszoo

@dimaszoo dimaszoo commented Nov 23, 2026 •

Copy link
Copy Markdown

Depends on: #4187

ASSET-411 coordination claim · Review the three files changed on top of #4187

python -I tools/ped_catalogues.py kit <catalogue> --id <ID> --json reports the presets and states selected by one outfit in a standalone 0DRP or PSIN catalogue. It follows both root kit buckets, expands nested kits in authored order and emits each selected (preset_id, state_id) once. It resolves the drawable, albedo, normal and extra hashes independently from the nearest preset defining that field for the selected state.

Cycles and missing references produce warnings. Ambiguous definitions and invalid array bounds produce an error. The existing inspect, census and resolve commands retain their behavior. The upstream comparison currently includes #4187 because its code is still under review.

Verification

  • python3 -I tests/test_ped_catalogues.py passed all 15 tests, including synthetic 0DRP and PSIN fixtures. The cases cover nested order, repeated members, two states of one preset, per-field inheritance, missing references, cycles and invalid array bounds.
  • Also ran the tool-startup tests, documentation checks and LF-output checks. The published branch reproduces the locally tested source tree exactly.
  • Independently compared the decoded membership and resolved fields against a second reader on a complete local data section. End-to-end CLI coverage uses complete synthetic containers for both formats.

AI-assisted implementation and validation. CPU-only Python tests on Linux. GPU and driver are inapplicable to this parser.

Pre-merge verification

Kit resolution now reports inheritance cycles for the selected members. A separate preset cycle or a depth limit reached by the catalogue statistics pass previously blocked an unrelated, fully resolved kit. Both 0DRP and PSIN regressions pass. Selected cycles and structural warnings still surface, and the catalogue-wide reports keep their existing diagnostics.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at 739b66fa3 on Windows 11: pytest tests/test_ped_catalogues.py -q -> 15 passed, 13 subtests passed; git diff --check clean.

The new tools/ped_catalogues.py decodes authored ped outfit kits by ID (kit layout, selection semantics, the per-slot pieces) and docs/ped_catalogues.md records the field names and counts; the 961-line test suite covers the synthetic kit tables, the catalogue joins and the malformed rows. I cannot re-read the export here, so the game-side counts are as reported; the tool's synthetic cases pass. No blocking issue.

@Atomic258

Copy link
Copy Markdown
Contributor

Independent check — pass (CPU only, synthetic catalogues, no game files).

Environment: Windows 11, CPython 3.15.2.

  • python -I tests/test_ped_catalogues.py → 15/15 on the PR head
  • No parent A/B: tools/ped_catalogues.py is new in this PR, so the test is the coverage
  • docs/ped_catalogues.md added alongside, matching the tool's described behavior

AI-assisted (Devin).

@whattheflop

Copy link
Copy Markdown
Contributor

Independent Windows consumer check at 739b66fa on #4187 c46e7148, using uv CPython 3.12.13 and valid synthetic catalogues. AI-assisted.

Eight kit CLI runs across plain and zlib-wrapped 0DRP and PSIN preserved the expected depth-first order from two roots with shared dependencies. Repeated preset/state tuples appeared once, distinct states survived, and each field inherited the nearest nonzero ID for its state. Six inspect/census/resolve control comparisons matched the base byte for byte.

For later manifest joins, the 16-digit lowercase hashes retained leading zeroes and matched uppercase Id64 and AssetKey after hex case normalization. The kit JSON was byte-identical whether the matching synthetic OBJ/DDS existed or not. It would help to mention in the output contract that consumers normalize the hex keys and separately check whether the corresponding exports exist.

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Reviewed 7f36e0b (CPU, Linux, Python 3.13): no defects found

@kapitche

Copy link
Copy Markdown
Contributor

Tested 7f36e0b merged with main 561b65a on Linux (WSL2) Python 3.12.16: pass

tests/test_ped_catalogues.py: 17 run, 17 passed, 0 failed. Other test files importing ped_catalogues: none besides this one; tests/test_docs_*.py (11 files): all OK.
Negative control: with tools/ped_catalogues.py restored to main, the same file runs 17 and fails 4 with 11 errors (the new kit tests need resolve_kit/the kit command).
CLI smoke on the merged tree: kit on a missing file and on a non-catalogue file each print one ERROR: <path>: ... line and exit 2; --id 0x100000000 is refused by argparse (exit 2). The tests use synthetic catalogues only, so the kit/member field layout (0xa9d57751 at +0x00 and +0x38, 0x67e54cb2 members) is not checked against game data here; I did not run it on the package.

@ne1i

ne1i commented Nov 23, 2026

Copy link
Copy Markdown

Tested 7f36e0b2 on Linux, CPython 3.14, CPU only, synthetic inputs, merged onto main c8eaaf76: pass

  • python -I tests/test_ped_catalogues.py: Ran 17 tests, OK. With only the non-test files reverted to main: FAILED (failures=4, errors=11).
  • compileall and scripts/check_no_game_data.py on the changed files: clean.

Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting; claimed in #8047.

@isfcrctfs isfcrctfs left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the three files on top of #4187 (c46e7148..7f36e0b2): python3.12 -I tests/test_ped_catalogues.py 17/17, and the test_docs_* files present at this head (7) OK. Negative control: with only tools/ped_catalogues.py reverted to c46e7148, four tests fail and eleven error (argument command: invalid choice: 'kit'), so the new tests are pinned to the command.

The kit path is correct as far as I can check it. _typed_array_window's header read stays in bounds for all three callers, because each array span is validated against the block it points into before the rows are used; count == 0 returns an empty span and decode_ptr(0) is only reached for empty arrays, so an empty kit is () rather than an error. DFS order, first-visit dedupe of (preset_id, state_id), nested-kit cycle handling, the nearest-nonzero merge across the parent chain, and the errors for duplicate kit/preset/state and kit-vs-preset overlap all match docs/ped_catalogues.md, and rooted mode leaves the inspect/census warnings and state counts unchanged (the state-array test asserts both sides of that split).

Two nits: build_kit_blocks hardcodes the two kit/member structure hashes instead of pc.KIT_STRUCT_HASH/pc.KIT_MEMBER_STRUCT_HASH, so the fixture will not follow a rename; and the "Resolve one outfit kit" doc page does not say that a kit's member array and the selected preset's state array must be complete (count within capacity, inside the block), which kit makes fatal while inspect only warns - the tests record that difference, the page does not.

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants