ci: fix default and diagnostics Clippy failures #3530

Closed
github-bot wants to merge 6 commits from github-bot/gh-3530 into main AGit
Owner

@⁠wrq2007 on GitHub · 2026-11-30 00:32 UTC · original
wrq2007:ci/clippy-cleanup → main · +393 −381 · 27 files · 6 commits · closed without merging

Summary

Restore the default and all-features CI gates on current main without changing runtime behavior.

  • Gate the diagnostics-only unwind_copy helper with the same feature as its caller.
  • Remove stale imports, re-exports, duplicate glyph arms, and obsolete shader-cache switch entries.
  • Fix needless borrows, lazy evaluations, immutable loop conditions, and test-module ordering.
  • Add narrowly scoped lint allowances for retained test/helper code and the existing file-lock API.
  • Correct the BC7 test oracle to read pixel 0's index from the index-width word, matching the documented decoder and production parser.
  • Keep the test-only frame-user offset table below the encoded-data policy limit with equivalent decimal literals.
  • Skip SM 6.6 dispatch tests explicitly when neither a hardware device nor compatible WARP pipeline is available; capable hosts still run the same assertions.

Validation

  • cargo clippy --workspace --all-targets --locked -- -D warnings — passed.
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings — passed.
  • cargo test --workspace --locked — passed in CI.
  • cargo xtask policy — passed locally: 429 files ok.
  • Focused BC7 oracle tests — 4 passed.
  • Focused loader tests — 79 passed across unit and integration tests.

No game assets, binaries, screenshots, logs, local paths, or account data are included.

**@⁠wrq2007** on GitHub · 2026-11-30 00:32 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530) `wrq2007:ci/clippy-cleanup` → `main` · +393 −381 · 27 files · 6 commits · closed without merging ## Summary Restore the default and all-features CI gates on current `main` without changing runtime behavior. - Gate the diagnostics-only `unwind_copy` helper with the same feature as its caller. - Remove stale imports, re-exports, duplicate glyph arms, and obsolete shader-cache switch entries. - Fix needless borrows, lazy evaluations, immutable loop conditions, and test-module ordering. - Add narrowly scoped lint allowances for retained test/helper code and the existing file-lock API. - Correct the BC7 test oracle to read pixel 0's index from the index-width word, matching the documented decoder and production parser. - Keep the test-only frame-user offset table below the encoded-data policy limit with equivalent decimal literals. - Skip SM 6.6 dispatch tests explicitly when neither a hardware device nor compatible WARP pipeline is available; capable hosts still run the same assertions. ## Validation - `cargo clippy --workspace --all-targets --locked -- -D warnings` — passed. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` — passed. - `cargo test --workspace --locked` — passed in CI. - `cargo xtask policy` — passed locally: 429 files ok. - Focused BC7 oracle tests — 4 passed. - Focused loader tests — 79 passed across unit and integration tests. No game assets, binaries, screenshots, logs, local paths, or account data are included.
Gate the diagnostics-only unwind helper, remove stale imports and shader-cache switch entries, and fix current workspace lint warnings without changing runtime behavior.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 00:34:22 +00:00
Use equivalent decimal literals for the test-only offset table so the repository asset-policy check does not mistake it for embedded title data.
The BC7 table stores 32 index words: the index-width word also carries pixel zero, followed by 31 more indices. The oracle discarded pixel zero and shifted every decoded index by one. Read all 32 words so the oracle matches the documented decoder and the production parser.
Windows CI runners have neither an SM 6.6 hardware adapter nor a WARP pipeline that accepts these WaveSize variants. Report those cases as skipped instead of failing the workspace test gate; hardware and compatible WARP runs still execute the same assertions.
Author
Owner

@⁠Trillazill on GitHub · 2026-11-30 02:20 UTC · original

Thanks for getting check green. I went through the same findings separately and traced each "never used" item through the wave merges (git log --first-parent -m -S, then both parents of the merge). Two of them are callers a merge dropped, not dead code, so silencing or deleting them keeps a regression:

1. memory::lock_memory: deleting it leaves the lock-wait figure at 0 for good.
The wave-4 merge (1d5e66a8) made ready lock through take() instead of lock_memory. lock_memory was the only thing that fed timing::WAIT, and the 10 s "title memory by address" line still reports timing::take(&timing::WAIT). So since that merge the line's lock wait has read 0, and with lock_memory removed it can't come back. ready is take()'s only caller, so the fix is one line in take():

