Skip to content

ci: make the tree rustfmt-clean and gate on it - #4

Merged
Steel-tech merged 3 commits into
mainfrom
ci/rustfmt-gate
Aug 8, 2026
Merged

ci: make the tree rustfmt-clean and gate on it#4
Steel-tech merged 3 commits into
mainfrom
ci/rustfmt-gate

Conversation

@Steel-tech

@Steel-tech Steel-tech commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Closes the one deliberate gap left by the CI work: formatting was unenforced because the tree was not rustfmt-clean.

Why now, and why not a config

Before reformatting, I tested whether a rustfmt.toml could be tuned to match the existing hand-formatted style instead. It cannot:

Config Differing hunks
defaults (baseline) 93
max_width = 110 91
max_width = 120 111
use_small_heuristics = "Max" 156–247

Nothing approaches zero. The tree is formatted case-by-case — sometimes more broken up than rustfmt wants, sometimes less — which no single config reproduces. That left a binary choice, and enforcing the standard formatter is the one that stops the drift.

Two commits, deliberately

style: apply cargo fmt across the workspace is pure cargo fmt --all output with no hand edits, so it can be skimmed as "rustfmt did this" rather than reviewed line by line. ci: gate on cargo fmt --check adds the job. Reviewing them separately is much cheaper than reviewing the squashed diff.

Verification

  • cargo fmt --all --check clean, and idempotent (a second run is a no-op)
  • 91 tests pass, unchanged
  • cargo clippy --all-targets -- -D warnings still silent
  • The new fmt job passes locally before being pushed

The fmt job skips rust-cache on purpose: rustfmt parses sources and never builds, so there is nothing to restore and the cache round-trip would cost more than the job.

Post-Deploy Monitoring & Validation

Expect four green jobs (test ×2, fmt, clippy). The fmt job should be among the fastest since it does no compilation. Going forward, a red fmt means someone committed unformatted code — the fix is always cargo fmt --all, never editing the job. rustfmt ships in the pinned toolchain, so contributors already have the matching version.

No runtime or production impact — formatting and CI configuration only.


Compound Engineering
Claude Code

Summary by CodeRabbit

  • Chores
    • Added an automated formatting check to continuous integration.
    • Applied consistent Rust formatting across authentication, CLI, sandbox, storage, tool, and language-model components.
    • Improved readability of expressions, function signatures, assertions, test fixtures, and chained calls without changing functionality or public interfaces.

Steel-tech and others added 2 commits August 7, 2026 23:20
Purely mechanical: `cargo fmt --all` with default settings, no hand edits.
Verified idempotent (a second run is a no-op), and 91 tests plus clippy
--all-targets -D warnings are unchanged after it.

Separated from the CI gate that follows so this diff can be skimmed as
"rustfmt output" rather than reviewed line by line.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PfAfAujueuZ3rDTiL9apx3
Now that the tree is rustfmt-clean, enforce it. Without a gate, formatting
drifts silently and every contributor's format-on-save produces diff noise
unrelated to their change.

Skips rust-cache deliberately: rustfmt parses sources and never builds, so
there is nothing to restore and the cache round-trip would cost more than
the job.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PfAfAujueuZ3rDTiL9apx3
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Steel-tech, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a826fa1-5cfd-4e8e-84a1-5175f7b2d934

📥 Commits

Reviewing files that changed from the base of the PR and between 4c17fdb and b50ee68.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml
📝 Walkthrough

Walkthrough

This pull request adds a GitHub Actions formatting check and applies cargo fmt formatting across Rust source files and tests. No runtime behavior or public API changes are reported.

Changes

Rust formatting

Layer / File(s) Summary
CI formatting check
.github/workflows/ci.yml
Adds an Ubuntu job that installs the pinned Rust toolchain and runs cargo fmt --all --check.
Application crate formatting
crates/agent/..., crates/auth/..., crates/cli/..., crates/harness/...
Reformats signatures, expressions, patterns, assertions, fixtures, and test calls without changing behavior.
LLM, sandbox, and storage formatting
crates/llm/..., crates/sandbox/..., crates/store/...
Reformats parsing, sandbox, storage, recovery, and test code without changing behavior.
Tool crate formatting
crates/tools/...
Reformats Bash, filesystem, registry, search, and test code without changing behavior.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • StructuPath/bullpen#2: Introduces the existing CI workflow and pinned-toolchain setup extended by this formatting job.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 79.37% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 clearly summarizes both the rustfmt cleanup and the new CI gate, which are the main changes in the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/rustfmt-gate

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 48-54: Restrict the fmt job’s GITHUB_TOKEN permissions by adding a
job-level permissions block granting only read access to repository contents.
Keep the existing checkout configuration unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5746b3d3-f038-49cd-80ea-88b6bccf6303

📥 Commits

Reviewing files that changed from the base of the PR and between d03ec60 and 4c17fdb.

📒 Files selected for processing (21)
  • .github/workflows/ci.yml
  • crates/agent/src/lib.rs
  • crates/auth/src/codex.rs
  • crates/auth/src/lib.rs
  • crates/auth/src/openrouter.rs
  • crates/auth/src/pkce.rs
  • crates/cli/src/agents.rs
  • crates/cli/src/main.rs
  • crates/harness/src/lib.rs
  • crates/harness/src/pen.rs
  • crates/llm/src/anthropic.rs
  • crates/llm/src/chatcompletions.rs
  • crates/llm/src/codex.rs
  • crates/llm/src/lib.rs
  • crates/sandbox/src/lib.rs
  • crates/store/src/lib.rs
  • crates/store/src/recovery.rs
  • crates/tools/src/bash.rs
  • crates/tools/src/fs.rs
  • crates/tools/src/lib.rs
  • crates/tools/src/search.rs

Comment thread .github/workflows/ci.yml
Without a permissions block, every job inherits the repository default. That
default is currently read, but it is a repo setting anyone can widen, and the
workflow would silently follow it.

Declared at workflow level rather than per-job so a job added later cannot
quietly inherit something broader. CI only ever reads the repo.

Found by zizmor (excessive-permissions) via CodeRabbit, which flagged the new
fmt job; test and clippy had the same gap.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PfAfAujueuZ3rDTiL9apx3
@Steel-tech
Steel-tech merged commit 601bb64 into main Aug 8, 2026
5 checks passed
@Steel-tech
Steel-tech deleted the ci/rustfmt-gate branch August 8, 2026 06:26
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.

1 participant