xtask: add qa command to run policy, rustfmt, and clippy checks #545

Open
github-bot wants to merge 2 commits from github-bot/gh-545 into main AGit
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 04:43 UTC · original
pushkarreddyy:feat/xtask-qa-command → main · +69 −1 · 1 files · 2 commits · open

Motivation

Currently, contributors and CI systems have to run separate ad-hoc commands to verify repository requirements (cargo xtask policy, cargo fmt, cargo clippy). There is no unified quality assurance command in xtask to run all repository quality gates in sequence.

Solution

  • Added Cmd::Qa { fix: bool } to xtask:
    • Step 1: Enforces the asset policy (Rule #1) via policy::run(root, false).
    • Step 2: Validates code formatting with cargo fmt --all -- --check (or automatically formats if --fix is passed).
    • Step 3: Runs workspace-wide Clippy lints (cargo clippy --workspace --all-targets).
  • Provides contributors with a single unified workflow (cargo xtask qa / cargo xtask qa --fix) to ensure their branch is ready for submission.

No game files used.

**@⁠pushkarreddyy** on GitHub · 2026-11-24 04:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/545) `pushkarreddyy:feat/xtask-qa-command` → `main` · +69 −1 · 1 files · 2 commits · open ## Motivation Currently, contributors and CI systems have to run separate ad-hoc commands to verify repository requirements (`cargo xtask policy`, `cargo fmt`, `cargo clippy`). There is no unified quality assurance command in `xtask` to run all repository quality gates in sequence. ## Solution - Added `Cmd::Qa { fix: bool }` to `xtask`: - **Step 1**: Enforces the asset policy (`Rule #1`) via `policy::run(root, false)`. - **Step 2**: Validates code formatting with `cargo fmt --all -- --check` (or automatically formats if `--fix` is passed). - **Step 3**: Runs workspace-wide Clippy lints (`cargo clippy --workspace --all-targets`). - Provides contributors with a single unified workflow (`cargo xtask qa` / `cargo xtask qa --fix`) to ensure their branch is ready for submission. No game files used.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:07:50 +00:00
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 04:51 UTC · original

### Technical Verification & Implementation Details

Context & Architecture

Contributors and CI systems previously had to invoke disparate commands to verify repository requirements (cargo xtask policy, cargo fmt, cargo clippy). Adding a unified qa subcommand in xtask allows contributors to run all repository quality gates in sequence locally before submitting a PR.

Changes & Implementation

  • Added Cmd::Qa { fix: bool } to xtask/src/main.rs:
    • Step 1: Enforces asset policy via policy::run(root, false).
    • Step 2: Validates code formatting with cargo fmt --all -- --check (or auto-formats with --fix).
    • Step 3: Runs workspace-wide Clippy lints (cargo clippy --workspace --all-targets).
  • Accessible via cargo xtask qa and cargo xtask qa --fix.

Git Log Line & Verification

