feat(format): adopt oxfmt for devkit self-host (sc-1679) - #400
Conversation
## Summary - adopt pinned Oxfmt 0.63.0 for Devkit's exact root formatting scope and CI format verdict - use the direct pinned Oxfmt binary in Devkit's self-host staged hook, with one thread and an exact authored-path allowlist - keep Biome 2.5.6 as the lint/assist owner and retain Biome in every generic package/standalone consumer hook - commit the seven reviewed one-time formatter changes and the reproducible decision evidence ## Ownership boundary This is intentionally a Devkit-only migration. `format` and `format:check` now select the same authored surface proven in the experiment; CI runs `format:check` before formatter-disabled Biome lint. The self-host hook mirrors that allowlist, includes `.mts`, fails closed on Oxfmt errors, and never selects benchmark evidence, vendored sources, generated output, or generic consumer files. Direct execution tests prove that: - an in-scope staged `.mts` file is formatted and re-staged - staged benchmark evidence remains byte-identical - a partially staged file is preserved according to the index/worktree state observed at hook start - a failing Oxfmt process blocks the hook - source, generated dist, doctor output, and committed-hook parity agree Concurrent writers to the same worktree remain unsupported; agents must use isolated worktrees. ## Output parity Biome reported 558 files and the shadow Oxfmt invocation selected the same 558 files. The committed `.oxfmtrc.json` adds itself as the 559th managed file after adoption. Seven TypeScript files changed: six whitespace/layout-only; one expanded test call also gained the formatter's permitted trailing comma. Identifiers, strings, operators, imports, comments, and control flow are unchanged. A second full write was byte-idempotent. ## Benchmark | Full-scope runner | Median wall | Median CPU | Median tree RSS | | --- | ---: | ---: | ---: | | Biome direct | 0.1997 s | 0.8709 s | 143.7 MiB | | Oxfmt direct, default threads | 0.1242 s | 0.2382 s | 109.1 MiB | | Delta | -37.8% | -72.6% | -24.1% | The one-file check-mode proxy measured direct Oxfmt at 8.1% less CPU but higher wall/RSS than Biome. It is recorded as startup characterization, not an exact write-mode hook speedup. The same proxy shows the portable `devkit oxc fmt` wrapper adds 211.8% CPU and 245.3% RSS versus Biome, so the hot self-host path uses the pinned binary directly. Method: Node 24.19.0, 3 discarded warm-ups, 10 alternating paired samples, monotonic wall clock, wait4 CPU, and complete process-tree RSS sampling. ## Validation - `bun run format:check` - `bun run lint` - `bun run typecheck` - `bun run lint:structure` - `bun run build` - 190 focused self-host, apply-init, hook-block, drift, doctor, and dist tests passed - full suite: 3,820 passed / 5 skipped; one unchanged parallel timing assertion failed under load and passed isolated - benchmark and decision checks - second-pass formatter idempotence - GitNexus staged analysis: HIGH because the self-host/doctor seam and seven indexed functions are touched; all affected flows were impact-reviewed and covered by focused tests Shortcut: sc-1679
|
Warning Review limit reached
Next review available in: 43 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (16)
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. Comment |
Summary
Ownership boundary
This is intentionally a Devkit-only migration.
formatandformat:checknow select the same authored surface proven in the experiment; CI runsformat:checkbefore formatter-disabled Biome lint. The self-host hook mirrors that allowlist, includes.mts, fails closed on Oxfmt errors, and never selects benchmark evidence, vendored sources, generated output, or generic consumer files.Direct execution tests prove that:
.mtsfile is formatted and re-stagedConcurrent writers to the same worktree remain unsupported; agents must use isolated worktrees.
Output parity
Biome reported 558 files and the shadow Oxfmt invocation selected the same 558 files. The committed
.oxfmtrc.jsonadds itself as the 559th managed file after adoption. Seven TypeScript files changed: six whitespace/layout-only; one expanded test call also gained the formatter's permitted trailing comma. Identifiers, strings, operators, imports, comments, and control flow are unchanged. A second full write was byte-idempotent.Benchmark
The one-file check-mode proxy measured direct Oxfmt at 8.1% less CPU but higher wall/RSS than Biome. It is recorded as startup characterization, not an exact write-mode hook speedup. The same proxy shows the portable
devkit oxc fmtwrapper adds 211.8% CPU and 245.3% RSS versus Biome, so the hot self-host path uses the pinned binary directly.Method: Node 24.19.0, 3 discarded warm-ups, 10 alternating paired samples, monotonic wall clock, wait4 CPU, and complete process-tree RSS sampling.
Validation
bun run format:checkbun run lintbun run typecheckbun run lint:structurebun run buildShortcut: sc-1679