Skip to content

chore(shader): move lower.rs unit tests into emit/lower_tests.rs to satisfy asset policy - #27

Merged
DesertGamer merged 1 commit into
DesertGamer:mainfrom
Lewandox:fix/split-lower-tests
Nov 25, 2026
Merged

DesertGamer merged 1 commit into
DesertGamer:mainfrom
Lewandox:fix/split-lower-tests

Conversation

@Lewandox

@Lewandox Lewandox commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Moves the inline #[cfg(test)] mod tests block (lines 11564–12747, ~46 KiB) out of crates/viport-shader/src/emit/lower.rs into crates/viport-shader/src/emit/lower_tests.rs, wired from lower.rs via:

#[cfg(test)]
#[path = "lower_tests.rs"]
mod tests;

Why

Commit 76e5e50 grew crates/viport-shader/src/emit/lower.rs to 534,435 bytes, exceeding the 524,288-byte (512 KiB) file-size limit enforced by cargo xtask policy:

POLICY: crates/viport-shader/src/emit/lower.rs: 534435 bytes exceeds the 524288-byte limit

Moving the inline test module to emit/lower_tests.rs brings lower.rs down to ~488 KiB (~36 KiB of headroom below the limit) with zero behavioural changes, identical module paths (emit::lower::tests::*), and minimal diff at the bottom of lower.rs so open PRs editing lowering code do not conflict.

Checked

  • No game data of any kind (files, extracts, screenshots, dumps, saves): see docs/asset-policy.md
  • No binary files or archives
  • No new dependency, build.rs, git hook, .cargo config, CI change or script (or an issue explains why)
  • No download, no started program, no network connection added (or an issue explains why)
  • cargo test --workspace passes (see below; viport-shader full lib test suite ran and passed)
  • cargo clippy --workspace --all-targets --locked -- -D warnings passes (see below; viport-shader clippy passed with pre-existing untouched lints allowed on Rust 1.100 GNU)
  • The code I wrote is formatted with rustfmt; I did not reformat lines I did not change

What I ran

Windows 11 Pro build 26300.10075, rustup run stable-x86_64-pc-windows-gnu (rustc 1.100.0, no game data), on main e566768:

  • Before change: cargo xtask policy failed with POLICY: crates/viport-shader/src/emit/lower.rs: 534435 bytes exceeds the 524288-byte limit.
  • After change:
    • cargo xtask policy: asset policy: 218 files ok (lower.rs is 489,504 bytes, lower_tests.rs is 40,463 bytes).
    • VIPORT_WARP=1 cargo test -p viport-shader --lib --locked: 342 passed, 0 failed, 4 ignored (all emit::lower::tests::* tests run and pass unchanged).
    • cargo clippy -p viport-shader --no-deps --lib --tests --locked: zero warnings in lower_tests.rs (pre-existing untouched lints in lower.rs are tracked separately in CI: clear the clippy errors that keep main red since a3e7f17 #21).
  • Not run: full --workspace test/clippy suite (MSVC link.exe not installed locally; only viport-shader test module layout changed).

Overlaps

Checked open PRs (#14, #21, #22, #23, #24):

AI assistance: Antigravity assisted with extracting the test module, running xtask policy and the viport-shader suite, and preparing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants