Repository navigation
rpf9dump: reject an unknown mode before touching the source or output (BUILD-823) - #2890
tupacfan04 wants to merge 3 commits into
Conversation
|
Windows 11 validation with synthetic inputs. AI-assisted (Codex). Tested |
|
Added a docs commit to this PR: the usage block in AI-assisted, no game files. |
Kam471
left a comment
There was a problem hiding this comment.
Verified with a dotnet build and the new exit-code tests: dotnet build tools/rpf9dump/rpf9dump.csproj -c Release -> 0 warnings/0 errors; RPF9DUMP_DLL=<dll> python -I tests/test_rpf9dump_exit_codes.py -> 3/3 pass; test_ttpf_export_resume.py 3/3. On base 1 passes and 2 fail (unknown mode gives FileNotFoundException; usage omits audio). With an existing source, base exits 0 and creates <out>/<source>; head exits 2 and creates nothing. Synthetic inputs only; no game data or absolute paths. Approve.
Non-blocking: the new test uses a missing source, so the base failure is the wrong exception rather than the ok=0 path.
|
CI
The only non-zero is the pre-existing |
4547702 to
c49f5d9
Compare
|
Rebased onto current Re-checked at AI-assisted, no game files. |
An unknown first argument fell through every mode branch: it created <outdir>/<source>, printed ok=0 fail=0 skip=0 and exited 0, which make_game reads as a finished stage. Check the mode first, print one usage listing all five modes (audio and xma were missing) and exit 2.
The usage block showed 'rpf9dump models|textures', which is not a mode: the tool rejects it now that unknown modes fail, and it never ran as written. List the two commands.
c49f5d9 to
b6cf447
Compare
|
Rebased onto current
Re-checked at AI-assisted, no game files. |
|
Tested
This also covers a newer SDK than the author's .NET 8. AI-assisted (OpenCode). |
|
Head is now Both required checks ( |
Claimed in the coordination issue as: BUILD-823 (claim).
What and why
tools/rpf9dumpaccepted any first argument. An unknown mode fell through every branch: it resolved the paths,created
<outdir>/<source>, printedok=0 fail=0 skip=0and exited 0 — whichmake_game.pyreads as a finishedstage, so a typo silently did nothing and looked like success.
ttpf|audio|xma|models|texturesbeforePath.GetFullPathandDirectory.CreateDirectory, so a rejected mode touches neither the source nor the output folder.unknown mode '<mode>'on stderr and the usage on stdout, and exits 2 (the same code asthe existing too-few-arguments path).
Usage()function that lists all five modes; the old line was missingaudioandxma.No behaviour change for a known mode.
Tested
dotnet build tools/rpf9dump/rpf9dump.csproj -c Release: build succeeded, 0 warnings, 0 errors (.NET SDK8.0.428, Windows x64). No GPU and no game files are involved.
RPF9DUMP_DLL=tools/rpf9dump/bin/Release/net8.0/rpf9dump.dll python -I tests/test_rpf9dump_exit_codes.py -v:3 tests pass. The two new ones are
test_unknown_mode_exits_nonzero_before_the_source_or_output_is_touched(exit non-zero, message names the mode, no output folder, work folder unchanged) and
test_usage_lists_every_mode(no arguments: exit 2 and all five modes listed). The existing XMA-write-failure test still passes.
rpf9dump invalidmode <missing.rpf> <out>prints the message and usage, exits 2, and creates neither thesource nor
out.python -m compileall -q make_game.py tools tests.dotnet run --project tests/Rpf9DumpDiagnostics/Rpf9DumpDiagnostics.csproj -c Release: passes.AI-assisted: the change, tests and this description were written by an AI coding agent (Claude Code / an agent
running in OpenCode) and checked by the commands above.
Checklist
CONTRIBUTING.md), including in logs or reports quoted here.docs/design.md, with how it was confirmed. (Not atranslator change.)
Depends on: nothing.