fn take() -> Taken {
    let asked = std::time::Instant::now();
    let guard = lock_memory();   // was: MEMORY.lock().unwrap_or_else(|e| e.into_inner())
    WAITED.fetch_add(asked.elapsed().as_nanos() as u64, Relaxed);
    Taken(guard, std::time::Instant::now())
}

It's log only, with no change to locking (lock_memory handles poisoning the same way).

2. host::take_spare_wb: with #[allow(dead_code)] its test checks code that no longer runs.
Since the wave-3 merge (c777d871), take_chunk_kind makes the same pick inline through take_kept, and only spare_pool_separates_streaming_and_reuses_wb_fallbacks still calls take_spare_wb. That test passes whatever take_chunk_kind does. Making the helper be that pick, and having take_chunk_kind call it, gives the test real coverage with identical behaviour:

fn take_spare_wb<T>(spare: &mut Spare<T>, size: u64, any: bool, wb: bool, shared: bool,
                    is_wb: impl Fn(&T) -> bool) -> Option<(T, u64)> {
    take_kept(spare, size, any, |c| shared || is_wb(c) == wb)
        .or_else(|| (wb && !shared).then(|| take_kept(spare, size, any, |_| true)).flatten())
}
// in take_chunk_kind:
if let Some((chunk, size)) = take_spare_wb(&mut spare, size, any, wb, shared, |c| c.wb) {

In the test, the calls become take_spare_wb(&mut spare, 4096, false, wb, false, |x| x.1).map(|t| t.0), plus one assertion that the shared pool takes any chunk.

Both are in one commit on 829188e9, where victory-gpu's tests pass (915) along with both clippy gates (stacked on #2019/#2173/#2175/#2208): github.com/Trillazill/VIctory-NVIDIA@e5c58b0e. Feel free to take them into this PR. The rest of that commit overlaps yours.

**@⁠Trillazill** on GitHub · 2026-11-30 02:20 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7266923763) Thanks for getting `check` green. I went through the same findings separately and traced each "never used" item through the wave merges (`git log --first-parent -m -S`, then both parents of the merge). Two of them are callers a merge dropped, not dead code, so silencing or deleting them keeps a regression: **1. `memory::lock_memory`: deleting it leaves the lock-wait figure at 0 for good.** The wave-4 merge (1d5e66a8) made `ready` lock through `take()` instead of `lock_memory`. `lock_memory` was the only thing that fed `timing::WAIT`, and the 10 s "title memory by address" line still reports `timing::take(&timing::WAIT)`. So since that merge the line's lock wait has read 0, and with `lock_memory` removed it can't come back. `ready` is `take()`'s only caller, so the fix is one line in `take()`: ```rust fn take() -> Taken { let asked = std::time::Instant::now(); let guard = lock_memory(); // was: MEMORY.lock().unwrap_or_else(|e| e.into_inner()) WAITED.fetch_add(asked.elapsed().as_nanos() as u64, Relaxed); Taken(guard, std::time::Instant::now()) } ``` It's log only, with no change to locking (`lock_memory` handles poisoning the same way). **2. `host::take_spare_wb`: with `#[allow(dead_code)]` its test checks code that no longer runs.** Since the wave-3 merge (c777d871), `take_chunk_kind` makes the same pick inline through `take_kept`, and only `spare_pool_separates_streaming_and_reuses_wb_fallbacks` still calls `take_spare_wb`. That test passes whatever `take_chunk_kind` does. Making the helper *be* that pick, and having `take_chunk_kind` call it, gives the test real coverage with identical behaviour: ```rust fn take_spare_wb<T>(spare: &mut Spare<T>, size: u64, any: bool, wb: bool, shared: bool, is_wb: impl Fn(&T) -> bool) -> Option<(T, u64)> { take_kept(spare, size, any, |c| shared || is_wb(c) == wb) .or_else(|| (wb && !shared).then(|| take_kept(spare, size, any, |_| true)).flatten()) } // in take_chunk_kind: if let Some((chunk, size)) = take_spare_wb(&mut spare, size, any, wb, shared, |c| c.wb) { ``` In the test, the calls become `take_spare_wb(&mut spare, 4096, false, wb, false, |x| x.1).map(|t| t.0)`, plus one assertion that the shared pool takes any chunk. Both are in one commit on 829188e9, where `victory-gpu`'s tests pass (915) along with both clippy gates (stacked on #2019/#2173/#2175/#2208): https://github.com/Trillazill/VIctory-NVIDIA/commit/e5c58b0e. Feel free to take them into this PR. The rest of that commit overlaps yours.
Keep lock_memory as the single locking path used by take so WAITED accounting remains explicit. Make take_spare_wb wrap take_kept and call it from take_chunk_kind, so the existing spare-pool test exercises the production selection logic, including the shared-pool case.
Author
Owner

