Repository navigation
ci: fail the static job on unformatted files - #30863
Conversation
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.
ad410da to
41df2e9
Compare
|
The format check was exercised on throwaway head ad410dabe6678c0e6a5433860607ed0bdcaa10f9. That commit added an unformatted The probe commit has since been dropped. The head is now 41df2e9. |
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to
|
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).
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d564ffe5-a1cc-43c5-9fb8-1c1ec4ff8f61
📒 Files selected for processing: 7
.github/workflows/pr.ymlconfig/scripts/pr-auxiliary-preflight-admission.test.mjsconfig/scripts/pr-code-change-scope-format-route.test.mjsconfig/scripts/pr-code-change-scope.mjsconfig/scripts/pr-code-change-scope.test.mjsconfig/scripts/pr-preflight-gates.test.mjspackage.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.
| const FORMAT_CHECKED_EXTENSION = | ||
| /\.(?:[cm]?[jt]sx?|json[c5]?|css|less|scss|md|mdx|ya?ml|vue|html|graphql|gql|toml)$/i |
There was a problem hiding this comment.
🎯 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)
#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.
…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]>
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.
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
oxfmt --check. Formatting was enforced only by the skippable pre-commit hook.oxfmt --check ., the read-only twin ofpnpm format(oxfmt --write .). An unformatted file fails the job, and the aggregate "PR checks passed" gate with it.*.md,*.mdx,*.ymland*.yaml.oxfmt .already formats those types (it's howpnpm formattreats them), so without this the hook would let through files that CI then rejects.pr-code-change-scope.mjsnow turns on static analysis (but not typecheck or unit tests) for any changed file oxfmt formats, unless it falls under.oxfmtrc.json'sdir/**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.jsonso it can read those patterns. If the file can't be read, nothing is treated as ignored and the check still runs.oxfmt --writenow passes--no-error-on-unmatched-pattern. Without it, a commit that stages only files oxfmt skips (such aspnpm-lock.yaml) would fail the hook.pr-preflight-gates.test.mjskeeps the CI command in step with theformatscript and lists the new step.pr-code-change-scope-format-route.test.mjscovers the routing and the sparse checkout.Why
verifyaggregate's failure handling is untouched. The step runs under the samestatic_analysiscondition as its neighbours.pnpm exec oxfmt --check .passes on current main, so no files needed reformatting..gitignore. The only tracked Markdown files that aren't formatted are eight files force-added under the git-ignoreddocs/**(docs/relay-region-correction/*,docs/automated-setup-tab-design.md, and others). Neitherpnpm formatnor this check sees those files, so I left them alone rather than widen the check beyond whatpnpm formatwrites.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.config/scriptspass locally.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.Review
Agent skill upstream boundary
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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)