Policy: allow up to 2 MiB for Rust source files under asset policy #1361

Open
github-bot wants to merge 1 commit from github-bot/gh-1361 into main AGit
Owner

@⁠ashishdhillon on GitHub · 2026-11-26 18:11 UTC · original
ashishdhillon:fix/asset-policy-rs-size-limit → main · +37 −6 · 2 files · 1 commits · open

Description

Fixes #1342. On main, crates/victory-gpu/src/host.rs (528,954 bytes) and crates/victory-shader/src/emit/lower.rs (535,588 bytes) exceeded the uniform 512 KiB MAX_FILE_SIZE ceiling in xtask/src/policy.rs, causing policy::tests::repository_passes_policy (CI Tests) to fail and cargo xtask policy --staged to reject commits touching either file.

This implements Option 1 discussed in #1342: giving .rs source files a dedicated 2 MiB size ceiling (MAX_SOURCE_FILE_SIZE) while keeping all content guards (allowlisted extension, forbidden binary signatures, NUL-byte check, and MAX_ENCODED_RUN = 512 hex/base64 run check) unchanged and keeping MAX_FILE_SIZE = 512 KiB for all other non-run-log files.

Changes

  • xtask/src/policy.rs: Added MAX_SOURCE_FILE_SIZE (2 MiB) for .rs files, updated check() size enforcement, added source_files_have_their_own_size_limit unit test, and updated rejects_game_like_files.
  • docs/asset-policy.md: Documented the 2 MiB ceiling for .rs source files alongside the 512 KiB general limit.

Verification

  • cargo clippy -p xtask --all-targets --locked -- -D warnings: passed
  • cargo test -p xtask --locked: 6 passed, 0 failed (including policy::tests::repository_passes_policy)
  • cargo xtask policy: asset policy: 223 files ok
**@⁠ashishdhillon** on GitHub · 2026-11-26 18:11 UTC · [original](https://github.com/fxceless/victory-fork/pull/1361) `ashishdhillon:fix/asset-policy-rs-size-limit` → `main` · +37 −6 · 2 files · 1 commits · open ## Description Fixes #1342. On `main`, `crates/victory-gpu/src/host.rs` (528,954 bytes) and `crates/victory-shader/src/emit/lower.rs` (535,588 bytes) exceeded the uniform 512 KiB `MAX_FILE_SIZE` ceiling in `xtask/src/policy.rs`, causing `policy::tests::repository_passes_policy` (CI `Tests`) to fail and `cargo xtask policy --staged` to reject commits touching either file. This implements Option 1 discussed in #1342: giving `.rs` source files a dedicated 2 MiB size ceiling (`MAX_SOURCE_FILE_SIZE`) while keeping all content guards (allowlisted extension, forbidden binary signatures, NUL-byte check, and `MAX_ENCODED_RUN = 512` hex/base64 run check) unchanged and keeping `MAX_FILE_SIZE = 512 KiB` for all other non-run-log files. ## Changes - `xtask/src/policy.rs`: Added `MAX_SOURCE_FILE_SIZE` (2 MiB) for `.rs` files, updated `check()` size enforcement, added `source_files_have_their_own_size_limit` unit test, and updated `rejects_game_like_files`. - `docs/asset-policy.md`: Documented the 2 MiB ceiling for `.rs` source files alongside the 512 KiB general limit. ## Verification - `cargo clippy -p xtask --all-targets --locked -- -D warnings`: passed - `cargo test -p xtask --locked`: 6 passed, 0 failed (including `policy::tests::repository_passes_policy`) - `cargo xtask policy`: `asset policy: 223 files ok`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 18:15:46 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1361/head:github-bot/gh-1361'
git switch 'github-bot/gh-1361'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1361'
git switch 'github-bot/gh-1361'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1361'
git switch 'github-bot/gh-1361'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1361'
git switch 'main'
git merge --squash 'github-bot/gh-1361'
git switch 'main'
git merge --ff-only 'github-bot/gh-1361'
git switch 'main'
git merge 'github-bot/gh-1361'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.