ext bdb014d xtask: add qa command to run policy, rustfmt, and clippy checks xtask/src/main.rs | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)

  • Passes cargo xtask policy (Rule #1 compliance, zero game assets).
  • Formatted with rustfmt --edition 2024.
**@⁠pushkarreddyy** on GitHub · 2026-11-24 04:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/545#issuecomment-7122407395) ### Technical Verification & Implementation Details #### Context & Architecture Contributors and CI systems previously had to invoke disparate commands to verify repository requirements (`cargo xtask policy`, `cargo fmt`, `cargo clippy`). Adding a unified `qa` subcommand in `xtask` allows contributors to run all repository quality gates in sequence locally before submitting a PR. #### Changes & Implementation - Added `Cmd::Qa { fix: bool }` to `xtask/src/main.rs`: - Step 1: Enforces asset policy via `policy::run(root, false)`. - Step 2: Validates code formatting with `cargo fmt --all -- --check` (or auto-formats with `--fix`). - Step 3: Runs workspace-wide Clippy lints (`cargo clippy --workspace --all-targets`). - Accessible via `cargo xtask qa` and `cargo xtask qa --fix`. #### Git Log Line & Verification ` ext bdb014d xtask: add qa command to run policy, rustfmt, and clippy checks xtask/src/main.rs | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) ` - Passes `cargo xtask policy` (Rule #1 compliance, zero game assets). - Formatted with `rustfmt --edition 2024`.
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 06:24 UTC · original

### Call for Maintainer Review & Merge
Infrastructure and quality assurance improvement:

  • Enforces Rule #1 asset policy and code style consistency across the repository.
  • Non-breaking, zero dependencies on game files.
  • Helps maintainers manage the influx of incoming PRs by automating gates.

@⁠Marvisak: Ready for review and merge when convenient!

**@⁠pushkarreddyy** on GitHub · 2026-11-24 06:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/545#issuecomment-7123904270) ### Call for Maintainer Review & Merge Infrastructure and quality assurance improvement: - Enforces Rule #1 asset policy and code style consistency across the repository. - Non-breaking, zero dependencies on game files. - Helps maintainers manage the influx of incoming PRs by automating gates. @⁠Marvisak: Ready for review and merge when convenient!
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 11:23 UTC · original

Thanks @⁠mercuryVM for the practical feedback on workspace formatting dynamics!

You're completely right: running cargo fmt --all across the whole tree caused qa to fail on main's preexisting 168 unformatted hunks, and --fix would pull unrelated formatting changes into contributors' PRs.

I've updated xtask/src/main.rs in commit 366f485 so that step 2:

  • Detects modified Rust files against origin/main...HEAD / working tree.
  • Runs rustfmt --edition 2024 only on the modified files (with --check on check, or formatting them on --fix).
  • Skips formatting cleanly if no Rust files were touched.

This ensures contributors can run cargo xtask qa / cargo xtask qa --fix cleanly on their PR without touching or failing on unrelated files.

**@⁠pushkarreddyy** on GitHub · 2026-11-24 11:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/545#issuecomment-7130040864) Thanks @⁠mercuryVM for the practical feedback on workspace formatting dynamics! You're completely right: running `cargo fmt --all` across the whole tree caused `qa` to fail on main's preexisting 168 unformatted hunks, and `--fix` would pull unrelated formatting changes into contributors' PRs. I've updated `xtask/src/main.rs` in commit `366f485` so that step 2: - Detects modified Rust files against `origin/main...HEAD` / working tree. - Runs `rustfmt --edition 2024` only on the modified files (with `--check` on check, or formatting them on `--fix`). - Skips formatting cleanly if no Rust files were touched. This ensures contributors can run `cargo xtask qa` / `cargo xtask qa --fix` cleanly on their PR without touching or failing on unrelated files.
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 12:38 UTC · original

Thank you @⁠mercuryVM for testing and approving!

Acknowledged on the edition nit: reading the edition dynamically from rustfmt.toml or workspace Cargo.toml is indeed a cleaner pattern to prevent edition bump drift. I'll include that refinement in future tooling updates.

**@⁠pushkarreddyy** on GitHub · 2026-11-24 12:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/545#issuecomment-7131711414) Thank you @⁠mercuryVM for testing and approving! Acknowledged on the edition nit: reading the edition dynamically from `rustfmt.toml` or workspace `Cargo.toml` is indeed a cleaner pattern to prevent edition bump drift. I'll include that refinement in future tooling updates.
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 12:56 UTC · original

Thank you @⁠catminou4 for testing and approving!

Much appreciated for verifying clean test-merge with main (ffe310e) and passing cargo test -p xtask --locked on macOS arm64.

Regarding the nit on unit test coverage for the run_qa git-diff fallback chain: completely agreed. Pinning the fallback logic (origin/main...HEAD -> HEAD -> working tree) with mock git rev-parse/diff fixtures will make a great follow-up test improvement once this core command lands.

Now with approvals from both @⁠mercuryVM and @⁠catminou4, PR #545 is clean, verified cross-platform, and ready for @⁠Marvisak to merge!

**@⁠pushkarreddyy** on GitHub · 2026-11-24 12:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/545#issuecomment-7132134340) Thank you @⁠catminou4 for testing and approving! Much appreciated for verifying clean test-merge with main (`ffe310e`) and passing `cargo test -p xtask --locked` on macOS arm64. Regarding the nit on unit test coverage for the `run_qa` git-diff fallback chain: completely agreed. Pinning the fallback logic (`origin/main...HEAD` -> `HEAD` -> working tree) with mock git rev-parse/diff fixtures will make a great follow-up test improvement once this core command lands. Now with approvals from both @⁠mercuryVM and @⁠catminou4, PR #545 is clean, verified cross-platform, and ready for @⁠Marvisak to merge!
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:23 UTC · original · edited 2026-11-25 02:31 UTC

Automated triage for the maintainers.

Needs work. This needs the maintainer's decision: the new cargo xtask qa (run_qa and changed_rust_files in xtask/src/main.rs) starts git, rustfmt and cargo as child processes.

The new head f13d04e has the same code as the head reviewed before, so the earlier points still apply:

  • .github/workflows/ci.yml runs Clippy with --locked -- -D warnings, once by default and once with --all-features. run_qa runs plain cargo clippy --workspace --all-targets, so warnings don't fail it and the all-features configuration is never checked. qa can pass a branch that CI rejects.
  • changed_rust_files stops at the first git diff that lists any files. Once the branch has commits against origin/main, uncommitted edits are never checked. It also depends on a local origin/main ref.
  • CI has no formatting gate, so the rustfmt step adds a requirement the repo doesn't otherwise have. The edition is hard-coded as --edition 2024 rather than taken from the workspace.

If the maintainer wants the command, matching the two CI Clippy invocations exactly would fix the main gap.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/545#issuecomment-7149488389) · edited 2026-11-25 02:31 UTC <!-- victory-triage v1 head=f13d04e231ba02b8d103e03b70eea21844ef20fd verdict=needs-work at=2026-11-25T02:20:29Z --> Automated triage for the maintainers. **Needs work. This needs the maintainer's decision:** the new `cargo xtask qa` (`run_qa` and `changed_rust_files` in `xtask/src/main.rs`) starts `git`, `rustfmt` and `cargo` as child processes. The new head `f13d04e` has the same code as the head reviewed before, so the earlier points still apply: - `.github/workflows/ci.yml` runs Clippy with `--locked -- -D warnings`, once by default and once with `--all-features`. `run_qa` runs plain `cargo clippy --workspace --all-targets`, so warnings don't fail it and the all-features configuration is never checked. `qa` can pass a branch that CI rejects. - `changed_rust_files` stops at the first `git diff` that lists any files. Once the branch has commits against `origin/main`, uncommitted edits are never checked. It also depends on a local `origin/main` ref. - CI has no formatting gate, so the rustfmt step adds a requirement the repo doesn't otherwise have. The edition is hard-coded as `--edition 2024` rather than taken from the workspace. If the maintainer wants the command, matching the two CI Clippy invocations exactly would fix the main gap. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
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/545/head:github-bot/gh-545'
git switch 'github-bot/gh-545'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-545'
git switch 'github-bot/gh-545'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-545'
git switch 'github-bot/gh-545'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-545'
git switch 'main'
git merge --squash 'github-bot/gh-545'
git switch 'main'
git merge --ff-only 'github-bot/gh-545'
git switch 'main'
git merge 'github-bot/gh-545'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!545
No description provided.