Policy: the file-size limit is 1 MiB, over the translator's 688 KiB lower.rs (fixes #1429) #1493

Merged
kibagami-nc merged 1 commit from upstream-pr/1493 into main 2026-11-29 08:16:56 +00:00
kibagami-nc commented 2026-11-28 20:46:51 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T20:46:51Z.


Fixes #1429 (found by Jesper-Andersson).

Updated on main (f9dfb76f): the limit is now 1 MiB. lower.rs has kept growing since this PR was opened:

lower.rs
1028eef2 (limit raised to 640 KiB) 570 KiB
923e38c (2026-11-28 evening) 652 KiB
f9dfb76f (now) 688 KiB (704,996 bytes)

At that pace, 768 KiB would have been passed again within days. #1460 (moving lower.rs's tests to their own file) saved 28 KiB, which no longer brings the file under 640 KiB, and it now conflicts with main.

What happens

xtask/src/policy.rs allows 640 KiB (655,360 bytes). So on main:

  • CI: cargo test --workspace --locked fails in repository_passes_policy:
    POLICY: crates/victory-shader/src/emit/lower.rs: 704996 bytes exceeds the 655360-byte limit
    
  • Commits: the pre-commit hook (cargo xtask policy --staged) refuses any commit that touches lower.rs.

The change

  • MAX_FILE_SIZE is 1 MiB. This is what 1028eef2 did when the file passed 570 KiB, but with room for the pace it now grows at.
  • The comment above it names the two largest files and their sizes: lower.rs at 688 KiB and crates/victory-gpu/src/host.rs at 593 KiB.
  • docs/asset-policy.md says 1 MiB.

The policy's other checks are unchanged: the allowlist, no binary data, no known binary signatures, no long hex or base64 runs. The limit still lets through only a text file of source.

Why not split lower.rs? Turning it into a lower/ module folder would be the lasting fix. But it moves close to 700 KiB of code that most open translator PRs touch, and each of them would then conflict.

Tests

  • cargo test -p xtask --locked: 7 passed, repository_passes_policy included. On main it fails as above.
  • cargo xtask policy: asset policy: 321 files ok.
  • cargo clippy -p xtask --all-targets --locked -- -D warnings: clean.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5544420830 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1493). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T20:46:51Z. --- Fixes #1429 (found by Jesper-Andersson). **Updated on main (f9dfb76f): the limit is now 1 MiB.** `lower.rs` has kept growing since this PR was opened: | | `lower.rs` | |---|---| | 1028eef2 (limit raised to 640 KiB) | 570 KiB | | 923e38c (2026-11-28 evening) | 652 KiB | | f9dfb76f (now) | 688 KiB (704,996 bytes) | At that pace, 768 KiB would have been passed again within days. #1460 (moving `lower.rs`'s tests to their own file) saved 28 KiB, which no longer brings the file under 640 KiB, and it now conflicts with main. ## What happens `xtask/src/policy.rs` allows 640 KiB (655,360 bytes). So on main: - **CI:** `cargo test --workspace --locked` fails in `repository_passes_policy`: ``` POLICY: crates/victory-shader/src/emit/lower.rs: 704996 bytes exceeds the 655360-byte limit ``` - **Commits:** the pre-commit hook (`cargo xtask policy --staged`) refuses any commit that touches `lower.rs`. ## The change - `MAX_FILE_SIZE` is 1 MiB. This is what 1028eef2 did when the file passed 570 KiB, but with room for the pace it now grows at. - The comment above it names the two largest files and their sizes: `lower.rs` at 688 KiB and `crates/victory-gpu/src/host.rs` at 593 KiB. - `docs/asset-policy.md` says 1 MiB. The policy's other checks are unchanged: the allowlist, no binary data, no known binary signatures, no long hex or base64 runs. The limit still lets through only a text file of source. **Why not split `lower.rs`?** Turning it into a `lower/` module folder would be the lasting fix. But it moves close to 700 KiB of code that most open translator PRs touch, and each of them would then conflict. ## Tests - **`cargo test -p xtask --locked`**: 7 passed, `repository_passes_policy` included. On main it fails as above. - **`cargo xtask policy`**: `asset policy: 321 files ok`. - **`cargo clippy -p xtask --all-targets --locked -- -D warnings`**: clean.
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!1493
No description provided.