cli: reject --jobs 0 in translate command #297

Open
Caasares wants to merge 1 commit from upstream-pr/297 into main
Caasares commented 2026-11-24 23:21:19 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Caasares on 2026-11-24T23:21:19Z.


Fixes #249

Summary

  • Parse victory translate --jobs as Option<std::num::NonZeroUsize> in apps/victory/src/main.rs and apps/victory/src/translate.rs, so --jobs 0 is rejected at CLI argument parsing before scanning any files and translate::run enforces a non-zero worker count at the API boundary.
  • Extract run_paths / print_summary in apps/victory/src/translate.rs so translation execution can be verified directly against synthetic DXBC fixtures without game files.
  • Add unit tests covering:
    • victory translate --jobs 0 returning a clap ValueValidation error and --jobs 1 parsing cleanly (apps/victory/src/main.rs).
    • translate::run / run_paths with --jobs 1 processing a synthetic DXBC container (apps/victory/src/translate.rs).

Verification

All checks run inside wt-vf-249 after the final edit (zero game files used; synthetic DXBC fixture built in test memory):

  • cargo clippy --workspace --all-targets --locked -- -D warnings: passed (0 warnings)
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed (0 warnings)
  • cargo test --workspace --locked: passed across all workspace test suites (499 passed, 0 failed, 7 pre-existing ignored across victory-formats, victory-gpu, and victory-shader; includes victory 4 passed and xtask asset-policy checks 4 passed)
  • cargo fmt --all -- --check: reports pre-existing formatting differences in untouched code across the workspace; all lines added/modified in this PR conform to rustfmt.toml.

Note: AI-assisted fix; contains no game files or assets.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6593416991 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/297). Originally posted by [Caasares](https://github.com/Caasares) on 2026-11-24T23:21:19Z. --- Fixes #249 ## Summary - Parse `victory translate --jobs` as `Option<std::num::NonZeroUsize>` in `apps/victory/src/main.rs` and `apps/victory/src/translate.rs`, so `--jobs 0` is rejected at CLI argument parsing before scanning any files and `translate::run` enforces a non-zero worker count at the API boundary. - Extract `run_paths` / `print_summary` in `apps/victory/src/translate.rs` so translation execution can be verified directly against synthetic DXBC fixtures without game files. - Add unit tests covering: - `victory translate --jobs 0` returning a `clap` `ValueValidation` error and `--jobs 1` parsing cleanly (`apps/victory/src/main.rs`). - `translate::run` / `run_paths` with `--jobs 1` processing a synthetic DXBC container (`apps/victory/src/translate.rs`). ## Verification All checks run inside `wt-vf-249` after the final edit (zero game files used; synthetic DXBC fixture built in test memory): - `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed (0 warnings) - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passed (0 warnings) - `cargo test --workspace --locked`: passed across all workspace test suites (499 passed, 0 failed, 7 pre-existing ignored across `victory-formats`, `victory-gpu`, and `victory-shader`; includes `victory` 4 passed and `xtask` asset-policy checks 4 passed) - `cargo fmt --all -- --check`: reports pre-existing formatting differences in untouched code across the workspace; all lines added/modified in this PR conform to `rustfmt.toml`. *Note: AI-assisted fix; contains no game files or assets.*
kaayzouee commented 2026-11-25 01:12:07 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by kaayzouee on 2026-11-25T01:05:40Z.


Duplicate of #290?

<!-- greyfinch-sync:fxceless/victory-fork:comment:7149198847 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/297#issuecomment-7149198847). Originally posted by [kaayzouee](https://github.com/kaayzouee) on 2026-11-25T01:05:40Z. --- Duplicate of #290?
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/297:upstream-pr/297'
git switch 'upstream-pr/297'

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/297'
git switch 'upstream-pr/297'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/297'
git switch 'upstream-pr/297'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/297'
git switch 'main'
git merge --squash 'upstream-pr/297'
git switch 'main'
git merge --ff-only 'upstream-pr/297'
git switch 'main'
git merge 'upstream-pr/297'
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
fxceless/victory-fork!297
No description provided.