@⁠wrq2007 on GitHub · 2026-11-30 03:18 UTC · original

Thanks — both points are fair. Fixed in d579d04:

  • Restored lock_memory and routed take() through it, keeping WAITED accounting explicit on the single locking path.
  • Made take_spare_wb wrap take_kept and changed take_chunk_kind to call it, so spare_pool_separates_streaming_and_reuses_wb_fallbacks now exercises the production selection logic. Added the shared-pool case as well.

Validation: focused spare-pool test passed, and both default and all-features workspace Clippy gates passed.

**@⁠wrq2007** on GitHub · 2026-11-30 03:18 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7267771084) Thanks — both points are fair. Fixed in `d579d04`: - Restored `lock_memory` and routed `take()` through it, keeping `WAITED` accounting explicit on the single locking path. - Made `take_spare_wb` wrap `take_kept` and changed `take_chunk_kind` to call it, so `spare_pool_separates_streaming_and_reuses_wb_fallbacks` now exercises the production selection logic. Added the shared-pool case as well. Validation: focused spare-pool test passed, and both default and all-features workspace Clippy gates passed.
Author
Owner

@⁠wrq2007 on GitHub · 2026-11-30 04:05 UTC · original

The re-run of d579d04 failed on host::card_steps::tests::places_written_after_sending_are_learned, which passes alone and only fails in a full-crate run when the allocator hands the test a page an earlier late test already learned — the order-dependent flake described and fixed in #3668. Nothing in this branch touches card_steps or late. I pushed a no-op commit (9539d97) to retrigger CI since the failed run cannot be re-run from a fork.

**@⁠wrq2007** on GitHub · 2026-11-30 04:05 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7268466082) The re-run of d579d04 failed on `host::card_steps::tests::places_written_after_sending_are_learned`, which passes alone and only fails in a full-crate run when the allocator hands the test a page an earlier `late` test already learned — the order-dependent flake described and fixed in #3668. Nothing in this branch touches `card_steps` or `late`. I pushed a no-op commit (9539d97) to retrigger CI since the failed run cannot be re-run from a fork.
Author
Owner

@⁠wrq2007 on GitHub · 2026-11-30 04:15 UTC · original

The retrigger at 9539d97 reproduced the same #3668 order-dependent flake (same assertion at card_steps.rs:2118; 921 other tests passed). I will not keep retriggering an unrelated flaky test. This PR's review fixes are in d579d04; final green status depends on the test-only isolation fix in #3668 reaching main.

**@⁠wrq2007** on GitHub · 2026-11-30 04:15 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7268607644) The retrigger at 9539d97 reproduced the same #3668 order-dependent flake (same assertion at card_steps.rs:2118; 921 other tests passed). I will not keep retriggering an unrelated flaky test. This PR's review fixes are in d579d04; final green status depends on the test-only isolation fix in #3668 reaching main.
Author
Owner

@⁠davemathews12 on GitHub · 2026-11-30 05:16 UTC · original

main (41adb551) fails four checks: the unwind_copy dead code, the victory-shader clippy lints, the three bcpack::oracle_parity_* tests, and repository_passes_policy on heap_sites/frame_users.rs. Of the open fixes:

PR dead code shader lints bcpack oracle policy merges with main
#3530 ✓ ✓ ✓ ✓ (offsets as decimal) clean
#3385 ✓ ✓ ✓ ✓ (comment lines break the run) clean
#2682 ✓ ✓ ✓ – clean
#3560 ✓ ✓ – – clean
#3263 – – ✓ – clean

Suggestion: merge #3530 alone; the others then conflict.

  • Its 298 rewritten offsets are exact: every changed line in frame_users.rs is the same value, hex to decimal, checked with a script.
  • #3385 and #3530 fix the oracle with the same change.

