Watch tests: the tests that guard views of their own run one at a time (11 to 2 failures in 64 runs under load) #724

Manually merged
github merged 1 commit from github-bot/gh-724 into main 2026-11-29 08:21:30 +00:00 AGit
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 04:29 UTC · original
kibagami-nc:test/watch-view-guard-tests-one-at-a-time → main · +81 −0 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC

The problem

The write watch's guards, views and askings are global, and its tests (crates/victory-gpu/src/watch.rs) ran beside each other:

  • A view that one test maps can land beside another test's guarded block, which is then told as written again. A range the test expects clean comes back with its page:
    assertion `left == right` failed
      left: Some([page])
     right: Some([])
    
  • One test's asking can take a write that another test waits for.

Under load, with eight processes running the crate's tests at once and --all-features, six different watch tests failed 11 times in 64 runs.

The change

The 43 tests that map, guard or ask about views of their own now hold one_view_test() while they run. The five pure ones (block sets, ranges, frames) do not.

The lock is not taken twice by one thread, because faults_that_take_no_lock_tell_the_same runs ten of the other tests as part of itself.

This follows hamdanpor-ctrl's TaynanGT/Vice-Tay#246, which does the same for 21 tests in that tree. That diff does not apply here: this tree has no such lock yet, and has more of these tests.

Tests

  • Under the same load: 2 failures in 64 runs, both from one test, many_askers_tests::no_write_is_lost_when_faults_take_no_lock. That test is about the opt-in VICTORY_FAULT_UNLOCKED path and needs a look of its own.
    • The other failures in those runs were timeline::report::tests::real_waits_are_recorded_with_who_ended_them, fixed by #598.
  • Watch tests: cargo test -p victory-gpu --locked --lib watch: 47 passed, in 1.1 s.
  • Whole crate: cargo test -p victory-gpu --locked --lib: 453 passed, in 6.7 s, as long as before.
  • Clippy: cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without --all-features, finds nothing in watch.rs. main's own findings are fixed by #665.

Tested by others

HailLucifer666 (Windows 11 26200, many cores, WARP present) reproduced it independently, without this PR: 2 failures in 10 full parallel runs of victory-gpu's tests. The failures were what_is_put_in_beside_the_guards_is_told_at_every_view and what_the_kernel_writes_through_is_not_guarded_for_another_view. Every other test passed in all ten runs, so the watch tests' shared book was the only class of failure on that machine.

Tests only; nothing outside #[cfg(test)] changes. No game files, dumps or extracted data are included.

