← Back to Pull requests

Normalize rocJitsu and Mirage formatting and strengthen CI checks. #13044

Closed
hanhanW closed this pull request without merging on Nov 16, 2026 00:19 UTC
View on GitHub
hanhanW hanhanW commented on Oct 07, 2026 18:04 UTC
Author

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.py is shared by the workflow and 15 regression tests, without a PyYAML dependency in the helper or tests.

  • Changes to .pre-commit-config.yaml, .github/workflows/rocjitsu-formatting.yml, or .github/scripts/rocjitsu_formatting.py trigger a full scan of tracked, present files in checked-out emulation component directories, currently rocJitsu and Mirage. Unchanged files directly under emulation/ 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.

  • Mirage's Rust formatting check runs with Rust 1.88.0 on every formatting job invocation, including rocJitsu-only changes. Both Rust steps run after earlier failures unless the job is cancelled; failures still fail the job.

  • The policy bot's failure instructions include the pinned toolchain installation and local reproduction command: cargo +1.88.0 fmt --all -- --check from emulation/mirage.
  • Local verification:

  • 15 selector tests and 34 policy bot tests passed; actionlint passed.

  • Four local act fixtures verified clean, hook-only failure, Rustfmt-only failure, and simultaneous failures. These exercise step scheduling with formatter stubs; the actual formatter commands were verified separately.

  • The formatting workflow's command steps passed in a local sparse checkout: pre-commit checked 2,298 files, and the pinned Rustfmt check passed.

  • rocJitsu Release and GCC/UBSan builds and the Mirage Release build completed. Mirage workspace test targets compiled with Rust 1.88.0 using 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.

    Diff: 900 lines (+666 / -234) across 13 files Reviewer: kuhar Review duration: 56534m
    All Vouch review confidence checks passed
    Residual risk 0.10 = Change Risk (0.61) × (1 − Review Confidence (0.84)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.61 · 900 lines diff across 13 files
    0.61
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.73 · 5 substantive comment(s)
    0.73
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    84%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Real PR Conversation Timeline
    21 items
    therock-pr-bot[bot] therock-pr-bot[bot] commented on Oct 07, 2026 18:05 UTC
    Bot

    <!-- 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.

    🙋 Wish to Override Policy?

    therock-pr-bot[bot] therock-pr-bot[bot] commented on Oct 07, 2026 18:05 UTC
    Bot

    <!-- therock-pr-bot-fix-policies -->
    🚫 Please fix the failed policies before requesting reviews.

    The following policy checks failed:

  • ❌ PR Description
  • The Not ready to Review label has been added to this PR.
    Once all policies pass, the label will be removed automatically.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 07, 2026 18:06 UTC
    Reviewer

    <!-- 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:

  • Normalizes Python and CMake formatting without changing behavior.

  • Removes trailing whitespace and normalizes file endings.
  • | 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>

    kuhar kuhar commented on Oct 07, 2026 19:47 UTC
    Reviewer

    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.

    hanhanW hanhanW commented on Oct 07, 2026 20:52 UTC
    Author

    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.

    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 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.

    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

    kuhar kuhar commented on Oct 08, 2026 00:46 UTC
    Reviewer

    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.

    kuhar kuhar commented on code on Oct 08, 2026 00:46 UTC
    Code Review
    .github/scripts/test-rocjitsu-formatting.py:1
    @@ -0,0 +1,202 @@
    +#!/usr/bin/env python3
    +
    +# Copyright (c) 2026 Advanced Micro Devices, Inc.
    +# SPDX-License-Identifier: MIT
    +
    +"""Exercise the formatting workflow's file selection in temporary Git repos."""
    +
    +import json
    +import os
    +from pathlib import Path
    +import subprocess
    +import sys
    +import tempfile
    +import unittest
    +
    +import yaml
    +
    +WORKFLOW = Path(__file__).resolve().parents[1] / "workflows/rocjitsu-formatting.yml"
    +CONFIG_PATH = ".pre-commit-config.yaml"
    +WORKFLOW_PATH = ".github/workflows/rocjitsu-formatting.yml"
    +MIRAGE_FILE = "emulation/mirage/core/src/metric.rs"
    +ROCJITSU_FILE = "emulation/rocjitsu/tests/example.cpp"
    +
    +
    +class FormattingSelectionTest(unittest.TestCase):
    +    @classmethod
    +    def setUpClass(cls):
    +        workflow = yaml.safe_load(WORKFLOW.read_text())
    +        cls.script = next(

    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.

    kuhar kuhar commented on code on Oct 08, 2026 00:46 UTC
    Code Review
    .github/workflows/rocjitsu-formatting.yml:1
    @@ -46,24 +47,44 @@ jobs:
     
           - run: pip install pre-commit
     
    -      - name: Run pre-commit on changed files
    +      - name: Test formatting file selection
    +        run: python3 .github/scripts/test-rocjitsu-formatting.py
    +
    +      - name: Run pre-commit
    +        env:
    +          BASE_SHA: ${{ github.event.pull_request.base.sha }}
    +          HEAD_SHA: ${{ github.event.pull_request.head.sha }}
             run: |
    -          # Find the common ancestor between the PR base and head.
    -          MERGE_BASE=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
    +          python3 - <<'PY'
    +          import os
    +          from pathlib import Path
    +          import subprocess
    +
    +          # HEAD can be GitHub's merge commit; use the PR head for the diff.
    +          head = os.environ["HEAD_SHA"]
    +          base = subprocess.check_output(
    +              ["git", "merge-base", os.environ["BASE_SHA"], head], text=True
    +          ).strip()
    +          changed = subprocess.check_output(
    +              ["git", "diff", "--name-only", "--diff-filter=ACMR", "-z", base, head]
    +          )
    +          files = {os.fsdecode(path) for path in changed.split(b"\0") if path}
    +          if files & {".pre-commit-config.yaml", ".github/workflows/rocjitsu-formatting.yml"}:
    +              tracked = subprocess.check_output([
    +                  "git", "ls-files", "-z", "--", "emulation/mirage/", "emulation/rocjitsu/"

    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.

    hanhanW hanhanW commented on code on Oct 08, 2026 03:42 UTC
    Code Review
    .github/scripts/test-rocjitsu-formatting.py:1
    @@ -0,0 +1,202 @@
    +#!/usr/bin/env python3
    +
    +# Copyright (c) 2026 Advanced Micro Devices, Inc.
    +# SPDX-License-Identifier: MIT
    +
    +"""Exercise the formatting workflow's file selection in temporary Git repos."""
    +
    +import json
    +import os
    +from pathlib import Path
    +import subprocess
    +import sys
    +import tempfile
    +import unittest
    +
    +import yaml
    +
    +WORKFLOW = Path(__file__).resolve().parents[1] / "workflows/rocjitsu-formatting.yml"
    +CONFIG_PATH = ".pre-commit-config.yaml"
    +WORKFLOW_PATH = ".github/workflows/rocjitsu-formatting.yml"
    +MIRAGE_FILE = "emulation/mirage/core/src/metric.rs"
    +ROCJITSU_FILE = "emulation/rocjitsu/tests/example.cpp"
    +
    +
    +class FormattingSelectionTest(unittest.TestCase):
    +    @classmethod
    +    def setUpClass(cls):
    +        workflow = yaml.safe_load(WORKFLOW.read_text())
    +        cls.script = next(

    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.

    hanhanW hanhanW commented on code on Oct 08, 2026 03:42 UTC
    Code Review
    .github/workflows/rocjitsu-formatting.yml:1
    @@ -46,24 +47,44 @@ jobs:
     
           - run: pip install pre-commit
     
    -      - name: Run pre-commit on changed files
    +      - name: Test formatting file selection
    +        run: python3 .github/scripts/test-rocjitsu-formatting.py
    +
    +      - name: Run pre-commit
    +        env:
    +          BASE_SHA: ${{ github.event.pull_request.base.sha }}
    +          HEAD_SHA: ${{ github.event.pull_request.head.sha }}
             run: |
    -          # Find the common ancestor between the PR base and head.
    -          MERGE_BASE=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
    +          python3 - <<'PY'
    +          import os
    +          from pathlib import Path
    +          import subprocess
    +
    +          # HEAD can be GitHub's merge commit; use the PR head for the diff.
    +          head = os.environ["HEAD_SHA"]
    +          base = subprocess.check_output(
    +              ["git", "merge-base", os.environ["BASE_SHA"], head], text=True
    +          ).strip()
    +          changed = subprocess.check_output(
    +              ["git", "diff", "--name-only", "--diff-filter=ACMR", "-z", base, head]
    +          )
    +          files = {os.fsdecode(path) for path in changed.split(b"\0") if path}
    +          if files & {".pre-commit-config.yaml", ".github/workflows/rocjitsu-formatting.yml"}:
    +              tracked = subprocess.check_output([
    +                  "git", "ls-files", "-z", "--", "emulation/mirage/", "emulation/rocjitsu/"

    done.

    kuhar kuhar commented on code on Oct 09, 2026 17:04 UTC
    Code Review
    .github/scripts/rocjitsu_formatting.py:1
    @@ -0,0 +1,46 @@
    +#!/usr/bin/env python3
    +
    +# Copyright (c) 2026 Advanced Micro Devices, Inc.
    +# SPDX-License-Identifier: MIT
    +
    +"""Run pre-commit on PR changes or all checked-out emulation files."""
    +
    +import os
    +from pathlib import Path
    +import subprocess
    +
    +FORMATTING_POLICY_FILES = {
    +    ".pre-commit-config.yaml",
    +    ".github/workflows/rocjitsu-formatting.yml",
    +    ".github/scripts/rocjitsu_formatting.py",
    +}
    +
    +
    +def select_files(base_sha: str, head_sha: str) -> list[str]:
    +    # HEAD can be GitHub's merge commit; use the PR head for the diff.
    +    base = subprocess.check_output(
    +        ["git", "merge-base", base_sha, head_sha], text=True
    +    ).strip()
    +    changed = subprocess.check_output(
    +        ["git", "diff", "--name-only", "--diff-filter=ACMR", "-z", base, head_sha]
    +    )
    +    files = {os.fsdecode(path) for path in changed.split(b"\0") if path}
    +    if files & FORMATTING_POLICY_FILES:
    +        tracked = subprocess.check_output(["git", "ls-files", "-z", "--", "emulation/"])

    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.

    kuhar kuhar commented on Oct 09, 2026 17:04 UTC
    Reviewer

    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 as 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.

    hanhanW hanhanW commented on code on Oct 12, 2026 21:18 UTC
    Code Review
    .github/scripts/rocjitsu_formatting.py:1
    @@ -0,0 +1,46 @@
    +#!/usr/bin/env python3
    +
    +# Copyright (c) 2026 Advanced Micro Devices, Inc.
    +# SPDX-License-Identifier: MIT
    +
    +"""Run pre-commit on PR changes or all checked-out emulation files."""
    +
    +import os
    +from pathlib import Path
    +import subprocess
    +
    +FORMATTING_POLICY_FILES = {
    +    ".pre-commit-config.yaml",
    +    ".github/workflows/rocjitsu-formatting.yml",
    +    ".github/scripts/rocjitsu_formatting.py",
    +}
    +
    +
    +def select_files(base_sha: str, head_sha: str) -> list[str]:
    +    # HEAD can be GitHub's merge commit; use the PR head for the diff.
    +    base = subprocess.check_output(
    +        ["git", "merge-base", base_sha, head_sha], text=True
    +    ).strip()
    +    changed = subprocess.check_output(
    +        ["git", "diff", "--name-only", "--diff-filter=ACMR", "-z", base, head_sha]
    +    )
    +    files = {os.fsdecode(path) for path in changed.split(b"\0") if path}
    +    if files & FORMATTING_POLICY_FILES:
    +        tracked = subprocess.check_output(["git", "ls-files", "-z", "--", "emulation/"])

    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.

    hanhanW hanhanW commented on Oct 12, 2026 21:18 UTC
    Author

    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 as 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.

    Updated the test names to distinguish full-scan policy from on-disk filtering.

    kuhar kuhar commented on Oct 15, 2026 17:23 UTC
    Reviewer

    Left an inline reply and a few new comments

    kuhar kuhar commented on code on Oct 15, 2026 17:23 UTC
    Code Review
    .github/workflows/rocjitsu-formatting.yml:1
    @@ -46,24 +49,18 @@ jobs:
     
           - run: pip install pre-commit
     
    -      - name: Run pre-commit on changed files
    -        run: |
    -          # Find the common ancestor between the PR base and head.
    -          MERGE_BASE=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
    +      - name: Test formatting file selection
    +        run: python3 .github/scripts/test-rocjitsu-formatting.py
     
    -          # List files that were added, copied, modified, or renamed in
    -          # the PR, then keep only those present on disk. HEAD is the
    -          # pull-request merge commit in GitHub Actions, so diff against
    -          # the PR head SHA directly to avoid checking files that changed
    -          # only on the target branch.
    -          FILES=$(git diff --name-only --diff-filter=ACMR "$MERGE_BASE" ${{ github.event.pull_request.head.sha }} \
    -            | while IFS= read -r f; do if [ -f "$f" ]; then echo "$f"; fi; done)
    +      - name: Run pre-commit
    +        env:
    +          BASE_SHA: ${{ github.event.pull_request.base.sha }}
    +          HEAD_SHA: ${{ github.event.pull_request.head.sha }}
    +        run: python3 .github/scripts/rocjitsu_formatting.py
     
    -          if [ -z "$FILES" ]; then
    -            echo "No checked-in files changed in sparse checkout, skipping."
    -            exit 0
    -          fi
    +      - name: Install Rust formatter
    +        run: rustup toolchain install 1.88.0 --profile minimal --component rustfmt --no-self-update
     
    -          echo "Checking files:"
    -          echo "$FILES"
    -          pre-commit run --files $FILES
    +      - name: Check Mirage Rust formatting

    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.

    kuhar kuhar commented on code on Oct 15, 2026 17:23 UTC
    Code Review
    .github/workflows/rocjitsu-formatting.yml:1
    @@ -4,7 +4,7 @@ name: "rocjitsu-formatting"
     on:
       pull_request:
         # NOTE: Only files under these paths trigger CI formatting checks.
    -    # Shared files (e.g. .github/scripts/) are not covered — run
    +    # Other shared files (e.g. .github/scripts/) are not covered — run

    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.

    kuhar kuhar commented on code on Oct 15, 2026 17:23 UTC
    Code Review
    .github/scripts/rocjitsu_formatting.py:1
    @@ -0,0 +1,46 @@
    +#!/usr/bin/env python3
    +
    +# Copyright (c) 2026 Advanced Micro Devices, Inc.
    +# SPDX-License-Identifier: MIT
    +
    +"""Run pre-commit on PR changes or all checked-out emulation files."""
    +
    +import os
    +from pathlib import Path
    +import subprocess
    +
    +FORMATTING_POLICY_FILES = {
    +    ".pre-commit-config.yaml",
    +    ".github/workflows/rocjitsu-formatting.yml",
    +    ".github/scripts/rocjitsu_formatting.py",
    +}
    +
    +
    +def select_files(base_sha: str, head_sha: str) -> list[str]:
    +    # HEAD can be GitHub's merge commit; use the PR head for the diff.
    +    base = subprocess.check_output(
    +        ["git", "merge-base", base_sha, head_sha], text=True
    +    ).strip()
    +    changed = subprocess.check_output(
    +        ["git", "diff", "--name-only", "--diff-filter=ACMR", "-z", base, head_sha]
    +    )
    +    files = {os.fsdecode(path) for path in changed.split(b"\0") if path}
    +    if files & FORMATTING_POLICY_FILES:
    +        tracked = subprocess.check_output(["git", "ls-files", "-z", "--", "emulation/"])

    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.

    github-actions[bot] github-actions[bot] commented on Nov 11, 2026 00:16 UTC
    Bot

    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:

  • Add new commits

  • Add a comment explaining why it should remain open
  • This PR will be automatically closed in 5 days if no further activity occurs.

    github-actions[bot] github-actions[bot] commented on Nov 16, 2026 00:19 UTC
    Bot

    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.

    Reviewers
    Assignees
    hanhanW hanhanW
    Labels
    risk: low confidence: 84.3% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 60.6% (MEDIUM) · Higher = larger blast radius
    60.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 84.3% · Lower = rushed or shallow review
    84.3%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 9.5% · Safe to merge
    9.5%