Validate VICTORY_PAIRS before translating shaders #1244

Open
DoubleD17 wants to merge 1 commit from upstream-pr/1244 into main
DoubleD17 commented 2026-11-24 16:45:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DoubleD17 on 2026-11-24T16:45:42Z.


The victory translate command silently dropped VICTORY_PAIRS entries that lacked a + separator. It also accepted empty selectors, which matched any shader label.

Validate the comma-separated list before initializing the validator or GPU. Each entry requires two non-empty selectors, and errors identify the invalid entry by position and value. An unset or empty variable still disables pairing. Valid selectors keep their substring matching.

On Windows x64, independent QA built the base and candidate and ran cargo test --locked --offline -p victory (3 passed). With a synthetic input, seven malformed settings exited with code 1 even with --validate --pipelines. An unset or empty variable produced the same output as the base. Parser tests also covered valid pairs, whitespace, and a literal + in the second selector. Pipeline creation was outside the scope of these tests.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5476445530 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1244). Originally posted by [DoubleD17](https://github.com/DoubleD17) on 2026-11-24T16:45:42Z. --- The `victory translate` command silently dropped `VICTORY_PAIRS` entries that lacked a `+` separator. It also accepted empty selectors, which matched any shader label. Validate the comma-separated list before initializing the validator or GPU. Each entry requires two non-empty selectors, and errors identify the invalid entry by position and value. An unset or empty variable still disables pairing. Valid selectors keep their substring matching. On Windows x64, independent QA built the base and candidate and ran `cargo test --locked --offline -p victory` (3 passed). With a synthetic input, seven malformed settings exited with code 1 even with `--validate --pipelines`. An unset or empty variable produced the same output as the base. Parser tests also covered valid pairs, whitespace, and a literal `+` in the second selector. Pipeline creation was outside the scope of these tests. AI-assisted.
Zipettte commented 2026-11-24 18:06:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T17:59:31Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 7c27219: cargo test -p victory passes, 3 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139998460 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1244#issuecomment-7139998460). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T17:59:31Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 7c27219: `cargo test -p victory` passes, 3 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Marvisak commented 2026-11-25 02:05:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:19:49Z.


Automated triage for the maintainers.

Merge candidate. parse_pairs in apps/victory/src/translate.rs validates VICTORY_PAIRS before any validator or GPU set-up, and refuses an entry without + or with an empty side. Errors name the position and the text. On main, vs+ became ("vs", ""), and the find closure's l.contains("") then matched the first kept shader, so the pipeline check silently paired the wrong shader. That is the real bug fixed here. An unset or empty variable still means no pairs, and the tests cover valid, whitespace and malformed inputs. Note that a trailing comma (vs+ps,) is now an error too, which is stricter than the skip-malformed convention of the run-time knobs but fine for an offline command. It merges cleanly with main. It overlaps with #673 and #1114 in the test module of the same file, so whichever lands second needs a small rebase.

CI: passing (check).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149436398 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1244#issuecomment-7149436398). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:19:49Z. --- <!-- victory-triage v1 head=fd9659debb77e23b6b3e14a225a2ab95d804d8f6 verdict=merge-candidate at=2026-11-25T06:28:30Z --> Automated triage for the maintainers. **Merge candidate.** `parse_pairs` in `apps/victory/src/translate.rs` validates `VICTORY_PAIRS` before any validator or GPU set-up, and refuses an entry without `+` or with an empty side. Errors name the position and the text. On `main`, `vs+` became `("vs", "")`, and the `find` closure's `l.contains("")` then matched the first kept shader, so the pipeline check silently paired the wrong shader. That is the real bug fixed here. An unset or empty variable still means no pairs, and the tests cover valid, whitespace and malformed inputs. Note that a trailing comma (`vs+ps,`) is now an error too, which is stricter than the skip-malformed convention of the run-time knobs but fine for an offline command. It merges cleanly with `main`. It overlaps with #673 and #1114 in the test module of the same file, so whichever lands second needs a small rebase. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-26 02:06:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:19:36Z.


Code review and Windows 11 verification at head fd9659debb77 merged cleanly onto main (63bcca43c6a0):

  • Code review (apps/victory/src/translate.rs:155-192):
    • Validates VICTORY_PAIRS upfront before scanning packs or loading dxil.dll: unset (NotPresent) and "" keep default behavior untouched; invalid UTF-8 (NotUnicode), missing +, empty/whitespace selectors, and trailing/consecutive commas fail immediately with a clear 1-based entry index and value; multi-+ entries split on the first +.
  • Verified (Windows 11, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory --tests -- -D warnings: 0 warnings
    • cargo test --locked -p victory: 20/20 passed (16 unit including both new VICTORY_PAIRS parser tests + 4 integration).

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179661500 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1244#issuecomment-7179661500). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T01:19:36Z. --- Code review and Windows 11 verification at head `fd9659debb77` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`apps/victory/src/translate.rs:155-192`)**: - Validates `VICTORY_PAIRS` upfront before scanning packs or loading `dxil.dll`: unset (`NotPresent`) and `""` keep default behavior untouched; invalid UTF-8 (`NotUnicode`), missing `+`, empty/whitespace selectors, and trailing/consecutive commas fail immediately with a clear 1-based entry index and value; multi-`+` entries split on the first `+`. - **Verified (Windows 11, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy --locked -p victory --tests -- -D warnings`: 0 warnings - `cargo test --locked -p victory`: **20/20 passed** (16 unit including both new `VICTORY_PAIRS` parser tests + 4 integration). LGTM.
cloph-dsp commented 2026-11-26 22:58:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-26T22:58:20Z.


Independent local verification (Windows, Rust 1.100.0/MSVC, cargo test --locked, CARGO_BUILD_JOBS=2, per-worktree CARGO_TARGET_DIR):

  • cargo test --locked -p victory --bin victory -- --exact translate::tests::parses_shader_pairs -> 1 passed, 0 failed, 11 filtered.
  • cargo test --locked -p victory --bin victory -- --exact translate::tests::rejects_invalid_shader_pairs -> 1 passed, 0 failed, 11 filtered.
  • git diff --check fd9659d~1 fd9659d -> clean (against PR merge base; checking against current origin/main hits an unrelated EOF blank line in crates/victory-formats/src/xma/tables.rs).
  • Negative control: both new test names are absent from origin/main (git grep exit 1).

No game data or DRM involved; synthetic VICTORY_PAIRS strings only. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only CLI parser tests).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7205143189 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1244#issuecomment-7205143189). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-26T22:58:20Z. --- Independent local verification (Windows, Rust 1.100.0/MSVC, `cargo test --locked`, `CARGO_BUILD_JOBS=2`, per-worktree `CARGO_TARGET_DIR`): - `cargo test --locked -p victory --bin victory -- --exact translate::tests::parses_shader_pairs` -> 1 passed, 0 failed, 11 filtered. - `cargo test --locked -p victory --bin victory -- --exact translate::tests::rejects_invalid_shader_pairs` -> 1 passed, 0 failed, 11 filtered. - `git diff --check fd9659d~1 fd9659d` -> clean (against PR merge base; checking against current `origin/main` hits an unrelated EOF blank line in `crates/victory-formats/src/xma/tables.rs`). - Negative control: both new test names are absent from `origin/main` (`git grep` exit 1). No game data or DRM involved; synthetic `VICTORY_PAIRS` strings only. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only CLI parser tests).
fuzeofficlal commented 2026-11-26 23:26:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T23:26:03Z.

Review: APPROVED


LGTM! Verified locally with rustfmt --edition 2024 --check apps/victory/src/translate.rs, cargo xtask policy, cargo clippy --locked -p victory --all-targets -- -D warnings, cargo clippy --locked -p victory --all-features -- -D warnings, and cargo test --locked -p victory translate:: (3/3 passed).

parse_pairs (apps/victory/src/translate.rs:155-175, 188-192) validates VICTORY_PAIRS up front with clear 1-based entry diagnostics while preserving unset/"" disabling, whitespace trimming, and selectors containing + on the right-hand side. (Minor note: trailing commas such as vs+ps, are now rejected up front rather than skipped, matching the new unit test expectations.)

<!-- greyfinch-sync:Marvisak/VIctory:review:6081447888 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1244#pullrequestreview-6081447888). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T23:26:03Z. **Review:** APPROVED --- LGTM! Verified locally with `rustfmt --edition 2024 --check apps/victory/src/translate.rs`, `cargo xtask policy`, `cargo clippy --locked -p victory --all-targets -- -D warnings`, `cargo clippy --locked -p victory --all-features -- -D warnings`, and `cargo test --locked -p victory translate::` (3/3 passed). `parse_pairs` (`apps/victory/src/translate.rs:155-175, 188-192`) validates `VICTORY_PAIRS` up front with clear 1-based entry diagnostics while preserving unset/`""` disabling, whitespace trimming, and selectors containing `+` on the right-hand side. *(Minor note: trailing commas such as `vs+ps,` are now rejected up front rather than skipped, matching the new unit test expectations.)*
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/1244:upstream-pr/1244'
git switch 'upstream-pr/1244'

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/1244'
git switch 'upstream-pr/1244'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1244'
git switch 'upstream-pr/1244'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1244'
git switch 'main'
git merge --squash 'upstream-pr/1244'
git switch 'main'
git merge --ff-only 'upstream-pr/1244'
git switch 'main'
git merge 'upstream-pr/1244'
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
Marvisak/VIctory!1244
No description provided.