**@⁠kibagami-nc** on GitHub · 2026-11-28 04:29 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/724) `kibagami-nc:test/watch-view-guard-tests-one-at-a-time` → `main` · +81 −0 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC ## The problem The write watch's guards, views and askings are global, and its tests (`crates/victory-gpu/src/watch.rs`) ran beside each other: - A view that one test maps can land beside another test's guarded block, which is then told as written again. A range the test expects clean comes back with its page: ``` assertion `left == right` failed left: Some([page]) right: Some([]) ``` - One test's asking can take a write that another test waits for. Under load, with eight processes running the crate's tests at once and `--all-features`, six different watch tests failed 11 times in 64 runs. ## The change The 43 tests that map, guard or ask about views of their own now hold `one_view_test()` while they run. The five pure ones (block sets, ranges, frames) do not. The lock is not taken twice by one thread, because `faults_that_take_no_lock_tell_the_same` runs ten of the other tests as part of itself. This follows hamdanpor-ctrl's [TaynanGT/Vice-Tay#246](https://github.com/TaynanGT/Vice-Tay/pull/246), which does the same for 21 tests in that tree. That diff does not apply here: this tree has no such lock yet, and has more of these tests. ## Tests - **Under the same load:** 2 failures in 64 runs, both from one test, `many_askers_tests::no_write_is_lost_when_faults_take_no_lock`. That test is about the opt-in `VICTORY_FAULT_UNLOCKED` path and needs a look of its own. - The other failures in those runs were `timeline::report::tests::real_waits_are_recorded_with_who_ended_them`, fixed by #598. - **Watch tests:** `cargo test -p victory-gpu --locked --lib watch`: 47 passed, in 1.1 s. - **Whole crate:** `cargo test -p victory-gpu --locked --lib`: 453 passed, in 6.7 s, as long as before. - **Clippy:** `cargo clippy -p victory-gpu --all-targets -- -D warnings`, with and without `--all-features`, finds nothing in `watch.rs`. `main`'s own findings are fixed by #665. ## Tested by others **HailLucifer666** (Windows 11 26200, many cores, WARP present) reproduced it independently, without this PR: 2 failures in 10 full parallel runs of victory-gpu's tests. The failures were `what_is_put_in_beside_the_guards_is_told_at_every_view` and `what_the_kernel_writes_through_is_not_guarded_for_another_view`. Every other test passed in all ten runs, so the watch tests' shared book was the only class of failure on that machine. Tests only; nothing outside `#[cfg(test)]` changes. No game files, dumps or extracted data are included.
The write watch's guards, views and askings are global, and its tests ran
beside each other: a view one test maps can land beside another test's
guarded block, which is then told as written again, so a range a test
expects clean comes back with its page (left: Some([page]), right:
Some([])), and one test's asking can take a write another waits for.
Under load (eight processes running the crate's tests at once, 64 runs)
six different watch tests failed 11 times.

The 43 tests that map, guard or ask about views of their own now hold
one_view_test() while they run (the five pure ones do not). On the thread
that holds it, it is not taken again: faults_that_take_no_lock_tell_the_same
runs ten of the others as part of it.

Under the same load: 2 failures in 64 runs, both of one test,
no_write_is_lost_when_faults_take_no_lock (the opt-in
VICTORY_FAULT_UNLOCKED path), which needs a look of its own. The crate's
tests take as long as before (6.7 s). Tests only.

After hamdanpor-ctrl's TaynanGT/Vice-Tay#246, which does the same with 21
tests there.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 04:31:27 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-28 04:42 UTC · original · approved these changes

LGTM — verified on Windows:

  • cargo test -p victory-gpu --lib watch:: passed (47/47 in 1.51s)
  • 0 new compiler warnings in touched files
  • cargo xtask policy passed (294 files ok)

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-28 04:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/724#pullrequestreview-6095854040) · **approved these changes** LGTM — verified on Windows: - `cargo test -p victory-gpu --lib watch::` passed (47/47 in 1.51s) - 0 new compiler warnings in touched files - `cargo xtask policy` passed (`294 files ok`) Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠HailLucifer666 on GitHub · 2026-11-29 00:30 UTC · original

Independent reproduction on the current stack head (931610e, victory-gpu 466 tests): the watch-test class reproduced 2 failures in 10 full parallel suite runs —

  • what_is_put_in_beside_the_guards_is_told_at_every_view
  • what_the_kernel_writes_through_is_not_guarded_for_another_view

...which matches your measured rate (2 in 20 → here 2 in 10; machine: Windows 11 26200, many-core, WARP present). Everything else in the 466 passed cleanly across all ten runs, including the descriptor and save_share tests that flake for #785/#819 — so the watch-book sharing is the only flake class this machine sees. Your one-at-a-time pattern is exactly what the queue needs; supporting its merge.

**@⁠HailLucifer666** on GitHub · 2026-11-29 00:30 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/724#issuecomment-7248157092) Independent reproduction on the current stack head (`931610e`, victory-gpu 466 tests): the watch-test class reproduced **2 failures in 10 full parallel suite runs** — - `what_is_put_in_beside_the_guards_is_told_at_every_view` - `what_the_kernel_writes_through_is_not_guarded_for_another_view` ...which matches your measured rate (2 in 20 → here 2 in 10; machine: Windows 11 26200, many-core, WARP present). Everything else in the 466 passed cleanly across all ten runs, including the descriptor and save_share tests that flake for #785/#819 — so the watch-book sharing is the only flake class this machine sees. Your one-at-a-time pattern is exactly what the queue needs; supporting its merge.
github manually merged commit 67bf3db1ad into main 2026-11-29 08:21:30 +00:00
Author
Owner

@⁠LucaruluDev on GitHub · 2026-11-29 09:41 UTC · original

Independent post-merge validation of #724 and #785

Before both PRs were merged, I completed 60 full
workspace test runs to independently evaluate their
effect on intermittent test failures.

Setup

  • Baseline: f9dfb76
  • Patched: same base + #724 (4094fb8)
  • Command: cargo test --workspace --locked --jobs 2 --no-fail-fast
  • Ryzen 7 9700X / RTX 5070 / 32 GiB RAM / Windows 11
  • Rust 1.98.1
  • Isolated worktrees, sequential batches
  • 30 runs per configuration
  • 83,160 test executions in total, excluding ignored tests

Results

Excluding the deterministic asset-policy failure
since resolved by #1493:

Metric Baseline Patched
Runs with intermittent failures 2/30 1/30
what_the_kernel_writes_through_is_not_guarded_for_another_view 1/30 0/30
views_off_their_elements_get_a_copy_of_their_bytes 1/30 0/30
a_late_fault_leaves_the_guard_taken_since 0/30 1/30
Median duration 262.4s 235.1s

Neither of the two target tests failed in the
30 patched runs. This independently supports the
changes, although the aggregate failure-rate difference
is not statistically significant (two-sided Fisher
exact test, p = 1.0).

Additional observation

Patched run 3 failed in the regression test introduced
by #834:

watch::tests::a_late_fault_leaves_the_guard_taken_since

crates/victory-gpu/src/watch.rs:5108:9
assertion failed: !writable(one) && !writable(two)

The assertion failed before the simulated late fault.
The current test also lacks an explicit
one_view_test() guard.

This may warrant investigation into interference
between tests, but does not establish a regression
in the production fix from #834.

Limitations

  • Single machine and sequential, non-randomized batches.
  • Only three intermittent failures were observed.
  • Separate local compilations overlapped two clean
    baseline runs, but none of the intermittent failures.
  • Execution-time differences cannot be attributed
    directly to the patches.
  • All 60 runs encountered the deterministic policy
    failure that has since been resolved by #1493.

Full per-run logs, CSVs and methodology are available
on request.

Thanks to the contributors working on test stability.

AI-assisted analysis using Claude Code.

**@⁠LucaruluDev** on GitHub · 2026-11-29 09:41 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/724#issuecomment-7253936663) ## Independent post-merge validation of #724 and #785 Before both PRs were merged, I completed 60 full workspace test runs to independently evaluate their effect on intermittent test failures. ### Setup - Baseline: `f9dfb76` - Patched: same base + #724 (`4094fb8`) + #785 (`63cee83`) - Command: `cargo test --workspace --locked --jobs 2 --no-fail-fast` - Ryzen 7 9700X / RTX 5070 / 32 GiB RAM / Windows 11 - Rust 1.98.1 - Isolated worktrees, sequential batches - 30 runs per configuration - 83,160 test executions in total, excluding ignored tests ### Results Excluding the deterministic asset-policy failure since resolved by #1493: | Metric | Baseline | Patched | |---|---:|---:| | Runs with intermittent failures | 2/30 | 1/30 | | `what_the_kernel_writes_through_is_not_guarded_for_another_view` | 1/30 | 0/30 | | `views_off_their_elements_get_a_copy_of_their_bytes` | 1/30 | 0/30 | | `a_late_fault_leaves_the_guard_taken_since` | 0/30 | 1/30 | | Median duration | 262.4s | 235.1s | Neither of the two target tests failed in the 30 patched runs. This independently supports the changes, although the aggregate failure-rate difference is not statistically significant (two-sided Fisher exact test, p = 1.0). ### Additional observation Patched run 3 failed in the regression test introduced by #834: `watch::tests::a_late_fault_leaves_the_guard_taken_since` crates/victory-gpu/src/watch.rs:5108:9 assertion failed: !writable(one) && !writable(two) The assertion failed before the simulated late fault. The current test also lacks an explicit `one_view_test()` guard. This may warrant investigation into interference between tests, but does not establish a regression in the production fix from #834. ### Limitations - Single machine and sequential, non-randomized batches. - Only three intermittent failures were observed. - Separate local compilations overlapped two clean baseline runs, but none of the intermittent failures. - Execution-time differences cannot be attributed directly to the patches. - All 60 runs encountered the deterministic policy failure that has since been resolved by #1493. Full per-run logs, CSVs and methodology are available on request. Thanks to the contributors working on test stability. AI-assisted analysis using Claude Code.
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/trustno1-coder--VIctory-NVIDIA!724
No description provided.