Skip to content

ttpf_mips: scan searches any pool folder and rejects a path with no pool - #1458

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
rafaelpssz:fix/ttpf-scan-paths
Nov 22, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
rafaelpssz:fix/ttpf-scan-paths

Conversation

@rafaelpssz

Copy link
Copy Markdown
Contributor

BUILD-261.

What and why

scan only looked for pools under <path>/data/ttdb and <path>/pack/*/data/ttdb. Pointing it at data/ttdb itself, one of its folders or pack/ found nothing. A mistyped path did the same: an all-zero summary and exit 0.

A folder that holds no pool at those game-root places is now searched recursively for .ttpf. A path that still yields no pool gives an ERROR line naming it (no such file or folder / no .ttpf pool in it) and exit code 2. This is a different problem from #1410, which stops a report path from overwriting an input; the two touch different lines.

Proof

  • Real data, pools found, main -> this PR:
    • game root: 57 -> 57 (same list)
    • pack/story000: 3 -> 3 (same list)
    • data/ttdb: 0 -> 46
    • data/ttdb/peds: 0 -> 9
    • pack: 0 -> 11
    • A mistyped dat/ttdb now exits 2 instead of 0.
  • Test: test_scan_finds_pools_below_any_folder_and_rejects_paths_without_one (on main: 0 pools for data/ttdb). tests/test_ttpf_mips.py: 50 passed.

Windows 11 Pro 26200, Python 3.14, CPU only (no GPU path involved). No game data in the PR; real-data numbers are counts from my own 1.0.2.1 copy.

By @rafaelpssz, with Claude Code (AI-assisted).

@bobcatchris

Copy link
Copy Markdown
Contributor

Independent CPU verification, at head 6b282302 against main bb2e1842 (Windows, Python 3.12):

  • tests/test_ttpf_mips.py: 50 passed.
  • Negative control with tools/ttpf_mips.py reverted to main: 1 failed, 49 passed (test_scan_finds_pools_below_any_folder_and_rejects_paths_without_one).

@rafaelpssz

Copy link
Copy Markdown
Contributor Author

Pushed a small follow-up commit (207977f4). find_pools now runs the folder through glob.escape before adding the data/ttdb/** patterns. Without it, a game folder named like Game [v1] matched nothing, and this PR's new error would have said "no .ttpf pool in it" for a folder that has pools. The test now builds its folder as game [v1] and fails without the escape. Real-data pool counts are unchanged: 57 / 46 / 9 / 3 / 11.

@UlteriorMotive00

Copy link
Copy Markdown
Contributor

Tested 6b28230 (0 behind main) on Windows 11 Home 10.0.26300 (ANSI code page 1252), Python 3.14.7, pytest 9.2.0.

test file this PR with main's tools/ttpf_mips.py
test_ttpf_mips.py 50 passed, 48 subtests 1 failed, 49 passed

The new test fails without the change, so it covers it.

AI-assisted (Claude Code). Synthetic test inputs only, no game files.

rafaelpssz and others added 2 commits November 22, 2026 09:15
`scan` only looked for pools under <path>/data/ttdb and <path>/pack/*/data/ttdb, so pointing it at
data/ttdb itself, one of its folders or pack/ found nothing, and a mistyped path did the same: it
printed an all-zero summary and exited 0. A folder that holds no pool at those game-root places is
now searched recursively for .ttpf, and a path that still yields no pool is an ERROR line naming
it (no such file or folder / no .ttpf pool in it) with exit code 2.

Real data (counts only), pools found on my 1.0.2.1 copy, main -> this change: game root 57 -> 57
(same list), pack/story000 3 -> 3 (same list), data/ttdb 0 -> 46, data/ttdb/peds 0 -> 9,
pack 0 -> 11; a mistyped dat/ttdb now exits 2 instead of 0.

Tests: test_scan_finds_pools_below_any_folder_and_rejects_paths_without_one (main: 0 pools for
data/ttdb).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A folder name with glob characters, like "Game [v1]", was used as a glob pattern, so no pool
matched and the new "no .ttpf pool in it" error would name a folder that does hold pools. The
folder is now passed through glob.escape; only the parts below it are patterns.

Test: test_scan_finds_pools_below_any_folder_and_rejects_paths_without_one now builds its game
folder as "game [v1]" (without the escape: 0 pools).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rafaelpssz

Copy link
Copy Markdown
Contributor Author

Rebased onto main 99f9989 after #1410 (e8562e3), which added the --json overwrite guard in the same scan block. Both stay: each path must yield a pool, then --json is checked against every pool found. tests/test_ttpf_mips.py: all pass. Thanks @bobcatchris and @UlteriorMotive00 for the runs.

@ItsNotRexed
ItsNotRexed merged commit 2dbd217 into ItsNotRexed:main Nov 22, 2026
8 of 10 checks passed
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.

4 participants