Skip to content

Conversation

@ShaharNaveh
Copy link
Collaborator

@ShaharNaveh ShaharNaveh commented Nov 15, 2025

closes #6272

Summary by CodeRabbit

  • Chores

    • Consolidated PR formatting into CI: new formatting gate runs on PRs, auto-formats code, comments when changes are made, and blocks downstream jobs until resolved.
    • Removed the prior standalone PR auto-format workflow; formatting is now handled in the main pipeline.
    • Job gating now respects cancellations and explicit skip labels for more predictable checks.
  • Style

    • Minor non-functional code formatting adjustments with no behavior changes.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 15, 2025

Walkthrough

Consolidates PR auto-formatting into an auto_format_pr job in .github/workflows/ci.yaml, removes the standalone .github/workflows/pr-auto-commit.yaml, and updates multiple CI jobs to depend on the new formatting gate while changing skip checks to be cancellation-aware plus skip:ci.

Changes

Cohort / File(s) Summary
CI pipeline — integrated auto-format job
​.github/workflows/ci.yaml
Adds auto_format_pr job that checks out the PR branch, installs rustfmt, runs cargo fmt, commits/pushes formatting changes when detected, comments on the PR, and exits after pushing. Updates several jobs to needs: auto_format_pr and replaces simple skip checks with !cancelled() && !contains(labels, 'skip:ci').
Removed standalone workflow
​.github/workflows/pr-auto-commit.yaml
Deleted the prior PR auto-commit workflow that previously ran cargo fmt, committed/pushed changes, and commented on the PR.
Minor formatting change
crates/vm/src/stdlib/ast/other.rs
Non-functional styling/formatting adjustments (line wraps/indentation) with no logic changes.

Sequence Diagram(s)

sequenceDiagram
    participant PR as Pull Request
    participant Auto as auto_format_pr (ci.yaml)
    participant CI as Dependent CI Jobs

    PR->>Auto: PR event triggers job
    activate Auto
    Auto->>Auto: checkout PR branch\ninstall rustfmt\nrun cargo fmt
    Note over Auto: Detect formatting diffs
    alt Formatting changes detected
        Auto->>PR: git commit & push formatted changes
        Auto->>PR: post PR comment instructing to pull latest changes
        Auto-x Auto: exit (fails to signal author to sync)
    else No formatting changes
        Auto-->>Auto: complete successfully
    end
    deactivate Auto

    Note right of CI: Jobs now have needs: auto_format_pr\nand condition: !cancelled() && !contains(labels,'skip:ci')
    Auto->>CI: unblocks dependent jobs or triggers re-run if branch changed
    activate CI
    CI->>CI: run tests/lint/etc.
    deactivate CI
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Verify auto_format_pr job steps: checkout, rustfmt install, cargo fmt, git config, commit/push, and PR-comment content.
  • Confirm each updated job (rust_tests, exotic_targets, snippets_cpython, lint, miri, wasm, wasm-wasi) includes needs: auto_format_pr and the new conditional !cancelled() && !contains(labels, 'skip:ci').
  • Check removal of .github/workflows/pr-auto-commit.yaml and ensure no remaining references.
  • Review crates/vm/src/stdlib/ast/other.rs for unintentional semantic changes (quick scan; formatting-only).

Possibly related PRs

Suggested labels

skip:ci

Poem

🐇 I hopped through files with a whiskered grin,
Ran rustfmt softly to tidy within.
I pushed neat lines and left a small note,
Now CI waits kindly for authors to quote.
🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Auto-format before checks' accurately captures the main change: moving auto-formatting to run before other CI checks to resolve the timeout issues.
Linked Issues check ✅ Passed The PR successfully implements approach #2 from issue #6272: ensuring auto-format runs before CI jobs by adding it as a gating job that subsequent tests depend on.
Out of Scope Changes check ✅ Passed Changes in ast/other.rs are minor formatting-only and directly result from the new cargo fmt job running in this PR; all changes align with resolving the CI auto-format timeout issue.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65549b2 and a577106.

