Replay: refuse a capture with no resource start state #651

Open
enzoduarte1 wants to merge 1 commit from upstream-pr/651 into a-publier
enzoduarte1 commented 2026-11-27 16:28:48 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by enzoduarte1 on 2026-11-27T16:28:48Z.


Frame::read validates the magic, version and trailing bytes, but not the semantic invariants the replay relies on. A capture whose Resource.state is empty is accepted; later the replay indexes state[0] (replay/play.rs) and the last state of each barrier side (replay/gpu.rs), so such a file panics instead of being reported as a bad capture.

The recorder cannot make such a frame: States::get returns at least [COMMON], and the snapshot falls back to that when a resource has no recorded state. This rejects only a file the recorder could not have written.

Changes:

  • Frame::read now rejects any resource with an empty start state with Bad("a resource has no start state").
  • Extended wire::tests::a_frame_comes_back to write a frame whose first resource has no state and assert the read fails with that message.

Validation (local GNU toolchain, MSVC link.exe is not installed here):

  • cargo clippy --workspace --all-targets --locked -- -D warnings — passed.
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings — passed.
  • cargo test -p victory-gpu --lib --features diagnostics replay::wire::tests::a_frame_comes_back -- --exact — passed.
  • cargo test --workspace --locked -- --test-threads=1 — all suites passed except the pre-existing/environmental -p victory-loader --test load_probe GNU linker failure (/DELAYLOAD:victory-probe-delayed.dll).
  • cargo test --workspace --all-features --locked -- --test-threads=1 — the new test passed. Four failures were reproduced on unmodified HEAD~1 (timeline::report::real_waits_are_recorded_with_who_ended_them and three victory-hle kernel/net tests), plus the load_probe linker failure. With only those known failures skipped, every suite passed, including xtask policy.
  • cargo fmt --all -- --check is already dirty on a-publier with the pinned rustfmt (many untouched files); this change adds no formatting diff to wire.rs.

Risk: none for captures the recorder produced. Corrupt captures now fail at read time with a clear error instead of panicking during replay. No open issue covers this exact case; none of the 200 open PRs touches replay/wire.rs.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:5529921900 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/651). Originally posted by [enzoduarte1](https://github.com/enzoduarte1) on 2026-11-27T16:28:48Z. --- `Frame::read` validates the magic, version and trailing bytes, but not the semantic invariants the replay relies on. A capture whose `Resource.state` is empty is accepted; later the replay indexes `state[0]` (`replay/play.rs`) and the last state of each barrier side (`replay/gpu.rs`), so such a file panics instead of being reported as a bad capture. The recorder cannot make such a frame: `States::get` returns at least `[COMMON]`, and the snapshot falls back to that when a resource has no recorded state. This rejects only a file the recorder could not have written. Changes: - `Frame::read` now rejects any resource with an empty start state with `Bad("a resource has no start state")`. - Extended `wire::tests::a_frame_comes_back` to write a frame whose first resource has no state and assert the read fails with that message. Validation (local GNU toolchain, MSVC `link.exe` is not installed here): - `cargo clippy --workspace --all-targets --locked -- -D warnings` — passed. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` — passed. - `cargo test -p victory-gpu --lib --features diagnostics replay::wire::tests::a_frame_comes_back -- --exact` — passed. - `cargo test --workspace --locked -- --test-threads=1` — all suites passed except the pre-existing/environmental `-p victory-loader --test load_probe` GNU linker failure (`/DELAYLOAD:victory-probe-delayed.dll`). - `cargo test --workspace --all-features --locked -- --test-threads=1` — the new test passed. Four failures were reproduced on unmodified `HEAD~1` (`timeline::report::real_waits_are_recorded_with_who_ended_them` and three `victory-hle` kernel/net tests), plus the `load_probe` linker failure. With only those known failures skipped, every suite passed, including `xtask policy`. - `cargo fmt --all -- --check` is already dirty on `a-publier` with the pinned rustfmt (many untouched files); this change adds no formatting diff to `wire.rs`. Risk: none for captures the recorder produced. Corrupt captures now fail at read time with a clear error instead of panicking during replay. No open issue covers this exact case; none of the 200 open PRs touches `replay/wire.rs`.
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/651:upstream-pr/651'
git switch 'upstream-pr/651'

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 'a-publier'
git merge --no-ff 'upstream-pr/651'
git switch 'upstream-pr/651'
git rebase 'a-publier'
git switch 'a-publier'
git merge --ff-only 'upstream-pr/651'
git switch 'upstream-pr/651'
git rebase 'a-publier'
git switch 'a-publier'
git merge --no-ff 'upstream-pr/651'
git switch 'a-publier'
git merge --squash 'upstream-pr/651'
git switch 'a-publier'
git merge --ff-only 'upstream-pr/651'
git switch 'a-publier'
git merge 'upstream-pr/651'
git push origin 'a-publier'
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
Belobug/VIctory-Belobug-AMD!651
No description provided.