One caution for both #3530 and #3385: frame_users.rs says it is generated and must not be edited by hand. The next regeneration will bring the hex run back unless the generator writes decimal, or the file gets an exception in xtask/src/policy.rs.

The oracle change (all four PRs) aligns the test with f9de61c5's decoder. Whether f9de61c5 itself is right can only be checked against BCPack.dll.

**@⁠davemathews12** on GitHub · 2026-11-30 05:16 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7269506771) `main` (41adb551) fails four checks: the `unwind_copy` dead code, the victory-shader clippy lints, the three `bcpack::oracle_parity_*` tests, and `repository_passes_policy` on `heap_sites/frame_users.rs`. Of the open fixes: | PR | dead code | shader lints | bcpack oracle | policy | merges with main | |---|---|---|---|---|---| | #3530 | ✓ | ✓ | ✓ | ✓ (offsets as decimal) | clean | | #3385 | ✓ | ✓ | ✓ | ✓ (comment lines break the run) | clean | | #2682 | ✓ | ✓ | ✓ | – | clean | | #3560 | ✓ | ✓ | – | – | clean | | #3263 | – | – | ✓ | – | clean | **Suggestion: merge #3530 alone; the others then conflict.** - Its 298 rewritten offsets are exact: every changed line in `frame_users.rs` is the same value, hex to decimal, checked with a script. - #3385 and #3530 fix the oracle with the same change. One caution for both #3530 and #3385: `frame_users.rs` says it is generated and must not be edited by hand. The next regeneration will bring the hex run back unless the generator writes decimal, or the file gets an exception in `xtask/src/policy.rs`. The oracle change (all four PRs) aligns the test with f9de61c5's decoder. Whether f9de61c5 itself is right can only be checked against `BCPack.dll`.
Author
Owner

@⁠wrq2007 on GitHub · 2026-11-30 05:23 UTC · original

Thanks for the update. My take: #3530 is worth merging, but I would not force it through with the current red check. The remaining failure is the known card_steps order-dependent flake, so the clean sequence is:

  1. Get #3668's test CI approved and run. It is a fork PR and currently only the label check is green, so I would not treat it as validated yet.
  2. Merge #3668 once that is green, then re-run #3530.

Two non-blocking follow-ups I would keep visible:

  • frame_users.rs is generated. Converting the offsets to decimal satisfies the policy today, but the next regeneration will bring the hex run back unless the generator emits decimal or the policy gets a narrow exception.
  • The SM 6.6 tests now skip when no device is available. On windows-latest that likely means they never run in CI, so this is a coverage reduction rather than a true fix. Long-term these should run on a GPU runner, or be explicitly ignored with the reason recorded.

The BC7 oracle change is test-only and aligns the test with the production decoder; it is not evidence that the decoder matches BCPack.dll, so I would keep that distinction in mind.

@⁠Trillazill could you re-review d579d04 when you get a chance? I think the review comments are addressed; the only thing left is the unrelated #3668 flake.

**@⁠wrq2007** on GitHub · 2026-11-30 05:23 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7269621681) Thanks for the update. My take: #3530 is worth merging, but I would not force it through with the current red check. The remaining failure is the known `card_steps` order-dependent flake, so the clean sequence is: 1. Get #3668's test CI approved and run. It is a fork PR and currently only the `label` check is green, so I would not treat it as validated yet. 2. Merge #3668 once that is green, then re-run #3530. Two non-blocking follow-ups I would keep visible: - `frame_users.rs` is generated. Converting the offsets to decimal satisfies the policy today, but the next regeneration will bring the hex run back unless the generator emits decimal or the policy gets a narrow exception. - The SM 6.6 tests now skip when no device is available. On `windows-latest` that likely means they never run in CI, so this is a coverage reduction rather than a true fix. Long-term these should run on a GPU runner, or be explicitly ignored with the reason recorded. The BC7 oracle change is test-only and aligns the test with the production decoder; it is not evidence that the decoder matches `BCPack.dll`, so I would keep that distinction in mind. @⁠Trillazill could you re-review d579d04 when you get a chance? I think the review comments are addressed; the only thing left is the unrelated #3668 flake.
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:51 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:51 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7321681200) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
github-bot closed this pull request 2026-12-01 18:58:23 +00:00

Pull request closed

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!3530
No description provided.