📒 Files selected for processing (1)
  • crates/vm/src/stdlib/ast/other.rs (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • crates/vm/src/stdlib/ast/other.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Run snippets and cpython tests (windows-latest)
  • GitHub Check: Run snippets and cpython tests (ubuntu-latest)
  • GitHub Check: Check the WASM package and demo
  • GitHub Check: Run snippets and cpython tests (macos-latest)
  • GitHub Check: Run tests under miri
  • GitHub Check: Run snippets and cpython tests on wasm-wasi
  • GitHub Check: Run rust tests (windows-latest)
  • GitHub Check: Run rust tests (macos-latest)
  • GitHub Check: Run rust tests (ubuntu-latest)
  • GitHub Check: Ensure compilation on various targets
  • GitHub Check: auto_format

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/ci.yaml (1)

381-384: Add consistent conditional guards to lint job.

The lint job has needs: auto_format_pr but lacks the if: ${{ !cancelled() && !contains(...) }} conditional that other downstream jobs (rust_tests, exotic_targets, snippets_cpython, miri, wasm, wasm-wasi) include. This inconsistency could cause the lint job to run in scenarios where other jobs are skipped due to label-based filtering.

Apply this diff to add the conditional:

  lint:
    name: Check Rust code with clippy
+   if: ${{ !cancelled() && !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
    needs:
      - auto_format_pr
    runs-on: ubuntu-latest
📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 041dd30 and df498ad.

📒 Files selected for processing (2)
  • .github/workflows/ci.yaml (7 hunks)
  • .github/workflows/pr-auto-commit.yaml (0 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/pr-auto-commit.yaml
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ShaharNaveh
Repo: RustPython/RustPython PR: 5932
File: .github/workflows/comment-commands.yml:18-24
Timestamp: 2025-07-10T10:08:43.330Z
Learning: In GitHub Actions workflows for the RustPython project, the maintainer ShaharNaveh prefers to keep workflows simple and doesn't mind if steps fail when the desired state is already achieved (e.g., user already assigned to an issue). Avoid suggesting complex error handling for edge cases they don't consider problematic.
📚 Learning: 2025-07-10T10:08:43.330Z
Learnt from: ShaharNaveh
Repo: RustPython/RustPython PR: 5932
File: .github/workflows/comment-commands.yml:18-24
Timestamp: 2025-07-10T10:08:43.330Z
Learning: In GitHub Actions workflows for the RustPython project, the maintainer ShaharNaveh prefers to keep workflows simple and doesn't mind if steps fail when the desired state is already achieved (e.g., user already assigned to an issue). Avoid suggesting complex error handling for edge cases they don't consider problematic.

Applied to files:

  • .github/workflows/ci.yaml
🪛 actionlint (1.7.8)
.github/workflows/ci.yaml

148-148: property "git_commit" is not defined in object type {git-commit: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


167-167: "github.event.pull_request.head.ref" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/reference/security/secure-use#good-practices-for-mitigating-script-injection-attacks for more details

(expression)


174-174: property "git_commit" is not defined in object type {git-commit: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: Run snippets and cpython tests on wasm-wasi
  • GitHub Check: Check the WASM package and demo
  • GitHub Check: Run snippets and cpython tests (ubuntu-latest)
  • GitHub Check: Run tests under miri
  • GitHub Check: Run snippets and cpython tests (macos-latest)
  • GitHub Check: Run snippets and cpython tests (windows-latest)
  • GitHub Check: Check Rust code with clippy
  • GitHub Check: Run rust tests (windows-latest)
  • GitHub Check: Run rust tests (ubuntu-latest)
  • GitHub Check: Run rust tests (macos-latest)
  • GitHub Check: Ensure compilation on various targets
  • GitHub Check: auto_format

@youknowone
Copy link
Member

@ShaharNaveh could you test this workflow with a mal-formatted commit?

@ShaharNaveh
Copy link
Collaborator Author

The main issue I encounter ATM is the fact that github actions prevents you from doing recursive calls to the workflow. I can't get the checks to trigger after the auto-format commit

@youknowone
Copy link
Member

#6295 replaced it. Thank you for the work!

@youknowone youknowone closed this Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI AutoFormat fails when CI is under load.

2 participants