CI: add asset-policy and formatting verification workflow #540
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!540
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/540/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@pushkarreddyy on GitHub · 2026-11-24 04:41 UTC · original
pushkarreddyy:ci/asset-policy-workflow→main· +50 −0 · 1 files · 4 commits · closed without mergingMotivation
Rule #1 (Asset Policy) is the fundamental safeguard of the repository: "The repository holds only small text files we wrote. Zero proprietary game assets, executables, or long hex/base64 strings."
Currently, there is no automated GitHub Actions workflow to check incoming pull requests for asset policy violations or formatting deviations. A fast, dedicated workflow guarantees that every PR and commit is verified before review.
Solution
.github/workflows/policy.ymltargetingpushandpull_requestonmain.cargo xtask policy.cargo fmt --all -- --check.No game files used.
@pushkarreddyy on GitHub · 2026-11-24 04:51 UTC · original
### Technical Verification & Implementation Details
Context & Architecture
Rule #1 (Asset Policy) is the central safeguard of the project. Prior to this PR, there was no automated GitHub Actions workflow to check incoming PRs for asset policy violations or formatting deviations. This workflow establishes an automated gate that runs in ~30 seconds on every push and PR.
Changes & Workflow Design
.github/workflows/policy.ymlrunning onubuntu-latest.actions/checkout@v4rustfmtcomponent.cargo xtask policyto enforce Rule #1.cargo fmt --all -- --checkto enforce code style.Git Log Line & Verification
ext ade455a CI: add asset-policy and formatting verification workflow .github/workflows/policy.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)cargo xtask policy(Rule #1 compliance, zero game assets).rustfmt --edition 2024.@pushkarreddyy on GitHub · 2026-11-24 06:24 UTC · original
### Call for Maintainer Review & Merge
Infrastructure and quality assurance improvement:
@Marvisak: Ready for review and merge when convenient!
@sebastianspicker on GitHub · 2026-11-24 10:48 UTC · original
The format step is red on current
mainbefore it looks at any PR: atffe310e,cargo fmt --all -- --checkwith rustfmt 1.98.1 reports 182 hunks in 35 files. So this needs a one-time format pass to land first or alongside it (#112 has one).If someone does that pass on its own, two things to know. Formatting moves the
// SAFETY:comments atvictory-gpu/src/list.rs(theuploadsassert in the tests) andvictory-gpu/src/watch.rs(thefrom the diskassert) away from theirunsafeblocks, which turns the Windows clippy job red. I've put the two-line fix in #112. Andxma/tables.rsgets reflowed to one entry per line unless the tables get#[rustfmt::skip].With the format pass and those two fixes, the same two commands this workflow runs both pass locally on
ffe310e(cargo fmt --all -- --checkandcargo xtask policy). The workflow itself looks fine to me.AI-assisted.
@pushkarreddyy on GitHub · 2026-11-24 11:22 UTC · original
Thanks @mercuryVM and @sebastianspicker for the detailed measurement and context!
You're completely right: running
cargo fmt --all -- --checkacross the whole workspace turns every PR red due to the 182 preexisting unformatted hunks onmain, training contributors to ignore the check.I've updated the workflow in commit
5b7eb8aso that on pull requests, it checks formatting specifically on the modified Rust files (git diff --name-only origin/main...HEAD -- '*.rs' | xargs rustfmt --edition 2024 --check). This ensures incoming PRs are kept clean without being blocked by preexisting diffs onmain. Once a full-tree formatting pass (like #112) lands, full-workspace checks can be enforced unconditionally.@pushkarreddyy on GitHub · 2026-11-24 12:36 UTC · original
Thanks @mercuryVM for the sharp edge-case analysis!
You're completely right on all three points:
rustfmt --checkwithout diff filtering.|| trueon pushes masks the real status and could be misinterpreted as main passing.xargs.I've updated the workflow in commit
72361d1:--diff-filter=ACMRto ensure deleted files are never passed torustfmt.git diff -z ... | xargs -0 -r rustfmt --edition 2024 --check) to handle paths with spaces safely and avoid running rustfmt on empty inputs..rsfiles, while pushes tomainruncargo fmt --all -- --checkwithcontinue-on-error: true, preserving the genuine exit code in the step log without faking a clean pass.@pushkarreddyy on GitHub · 2026-11-24 13:00 UTC · original
Thank you @catminou4 for the thorough workflow review and approval!
Much appreciated for verifying the least-privilege permissions, concurrency cancellation, and changed-file scoping.
Regarding your notes:
.rsfiles ensures new contributors get immediate feedback on their own code without getting blocked by pre-existing repository formatting or waiting for a repository-wide reformat sweep.cargo xtask qaas the local pre-push developer gate, while this workflow provides the automated server-side verification gate in GitHub Actions.Now that PR #540 is approved by @catminou4, it is ready for maintainer merge!
@ricarmandoagent on GitHub · 2026-11-24 13:02 UTC · original
This overlaps two other PRs before it is reviewed on its own merits: #17 runs the same rustfmt check with less machinery, and #481 already runs
cargo xtask policyplus fmt in one workflow. Three workflows for two checks will double the runner time on every PR.If this one is kept instead of #17/#481, two details: the toolchain is hard-coded to
1.98.1whilerust-toolchain.tomlis the single source of truth (it matches today, it will drift on the next bump —rustup toolchain installwith no argument reads the file), anddtolnay/rust-toolchain@stablewith an explicittoolchain:input ignores the components the file pins unless they are listed again.cargo xtask policyitself is fine onubuntu-latest: xtask only depends on anyhow, clap and walkdir.AI-assisted review.
@pushkarreddyy on GitHub · 2026-11-24 14:12 UTC · original · edited 2026-11-24 14:21 UTC
Thanks @ricarmandoagent for the review and perspective!
Regarding PR #540:
We are very happy to adapt to whichever approach @Marvisak and the maintainers prefer for the repository!
@pushkarreddyy on GitHub · 2026-11-24 14:25 UTC · original
Updated commit 637452f incorporates @ricarmandoagent's helpful suggestion to omit the explicit oolchain: input so dtolnay/rust-toolchain defers directly to
ust-toolchain.toml as the single source of truth for channel version and pins.
@Marvisak on GitHub · 2026-11-25 00:04 UTC · original
Automated triage for the maintainers. Closing because it does not change behaviour the project needs (formatting, guards for cases that cannot occur, or notes and translations that cannot be kept current).
Second workflow for the asset-policy check, which main's ci.yml already runs inside the tests, plus rustfmt on changed files, which fails for any touched file because the workspace is not rustfmt-clean (#502). Installs
stablethrough an unpinned third-party action instead of the pinned toolchain.If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed