ci: fix default and diagnostics Clippy failures #3530

Closed
wrq2007 wants to merge 6 commits from upstream-pr/3530 into main
wrq2007 commented 2026-11-30 00:32:57 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by wrq2007 on 2026-11-30T00:32:57Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5556866271 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530). Originally posted by [wrq2007](https://github.com/wrq2007) on 2026-11-30T00:32:57Z. --- ## 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.
Trillazill commented 2026-11-30 02:20:43 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Trillazill on 2026-11-30T02:20:43Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7266923763 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7266923763). Originally posted by [Trillazill](https://github.com/Trillazill) on 2026-11-30T02:20:43Z. --- 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.
wrq2007 commented 2026-11-30 03:18:13 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by wrq2007 on 2026-11-30T03:18:13Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7267771084 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7267771084). Originally posted by [wrq2007](https://github.com/wrq2007) on 2026-11-30T03:18:13Z. --- 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 commented 2026-11-30 04:05:52 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by wrq2007 on 2026-11-30T04:05:52Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7268466082 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7268466082). Originally posted by [wrq2007](https://github.com/wrq2007) on 2026-11-30T04:05:52Z. --- 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 commented 2026-11-30 04:15:19 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by wrq2007 on 2026-11-30T04:15:19Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7268607644 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7268607644). Originally posted by [wrq2007](https://github.com/wrq2007) on 2026-11-30T04:15:19Z. --- 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.
davemathews12 commented 2026-11-30 05:16:05 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by davemathews12 on 2026-11-30T05:16:05Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7269506771 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7269506771). Originally posted by [davemathews12](https://github.com/davemathews12) on 2026-11-30T05:16:05Z. --- `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`.
wrq2007 commented 2026-11-30 05:23:23 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by wrq2007 on 2026-11-30T05:23:23Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7269621681 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7269621681). Originally posted by [wrq2007](https://github.com/wrq2007) on 2026-11-30T05:23:23Z. --- 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.
trustno1-coder commented 2026-12-01 18:51:22 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:51:22Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321681200 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3530#issuecomment-7321681200). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:51:22Z. --- 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.

Pull request closed

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