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

Merged
kibagami-nc merged 1 commit from upstream-pr/724 into main 2026-11-29 08:16:58 +00:00
kibagami-nc commented 2026-11-28 04:29:36 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T04:29:36Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5536659911 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/724). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T04:29:36Z. --- ## 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.
Dukestar69 commented 2026-11-28 04:42:47 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T04:42:47Z.

Review: APPROVED


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).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6095854040 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/724#pullrequestreview-6095854040). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-28T04:42:47Z. **Review:** APPROVED --- 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).
HailLucifer666 commented 2026-11-29 00:30:13 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by HailLucifer666 on 2026-11-29T00:30:13Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7248157092 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/724#issuecomment-7248157092). Originally posted by [HailLucifer666](https://github.com/HailLucifer666) on 2026-11-29T00:30:13Z. --- 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.
LucaruluDev commented 2026-11-29 09:41:58 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by LucaruluDev on 2026-11-29T09:41:58Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7253936663 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/724#issuecomment-7253936663). Originally posted by [LucaruluDev](https://github.com/LucaruluDev) on 2026-11-29T09:41:58Z. --- ## 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.
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
trustno1-coder/VIctory-NVIDIA!724
No description provided.