Make translate failure examples stable across workers #673

Open
github-bot wants to merge 1 commit from github-bot/gh-673 into main AGit
Owner

@⁠timorjay on GitHub · 2026-11-24 06:35 UTC · original
timorjay:timorjay/translate-stable-failure-examples → main · +44 −10 · 1 files · 1 commits · open

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.

**@⁠timorjay** on GitHub · 2026-11-24 06:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/673) `timorjay:timorjay/translate-stable-failure-examples` → `main` · +44 −10 · 1 files · 1 commits · open 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:12:30 +00:00
Author
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 10:09 UTC · original

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.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 10:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/673#issuecomment-7128397278) 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.
Author
Owner

@⁠ErRusso on GitHub · 2026-11-24 11:23 UTC · original

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.

**@⁠ErRusso** on GitHub · 2026-11-24 11:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/673#issuecomment-7130036442) ## 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.
Author
Owner

@⁠molodayamama on GitHub · 2026-11-24 14:02 UTC · original

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.

**@⁠molodayamama** on GitHub · 2026-11-24 14:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/673#issuecomment-7133740367) 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:33 UTC · original · edited 2026-11-25 06:22 UTC

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

**@⁠Marvisak** on GitHub · 2026-11-25 00:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/673#issuecomment-7148643659) · edited 2026-11-25 06:22 UTC <!-- 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)_
Author
Owner

@⁠timorjay on GitHub · 2026-11-25 05:03 UTC · original

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.

**@⁠timorjay** on GitHub · 2026-11-25 05:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/673#issuecomment-7153402545) 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.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 01:13 UTC · original

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.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 01:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/673#issuecomment-7179551411) 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 can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/673/head:github-bot/gh-673'
git switch 'github-bot/gh-673'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-673'
git switch 'github-bot/gh-673'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-673'
git switch 'github-bot/gh-673'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-673'
git switch 'main'
git merge --squash 'github-bot/gh-673'
git switch 'main'
git merge --ff-only 'github-bot/gh-673'
git switch 'main'
git merge 'github-bot/gh-673'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!673
No description provided.