Make translate failure examples stable across workers #673

Open
timorjay wants to merge 1 commit from upstream-pr/673 into main
timorjay commented 2026-11-24 06:35:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by timorjay on 2026-11-24T06:35:30Z.


Running victory translate on the same input sometimes picks a different example for the same failure. Each worker kept the first label it saw, and the first worker to merge got to choose the example for the report. That makes otherwise identical reports harder to compare across machines.

The tally now keeps the lexicographically smallest label among the failures it records for each reason. The same rule applies within a worker and when merging workers. The regression test covers both merge orders, with and without --list.

On Windows 11 I used one synthetic file containing 256 empty, 32-byte DXBC containers. At d2a4bae, 32 identical runs with --jobs 4 reported nine different example offsets. With this change, 32 runs each at 1, 4 and 12 workers all reported 256 failures and @0x0. Reversing two input file arguments with --list also preserved both detail lines and the same example.

cargo test --locked --workspace --no-fail-fast completed with 265 passed, 0 failed and 4 ignored. No game data was needed for these tests. OpenAI Codex (GPT-6) assisted with the patch, reproduction and report.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6576138454 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/673). Originally posted by [timorjay](https://github.com/timorjay) on 2026-11-24T06:35:30Z. --- Running `victory translate` on the same input sometimes picks a different example for the same failure. Each worker kept the first label it saw, and the first worker to merge got to choose the example for the report. That makes otherwise identical reports harder to compare across machines. The tally now keeps the lexicographically smallest label among the failures it records for each reason. The same rule applies within a worker and when merging workers. The regression test covers both merge orders, with and without `--list`. On Windows 11 I used one synthetic file containing 256 empty, 32-byte DXBC containers. At `d2a4bae`, 32 identical runs with `--jobs 4` reported nine different example offsets. With this change, 32 runs each at 1, 4 and 12 workers all reported 256 failures and `@0x0`. Reversing two input file arguments with `--list` also preserved both detail lines and the same example. `cargo test --locked --workspace --no-fail-fast` completed with 265 passed, 0 failed and 4 ignored. No game data was needed for these tests. OpenAI Codex (GPT-6) assisted with the patch, reproduction and report.
catminou4 commented 2026-11-24 06:54:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T06:42:20Z.

Review: APPROVED


Verified locally on macOS 26 arm64, rustc 1.98.1 (aarch64-apple-darwin, rust-toolchain.toml):

Same setup as #664 (main's app crate doesn't compile on macOS; #235's head merged locally, uncommitted, additive conflict resolved):

  • cargo check -p victory --locked: clean
  • cargo test -p victory --locked: 1 passed, 0 failed — the new stability test for translate failure examples passes.

Approving.

<!-- greyfinch-sync:Marvisak/VIctory:review:6034790035 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/673#pullrequestreview-6034790035). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T06:42:20Z. **Review:** APPROVED --- Verified locally on macOS 26 arm64, rustc 1.98.1 (aarch64-apple-darwin, rust-toolchain.toml): Same setup as #664 (main's app crate doesn't compile on macOS; #235's head merged locally, uncommitted, additive conflict resolved): - `cargo check -p victory --locked`: clean - `cargo test -p victory --locked`: **1 passed, 0 failed** — the new stability test for translate failure examples passes. Approving.
LAKSHYA-cmd-tech commented 2026-11-24 06:54:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T06:42:42Z.

Review: APPROVED


LGTM! Tested on Windows 11 with MSVC Rust 1.98.1. cargo test -p victory passes cleanly (2 passed, including ailure_example_is_independent_of_worker_order). Keeping the lexicographically smallest label for each failure reason guarantees deterministic, reproducible translation error reports across multi-threaded workers.

<!-- greyfinch-sync:Marvisak/VIctory:review:6034793284 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/673#pullrequestreview-6034793284). Originally posted by [LAKSHYA-cmd-tech](https://github.com/LAKSHYA-cmd-tech) on 2026-11-24T06:42:42Z. **Review:** APPROVED --- LGTM! Tested on Windows 11 with MSVC Rust 1.98.1. cargo test -p victory passes cleanly (2 passed, including ailure_example_is_independent_of_worker_order). Keeping the lexicographically smallest label for each failure reason guarantees deterministic, reproducible translation error reports across multi-threaded workers.
mercuryVM commented 2026-11-24 11:03:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T10:39:04Z.

Review: APPROVED


Tested 3ba3f79 on Windows 11, RTX 5070, MSVC: cargo test -p victory 2 passed, including failure_example_is_independent_of_worker_order. Clippy's 1 warning is the existing field_reassign_with_default in victory-hle xmem.rs:747, not from this PR.

  • Choosing the minimum label is order-independent both within a worker and across merges, and record_failure is the single place that applies it.
  • Small cost: example() is now evaluated for every failure, even when list is off, where before it ran only the first time per reason. It's a format! per refused program, so negligible next to the translation work.
  • Labels compare as strings, so @0x10 sorts before @0x9. That doesn't matter for determinism, just worth knowing if anyone expects the "lowest address".

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6037697730 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/673#pullrequestreview-6037697730). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T10:39:04Z. **Review:** APPROVED --- Tested 3ba3f79 on Windows 11, RTX 5070, MSVC: `cargo test -p victory` 2 passed, including `failure_example_is_independent_of_worker_order`. Clippy's 1 warning is the existing `field_reassign_with_default` in victory-hle xmem.rs:747, not from this PR. - Choosing the minimum label is order-independent both within a worker and across merges, and `record_failure` is the single place that applies it. - Small cost: `example()` is now evaluated for every failure, even when `list` is off, where before it ran only the first time per reason. It's a `format!` per refused program, so negligible next to the translation work. - Labels compare as strings, so `@0x10` sorts before `@0x9`. That doesn't matter for determinism, just worth knowing if anyone expects the "lowest address". AI-assisted (Claude Code).
geiyiliyabumo commented 2026-11-24 11:04:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T10:09:38Z.


Independent verification of 3ba3f79c1 merged with main (ffe310e, clean merge) on Windows 11 Pro (26100), Rust 1.98.1 (x86_64-pc-windows-msvc): PASS.

  • cargo xtask policy → asset policy: 154 files ok
  • cargo clippy --workspace --all-targets --locked -- -D warnings → pass (0 warnings)
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings → pass (0 warnings)
  • cargo test -p victory --locked → 2 passed, 0 failed (new translate::tests::failure_example_is_independent_of_worker_order passes across both list modes and merge orders)
  • Diff review: Tally::record_failure cleanly selects the lexicographically smallest label both per-worker and during Tally::merge, making failure example reporting deterministic across worker counts and scheduling order.

AI-assisted; synthetic tests only, no game files.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7128397278 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/673#issuecomment-7128397278). Originally posted by [geiyiliyabumo](https://github.com/geiyiliyabumo) on 2026-11-24T10:09:38Z. --- Independent verification of `3ba3f79c1` merged with `main` (`ffe310e`, clean merge) on Windows 11 Pro (`26100`), Rust `1.98.1` (`x86_64-pc-windows-msvc`): **PASS**. - `cargo xtask policy` → `asset policy: 154 files ok` - `cargo clippy --workspace --all-targets --locked -- -D warnings` → **pass** (0 warnings) - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` → **pass** (0 warnings) - `cargo test -p victory --locked` → **2 passed, 0 failed** (new `translate::tests::failure_example_is_independent_of_worker_order` passes across both `list` modes and merge orders) - Diff review: `Tally::record_failure` cleanly selects the lexicographically smallest label both per-worker and during `Tally::merge`, making failure example reporting deterministic across worker counts and scheduling order. AI-assisted; synthetic tests only, no game files.
ErRusso commented 2026-11-24 12:04:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ErRusso on 2026-11-24T11:23:32Z.


Audit: ✅ Looks good (needs Windows to fully compile)

Reviewed this PR as part of an audit of mergeable PRs.

  • Scope: apps/victory/src/translate.rs (+47/-10). Makes the stored failure example deterministic regardless of parallel worker order: fail() and the new record_failure() always keep the lexicographically smallest label, and merge() uses record_failure instead of or_insert_with which had a race on the initial example. The new test verifies stability across worker order permutations (both list modes, both merge orders, 4 variants).
  • Merges cleanly into main.
  • Test note: The victory binary crate's test suite depends on victory-gpu which doesn't compile on Linux (pre-existing #[cfg(windows)] gating gap). The logic is straightforward and the test surface is self-contained in translate.rs.

No issues found in the diff.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7130036442 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/673#issuecomment-7130036442). Originally posted by [ErRusso](https://github.com/ErRusso) on 2026-11-24T11:23:32Z. --- ## Audit: ✅ Looks good (needs Windows to fully compile) Reviewed this PR as part of an audit of mergeable PRs. - **Scope:** `apps/victory/src/translate.rs` (+47/-10). Makes the stored failure example deterministic regardless of parallel worker order: `fail()` and the new `record_failure()` always keep the **lexicographically smallest** label, and `merge()` uses `record_failure` instead of `or_insert_with` which had a race on the initial example. The new test verifies stability across worker order permutations (both `list` modes, both merge orders, 4 variants). - **Merges cleanly** into `main`. - **Test note:** The `victory` binary crate's test suite depends on `victory-gpu` which doesn't compile on Linux (pre-existing `#[cfg(windows)]` gating gap). The logic is straightforward and the test surface is self-contained in `translate.rs`. No issues found in the diff.
molodayamama commented 2026-11-24 14:04:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by molodayamama on 2026-11-24T14:02:29Z.


Independent Windows check of 3ba3f79c1952da6db19fb7960a960e41d3e225c2 (Windows 10 22H2 19045, Rust 1.98.1, MSVC x64).

  • cargo test -p victory --locked --bin victory failure_example_is_independent_of_worker_order -- --test-threads=1 --nocapture: 1 passed.

The fixture records translation-failure examples in different arrival orders and verifies that the output example is stable. No shader corpus used.

Only source-built synthetic fixtures were used. AI-assisted verification.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7133740367 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/673#issuecomment-7133740367). Originally posted by [molodayamama](https://github.com/molodayamama) on 2026-11-24T14:02:29Z. --- Independent Windows check of `3ba3f79c1952da6db19fb7960a960e41d3e225c2` (Windows 10 22H2 19045, Rust 1.98.1, MSVC x64). - `cargo test -p victory --locked --bin victory failure_example_is_independent_of_worker_order -- --test-threads=1 --nocapture`: 1 passed. The fixture records translation-failure examples in different arrival orders and verifies that the output example is stable. No shader corpus used. Only source-built synthetic fixtures were used. AI-assisted verification.
Marvisak commented 2026-11-25 01:08:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:33:57Z.


Automated triage for the maintainers.

Merge candidate. In apps/victory/src/translate.rs, Tally::fail and Tally::merge now both go through record_failure, which keeps the smallest example label for each reason, so the reported example no longer depends on which worker saw or merged a failure first. The minimum over all failures does not depend on order, and the new test failure_example_is_independent_of_worker_order checks this across both merge orders, with and without --list. Two small notes: the example closure is now always evaluated, not only on the first failure (a cheap format!). Also, "smallest" means string order, so @0x10 sorts before @0x2. That is still deterministic, which is the goal.

Thanks for the rebase onto 940d32f. It merges cleanly and keeps the upstream dump-directory test, so this is the first content review.

CI: passing (check).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148643659 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/673#issuecomment-7148643659). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:33:57Z. --- <!-- victory-triage v1 head=d2f4344f726c706c15ee93e02bea4254cdbe1f53 verdict=merge-candidate at=2026-11-25T06:23:30Z --> Automated triage for the maintainers. **Merge candidate.** In `apps/victory/src/translate.rs`, `Tally::fail` and `Tally::merge` now both go through `record_failure`, which keeps the smallest example label for each reason, so the reported example no longer depends on which worker saw or merged a failure first. The minimum over all failures does not depend on order, and the new test `failure_example_is_independent_of_worker_order` checks this across both merge orders, with and without `--list`. Two small notes: the example closure is now always evaluated, not only on the first failure (a cheap `format!`). Also, "smallest" means string order, so `@0x10` sorts before `@0x2`. That is still deterministic, which is the goal. Thanks for the rebase onto `940d32f`. It merges cleanly and keeps the upstream dump-directory test, so this is the first content review. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
timorjay commented 2026-11-25 05:06:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by timorjay on 2026-11-25T05:03:01Z.


Rebased onto 940d32f in d2f4344. Both the upstream dump-directory test and the worker-order regression test are in the branch, and GitHub reports a clean merge with main.

Retested on Windows with synthetic inputs. All 11 unit tests for the victory CLI passed. For a file with 256 containers, all 96 runs selected many.bin@0x0 (32 runs each with 1, 4, and 12 workers). With z.bin before a.bin, unmodified main reported z.bin@0x0. The rebased PR selected a.bin@0x0 in both input orders and kept the detailed output identical.

The full workspace run on this machine had the same five test failures on both commits, two in victory-gpu and three in victory-shader. The GitHub Actions check for this PR passed.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7153402545 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/673#issuecomment-7153402545). Originally posted by [timorjay](https://github.com/timorjay) on 2026-11-25T05:03:01Z. --- Rebased onto `940d32f` in `d2f4344`. Both the upstream dump-directory test and the worker-order regression test are in the branch, and GitHub reports a clean merge with `main`. Retested on Windows with synthetic inputs. All 11 unit tests for the `victory` CLI passed. For a file with 256 containers, all 96 runs selected `many.bin@0x0` (32 runs each with 1, 4, and 12 workers). With `z.bin` before `a.bin`, unmodified `main` reported `z.bin@0x0`. The rebased PR selected `a.bin@0x0` in both input orders and kept the detailed output identical. The full workspace run on this machine had the same five test failures on both commits, two in `victory-gpu` and three in `victory-shader`. The [GitHub Actions check for this PR](https://github.com/Marvisak/VIctory/actions/runs/45550540795) passed.
fuzeofficlal commented 2026-11-26 02:06:56 +00:00 (Migrated from github.com)

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


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

  • Code review (apps/victory/src/translate.rs:69-140, 876-907):
    • Selecting the lexicographically smallest failure example in Tally::record_failure (used by both fail and merge) is associative and commutative, making the failure summary completely independent of worker scheduling/merge order while --list output remains sorted at line 312.
  • 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: 19/19 passed (15 unit + 4 integration, including failure_example_is_independent_of_worker_order).

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179551411 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/673#issuecomment-7179551411). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T01:13:06Z. --- Code review and Windows 11 verification at head `d2f4344f726c` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`apps/victory/src/translate.rs:69-140, 876-907`)**: - Selecting the lexicographically smallest failure example in `Tally::record_failure` (used by both `fail` and `merge`) is associative and commutative, making the failure summary completely independent of worker scheduling/merge order while `--list` output remains sorted at line 312. - **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`: **19/19 passed** (15 unit + 4 integration, including `failure_example_is_independent_of_worker_order`). LGTM.
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/673:upstream-pr/673'
git switch 'upstream-pr/673'

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