tooling: require exactly one layout file in resource_inventory #638

Merged
louisdibiasi merged 2 commits from upstream-pr/644 into main 2026-11-22 18:46:59 +00:00
louisdibiasi commented 2026-11-22 17:16:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by louisdibiasi on 2026-11-22T17:16:33Z.


Change

tools/resource_inventory.py chose the layout with layout, = root.glob("layout*.xml"). A package with no layout file, two layout files, or a directory whose name matches the pattern ended in ValueError or PermissionError with a traceback. verify_build.py, which reads the same package, filters to regular files and reports expected exactly one ... found N through parser.error (exit 2). This uses the same filter and message.

Independent problem, no linked issue.

Verification

Commit under test: a6668be on b03f754, Windows 11, Python 3.12.10.

CLI on three synthetic packages, base vs this branch (python -B tools/resource_inventory.py <dir>):

Package Base This branch
no layout file ValueError: not enough values to unpack (expected 1, got 0), exit 1 expected exactly one layout*.xml file in <dir>, found 0, exit 2
layout_a.xml + layout_b.xml ValueError: too many values to unpack (expected 1), exit 1 ... found 2, exit 2
directory named layout_directory.xml only PermissionError: [Errno 13], exit 1 ... found 0, exit 2

New check_inventory_layout_selection in tests/layout_chunks_check.py runs the CLI on a directory-only package and on a two-file-plus-directory package and requires exit 2, the message and no traceback.

  • Base: PermissionError, exit 1.
  • This branch: layout chunk summary ok, exit 0.

Evidence and follow-up

Synthetic empty files only. The single-valid-layout path is not exercised by the new check; it is the unchanged behavior of the existing inventory run, which needs game files.

Checklist

  • One reviewable behavior.
  • Exact commands and results above.
  • Negative control: the new check fails on base.
  • No README/docs change needed.
  • No game files, dumps, links or secrets.

AI-assisted: I used Claude to find the bug and draft the change. I ran the reproductions and tests above myself.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6545330021 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/644). Originally posted by [louisdibiasi](https://github.com/louisdibiasi) on 2026-11-22T17:16:33Z. --- ## Change `tools/resource_inventory.py` chose the layout with `layout, = root.glob("layout*.xml")`. A package with no layout file, two layout files, or a directory whose name matches the pattern ended in `ValueError` or `PermissionError` with a traceback. `verify_build.py`, which reads the same package, filters to regular files and reports `expected exactly one ... found N` through `parser.error` (exit 2). This uses the same filter and message. Independent problem, no linked issue. ## Verification Commit under test: a6668be on b03f754, Windows 11, Python 3.12.10. CLI on three synthetic packages, base vs this branch (`python -B tools/resource_inventory.py <dir>`): | Package | Base | This branch | |---|---|---| | no layout file | `ValueError: not enough values to unpack (expected 1, got 0)`, exit 1 | `expected exactly one layout*.xml file in <dir>, found 0`, exit 2 | | `layout_a.xml` + `layout_b.xml` | `ValueError: too many values to unpack (expected 1)`, exit 1 | `... found 2`, exit 2 | | directory named `layout_directory.xml` only | `PermissionError: [Errno 13]`, exit 1 | `... found 0`, exit 2 | New `check_inventory_layout_selection` in `tests/layout_chunks_check.py` runs the CLI on a directory-only package and on a two-file-plus-directory package and requires exit 2, the message and no traceback. - Base: `PermissionError`, exit 1. - This branch: `layout chunk summary ok`, exit 0. ## Evidence and follow-up Synthetic empty files only. The single-valid-layout path is not exercised by the new check; it is the unchanged behavior of the existing inventory run, which needs game files. ## Checklist - [x] One reviewable behavior. - [x] Exact commands and results above. - [x] Negative control: the new check fails on base. - [x] No README/docs change needed. - [x] No game files, dumps, links or secrets. AI-assisted: I used Claude to find the bug and draft the change. I ran the reproductions and tests above myself.
upstream-sync closed this pull request 2026-11-24 06:44:07 +00:00
legacy-code-archaeologist commented 2026-11-24 06:48:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-22T17:35:31Z.


Coordination note: this PR and #643 both edit tests/layout_chunks_check.py. I checked 534f673 (#643) and a6668be (#644) on Windows 11 26100.9168 with Python 3.12.10:

  • Each one merges cleanly with main at 8f57366.
  • They also merge cleanly with each other.
  • With both applied, python -B tests/layout_chunks_check.py prints layout chunk summary ok.

They can land in either order.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7082955074 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/644#issuecomment-7082955074). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-22T17:35:31Z. --- Coordination note: this PR and #643 both edit `tests/layout_chunks_check.py`. I checked `534f673` (#643) and `a6668be` (#644) on Windows 11 26100.9168 with Python 3.12.10: - Each one merges cleanly with `main` at `8f57366`. - They also merge cleanly with each other. - With both applied, `python -B tests/layout_chunks_check.py` prints `layout chunk summary ok`. They can land in either order. AI-assisted (Claude Code).
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
R0Y00/Xbox2Windows!638
No description provided.