Normalize rocJitsu and Mirage formatting and strengthen CI checks. #13044
<!-- therock-pr-bot-policy-check -->
❌ PR Check — Action Required
| Check | Status | Details |
|---|:---:|---|
| 📝 PR Description | ❌ Fail | Error: PR description must reference a JIRA ID, ISSUE ID, or a GitHub closing keyword.<br>Expected: include a JIRA ID / ISSUE ID line (separator : or -, or omitted; value may be a JIRA key, a number with/without #, or a link), OR a closing keyword + issue reference. Accepted examples:<br>• JIRA ID : TESTAUTO-6039<br>• JIRA ID - #330<br>• JIRA ID #330<br>• JIRA ID (on separate line)<br>ROCM-25757<br>• ISSUE ID : TESTUTO-3334<br>• ISSUE ID #3334<br>• ISSUE ID - TESTAUTO-3433<br>• ISSUE ID (on separate line)<br>AIRUNTIME-2352<br>• ISSUE ID : https://github.com/<org_name>/<repo_name>/issues/1234<br>• Closes #10<br>• Fixes octo-org/octo-repo#100<br>• Resolves: #123<br>• #123<br>• https://github.com/<org_name>/<repo_name>/issues/123<br>Current: no valid JIRA/ISSUE/closing-keyword reference found |
| ⛔ Forbidden Files | ✅ Pass | — |
| 🧪 Unit Test | ⚠️ Warning | Error: Source/code files changed without an accompanying unit test.<br>Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).<br>Current: code file(s) changed: .github/scripts/rocjitsu_formatting.py, .github/scripts/test-rocjitsu-formatting.py, emulation/mirage/core/src/metric.rs, emulation/mirage/tests/fixtures/ml/dist_smoke.py, emulation/mirage/tests/fixtures/ml/opt125_onetoken.py; no test file found |
| 🔎 pre-commit | ✅ Pass | — |
| 🚫 Draft PR | 🔜 To Be Enabled | — |
| 🚩 Feature Flag | 🔜 To Be Enabled | — |
| 📊 Code Coverage | 🔜 To Be Enabled | — |
⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.
> 🚫 Please fix the failed policies
- ❌ PR Description
> The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.📖 Need help? See the Policy FAQ for details on every check and how to fix failures.
<!-- therock-pr-bot-fix-policies -->
🚫 Please fix the failed policies before requesting reviews.
The following policy checks failed:
The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.
<!-- ccr-overview-v2 -->
🟢 Approval recommended
The supplied changes preserve behavior and introduce no identified blocking issues.
0 open findings
<details>
<summary><strong>What changed in this PR</strong></summary>
Establishes a clean formatting baseline for rocJitsu and Mirage, reducing unrelated edits when contributors run pre-commit hooks.
Changes:
| File | Description |
| ---- | ----------- |
| emulation/rocjitsu/docs/sphinx/reference/consan.md | Removes trailing blank line. |
| emulation/mirage/tests/recipes/race.yml | Removes trailing blank line. |
| emulation/mirage/tests/fixtures/ml/opt125_onetoken.py | Normalizes comment spacing and blank lines. |
| emulation/mirage/tests/fixtures/ml/dist_smoke.py | Wraps Python calls. |
| emulation/mirage/hotswap/cmake/Hotswap.cmake | Reformats HotSwap build configuration. |
| emulation/mirage/hotswap/cmake/hotswap_copy_glob.cmake | Normalizes CMake indentation and wrapping. |
| emulation/mirage/docs/aorta.md | Removes trailing whitespace. |
| emulation/mirage/core/src/metric.rs | Removes sole blank line. |
| emulation/mirage/cmake/RocjitsuCorpus.cmake | Reformats corpus test configuration. |
| emulation/mirage/.gitignore | Adds final newline. |
</details>
🧠 Review effort: Balanced
---
💡 <a href="/ROCm/rocm-systems/new/develop?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a code-review agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>
It would be useful to follow up by checking the full gated subtrees when .pre-commit-config.yaml or .github/workflows/rocjitsu-formatting.yml changes. The workflow currently passes only changed files to pre-commit, so a hook-version update or newly included subtree can leave untouched files outside the new formatting baseline. For those configuration changes, checking all tracked, on-disk files under emulation/mirage and emulation/rocjitsu would catch that drift. This can be a separate follow-up to this formatting-only PR.
We should give emulation/mirage/core/src/metric.rs a short module comment so both formatters accept it. The module is still loaded by emulation/mirage/core/src/lib.rs:34, but this PR empties its file, and rustup run stable cargo fmt --all -- --check (rustfmt 1.9.0) now fails on that file. This is also the command used by Mirage's cargo_fmt test and mirage_lint target.
Restoring only the newline will not hold: the pinned end-of-file-fixer v5.0.0 removes it again. A one-line module comment passes both that hook and rustfmt in a minimal repro.
It would be useful to follow up by checking the full gated subtrees when.pre-commit-config.yamlor.github/workflows/rocjitsu-formatting.ymlchanges. The workflow currently passes only changed files topre-commit, so a hook-version update or newly included subtree can leave untouched files outside the new formatting baseline. For those configuration changes, checking all tracked, on-disk files underemulation/mirageandemulation/rocjitsuwould catch that drift. This can be a separate follow-up to this formatting-only PR.
I think we can do it in the same PR; it is done in https://github.com/ROCm/rocm-systems/pull/13044/commits/2192370fa1d4c68467b2331dbfeda53789ab79fe
I also updated the PR title and description to reflect the change.
> We should giveemulation/mirage/core/src/metric.rsa short module comment so both formatters accept it. The module is still loaded byemulation/mirage/core/src/lib.rs:34, but this PR empties its file, andrustup run stable cargo fmt --all -- --check(rustfmt 1.9.0) now fails on that file. This is also the command used by Mirage'scargo_fmttest andmirage_linttarget.
> Restoring only the newline will not hold: the pinned end-of-file-fixer v5.0.0 removes it again. A one-line module comment passes both that hook and rustfmt in a minimal repro.
Done, I did not know that there are two formatters. Thanks for pointing it out! https://github.com/ROCm/rocm-systems/pull/13044/commits/2376be7f28f6cd12d514fabe371d2127a31e65de
We should document the new Rust formatting gate and its local reproduction command. .github/workflows/rocjitsu-formatting.yml:88 now runs cargo +1.88.0 fmt --all -- --check in emulation/mirage on every invocation, including rocJitsu-only changes, but tools/systems_pr_bot/policy.yml:155 still tells contributors only to run pre-commit when this required check fails. That command does not run rustfmt. Please add the Rust command and toolchain requirement to those instructions, and mention the new Rust gate and selector tests in the PR description.
I think it would help to move the selector into a helper under .github/scripts/ and have the workflow and tests call it, following rocjitsu_corpus_translation_comment.py and its test. Here the tests recover the program by parsing YAML and matching the step's display name, so renaming that step breaks test setup. A shared helper would remove that coupling and the test's PyYAML dependency. The ${{ ... }} replacements in run_workflow can also go: the current step receives both SHAs through environment variables.
This might be easier to maintain if the full scan enumerated tracked files under emulation/ and retained the existing on-disk filter. The two component names are now repeated in the trigger paths, sparse checkout, and this command. Adding a third component to the first two lists still leaves its unchanged files out of the full scan unless this list is updated too; a third-component fixture reproduces that omission. Using the checked-out emulation scope would remove that extra synchronization point.
Moved the selector into .github/scripts/rocjitsu_formatting.py, which both the workflow and tests now invoke directly. Removed the YAML parsing, step-name matching, and obsolete ${{ ... }} replacements.
done.
We should align the full-scan scope with the workflow triggers. Cone-mode sparse checkout also materializes emulation/README.md, emulation/Dockerfile, and emulation/.dockerignore, so this scan checks them even though changes confined to those files do not trigger the job. A formatting violation there can therefore first fail an unrelated policy-update PR. A small sparse-checkout fixture reproduces the inclusion.
Please either include direct emulation/ files in the trigger paths or exclude them from the scan, and cover a parent-level file in the sparse-checkout test. The PR description should also reflect the chosen scope and the helper-file full-scan trigger; it currently describes only the two component trees and config/workflow triggers.
I think it would help to distinguish the selector policy and fixture paths in the test names:
.github/scripts/test-rocjitsu-formatting.py:107, name the config/workflow/helper full-scan tests around checked-out emulation files; “both complete subtrees” suggests the old two-component restriction. At line 192, name the missing-file case for its on-disk filtering, since it unlinks a file; the separate test at line 155 exercises actual sparse checkout.HELPER_SCRIPT and HELPER_FIXTURE_PATH to distinguish the real executable from the path committed into the temporary repository.These distinctions would make the selection contract and the two helper paths easier to follow.
Excluded unchanged files directly under emulation/ from full scans. Extended the sparse-checkout test to verify that these files are present but not selected, while explicitly changed parent files remain checked.
I think it would help to distinguish the selector policy and fixture paths in the test names:
> In .github/scripts/test-rocjitsu-formatting.py:107, name the config/workflow/helper full-scan tests around checked-out emulation files; “both complete subtrees” suggests the old two-component restriction. At line 192, name the missing-file case for its on-disk filtering, since it unlinks a file; the separate test at line 155 exercises actual sparse checkout.
At lines 16 and 19, use names such asHELPER_SCRIPTandHELPER_FIXTURE_PATHto distinguish the real executable from the path committed into the temporary repository.
> These distinctions would make the selection contract and the two helper paths easier to follow.
Updated the test names to distinguish full-scan policy from on-disk filtering.
Left an inline reply and a few new comments
Optional: It would be useful to run the Rust checks even when pre-commit fails, for example by adding if: ${{ !cancelled() }} to both Rust steps. They currently follow Run pre-commit with the default success condition, so a PR with both hook and Rust formatting failures only reveals the latter after another CI run. Reporting both would shorten that fix-and-rerun cycle.
I think it would help to qualify .github/scripts/ as “other scripts not listed below” in this note. The two formatting scripts now appear in paths, so the current example suggests they are outside the gate. Pointing readers to the list would make the documented trigger scope match the workflow.
We should also finish the PR-description update requested above. The parent-file exclusion is implemented and covered by the sparse-checkout test, but the description still omits the helper-file full-scan trigger. Please describe the policy in .github/scripts/rocjitsu_formatting.py:12-15,29-32: config, workflow, or helper changes scan tracked, present files in checked-out emulation component directories, excluding unchanged direct emulation/ files. It would also help to distinguish the ten baseline files from the selector, its tests, and the workflow changes when describing the formatting-only portion.
This pull request has been inactive for 25 days and will be marked as stale.
If you would like to keep this PR open, please:
This PR will be automatically closed in 5 days if no further activity occurs.
This pull request has been automatically closed due to inactivity (30 days with no updates).
If you'd like to continue working on this, feel free to reopen the PR or create a new one.
kuhar
hanhanW
Existing formatting failures cause unrelated edits when contributors run pre-commit during other work. Establish a clean formatting baseline for rocJitsu and Mirage and extend CI coverage to catch future drift.
The baseline cleanup covers ten component files: whitespace/end-of-file normalization, Black and Gersemi formatting, and a module comment in Mirage's otherwise empty metrics module so both end-of-file-fixer and rustfmt accept it. Python ASTs and ordered CMake ASTs are unchanged. No generated files or hook versions are changed.
The selector, its tests, the workflow, and the policy bot instructions are separate CI changes:
.github/scripts/rocjitsu_formatting.pyis shared by the workflow and 15 regression tests, without a PyYAML dependency in the helper or tests..pre-commit-config.yaml,.github/workflows/rocjitsu-formatting.yml, or.github/scripts/rocjitsu_formatting.pytrigger a full scan of tracked, present files in checked-out emulation component directories, currently rocJitsu and Mirage. Unchanged files directly underemulation/are excluded because changes confined to those files do not trigger the job. Ordinary PRs retain changed-file checks, including explicitly changed parent files when the job runs.cargo +1.88.0 fmt --all -- --checkfromemulation/mirage.Local verification:
cargo test --locked --workspace --no-run.Full runtime and GPU suites were not run. These are local verification results, not a hosted Actions run for the latest local commit.