Skip to content

ci: fail the static job on unformatted files - #30863

Merged
nwparker merged 3 commits into
mainfrom
nwparker/ci-format-check
Oct 19, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/ci-format-check

Conversation

@nwparker

@nwparker nwparker commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​44 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​38
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​37 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​33

ELI5

CI now fails a pull request whose code isn't formatted. Until now only the local pre-commit hook formatted files, and anyone who skipped the hook (or committed from a tool that bypasses it) could land unformatted files on main. Ten did, and #30828 had to clean them up.

What Changed

  • Before: no CI workflow ran oxfmt --check. Formatting was enforced only by the skippable pre-commit hook.
  • After: the existing "static analysis and typecheck" job runs oxfmt --check ., the read-only twin of pnpm format (oxfmt --write .). An unformatted file fails the job, and the aggregate "PR checks passed" gate with it.
  • The pre-commit hook now also formats *.md, *.mdx, *.yml and *.yaml. oxfmt . already formats those types (it's how pnpm format treats them), so without this the hook would let through files that CI then rejects.
  • Routing: a PR that changes only docs or workflows used to skip the static job, so the check would have missed exactly the files that a full-tree check then fails on every later PR. pr-code-change-scope.mjs now turns on static analysis (but not typecheck or unit tests) for any changed file oxfmt formats, unless it falls under .oxfmtrc.json's dir/** ignore patterns. The mobile-only route already works this way, for the same reason (refactor(mobile): send the dictation, terminal, notification and browser domains through typed RpcOperations #20702). The path-detection job's sparse checkout now includes .oxfmtrc.json so it can read those patterns. If the file can't be read, nothing is treated as ignored and the check still runs.
  • The hook's oxfmt --write now passes --no-error-on-unmatched-pattern. Without it, a commit that stages only files oxfmt skips (such as pnpm-lock.yaml) would fail the hook.
  • Tests:
    • pr-preflight-gates.test.mjs keeps the CI command in step with the format script and lists the new step.
    • The new pr-code-change-scope-format-route.test.mjs covers the routing and the sparse checkout.
    • Three existing expectations are updated: README-only and workflow-only diffs now select static analysis.

Why

  • A step, not a new job: this keeps the set of required check names unique and unchanged, and the verify aggregate's failure handling is untouched. The step runs under the same static_analysis condition as its neighbours.
  • The full tree, not only changed files: it measured 1.3–2.0s locally across 36,343 files, on 16 threads. That's cheaper than computing a changed-file list, and it also catches drift that arrives through a merge.
  • Main is already clean: pnpm exec oxfmt --check . passes on current main, so no files needed reformatting.
  • Markdown: oxfmt's tree walk honours .gitignore. The only tracked Markdown files that aren't formatted are eight files force-added under the git-ignored docs/** (docs/relay-region-correction/*, docs/automated-setup-tab-design.md, and others). Neither pnpm format nor this check sees those files, so I left them alone rather than widen the check beyond what pnpm format writes.
  • Cost of the routing: a docs-only or workflow-only PR now runs the static job, a few minutes of runner time. The cheaper alternatives were to leave those paths unchecked, which lets drift land and break other PRs, or to install oxfmt in the path-detection job, which adds a separate tool install outside the locked dependencies. The repo already accepted the same trade-off for mobile-only PRs.

Linked Issue

N/A. This is a CI follow-up to #30828.

Visual Proof

N/A. This is a CI-only change.

Testing

  • pnpm exec oxfmt --check . on main: clean, 1.3–2.0s.
  • The routing and gate test suites in config/scripts pass locally.
  • The full static-analysis job's steps also pass locally, including typecheck and every ratchet.
  • Exercising the check in this PR: a throwaway commit added an unformatted src/shared/zz-format-ci-probe.ts. The CI run on that head (linked in a comment below) failed at "Check formatting", and the commit was then dropped.
  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

The change is CI and hook configuration only. It has no runtime, SSH, mobile or cross-platform effect: oxfmt is a cross-platform binary that is already a devDependency.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Runs oxfmt --check over the same tree pnpm format writes (~2s), and makes the
pre-commit hook format markdown and YAML so it covers what CI now checks.
@nwparker
nwparker force-pushed the nwparker/ci-format-check branch from ad410da to 41df2e9 Compare October 19, 2026 20:43
@nwparker

Copy link
Copy Markdown
Contributor Author

The format check was exercised on throwaway head ad410dabe6678c0e6a5433860607ed0bdcaa10f9. That commit added an unformatted src/shared/zz-format-ci-probe.ts. The "static analysis and typecheck" job failed at Check formatting (run 39320936550, job 118294679315), and it flagged that file and nothing else:

src/shared/zz-format-ci-probe.ts (0ms)
Format issues found in above 1 files. Run without `--check` to fix.
Finished in 3694ms on 36347 files using 8 threads.

The probe commit has since been dropped. The head is now 41df2e9.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The change updates PR path classification so supported formatter paths can select static analysis, except for configured ignored directories. The preflight runs oxfmt --check . when static analysis is selected. The workflow sparse checkout includes .oxfmtrc.json. The staged formatting configuration adds MDX, YAML, and YML files and uses --no-error-on-unmatched-pattern. Tests cover path routing and formatting checks.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to e2b24

Unformatted Markdown files can merge and cause formatting checks on later PRs to fail. Add .markdown to the routing rule before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 5 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the primary change: making the static CI job fail when files are unformatted.
Description check Passed The description is detailed and covers the required change, rationale, routing behavior, testing, visual proof, review notes, and checklist. It does not provide an actual linked issue, but it explains…
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.
Full details: Description check

Explanation

The description is detailed and covers the required change, rationale, routing behavior, testing, visual proof, review notes, and checklist. It does not provide an actual linked issue, but it explains that this is a CI follow-up to #30828, so the description is otherwise mostly complete.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 5 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

nwparker and others added 2 commits October 19, 2026 13:51
The format check reads the whole tree, so a diff that skipped the static job
could land drift that fails every later PR. Any changed file oxfmt formats now
selects static analysis (not typecheck or units), like the mobile-only route.
The path detector checks out .oxfmtrc.json for its ignores. The hook no longer
fails a commit whose only matches oxfmt ignores (lockfiles).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d564ffe5-a1cc-43c5-9fb8-1c1ec4ff8f61
📥 Commits

Reviewing files that changed from the base of the PR and between 41df2e9 and e2b248f.

📒 Files selected for processing: 7
  • .github/workflows/pr.yml
  • config/scripts/pr-auxiliary-preflight-admission.test.mjs
  • config/scripts/pr-code-change-scope-format-route.test.mjs
  • config/scripts/pr-code-change-scope.mjs
  • config/scripts/pr-code-change-scope.test.mjs
  • config/scripts/pr-preflight-gates.test.mjs
  • package.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Comment on lines +449 to +450
const FORMAT_CHECKED_EXTENSION =
/\.(?:[cm]?[jt]sx?|json[c5]?|css|less|scss|md|mdx|ya?ml|vue|html|graphql|gql|toml)$/i

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Route .markdown files to static analysis.

If a PR changes only docs/readme/guide.markdown, shouldRunPrChecks is false and this regex does not select static_analysis. Oxfmt does format .markdown, so unformatted content can merge without a check and fail the whole-tree check on later PRs. Add .markdown to the predicate and test a docs-only path. (oxc.rs)

@nwparker
nwparker merged commit 92eb979 into main Oct 19, 2026
95 of 97 checks passed
Jinwoo-H pushed a commit that referenced this pull request Oct 19, 2026
#30863 made the static job fail on unformatted files; 22 files that landed
around it were never run through oxfmt. Formatter output only, plus one
shared paneActive local in NativeChatStructuredSession.tsx so formatting
does not push that file past max-lines.
Jinwoo-H added a commit that referenced this pull request Oct 19, 2026
…30929)

#30863 made the static job fail on unformatted files; 22 files that landed
around it were never run through oxfmt. Formatter output only, plus one
shared paneActive local in NativeChatStructuredSession.tsx so formatting
does not push that file past max-lines.

Co-authored-by: E2E Test <[email protected]>
nwparker added a commit that referenced this pull request Oct 20, 2026
Its CI ran before #30863 added the check. Formatting pushed wsl-orcad-connection.ts past its line
limit, so its port-fallback listen moves next to the stdio bridge it wraps.
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