Skip to content

feat(format): adopt oxfmt for devkit self-host (sc-1679) - #400

Open
norvalbv wants to merge 1 commit into
mainfrom
codex/sc-1679-oxfmt-devkit
Open

feat(format): adopt oxfmt for devkit self-host (sc-1679)#400
norvalbv wants to merge 1 commit into
mainfrom
codex/sc-1679-oxfmt-devkit

Conversation

@norvalbv

Copy link
Copy Markdown
Owner

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

## 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
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

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

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 @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: 0f867daa-39e8-45f5-8be6-07c19ec28900

📥 Commits

Reviewing files that changed from the base of the PR and between 4d624d0 and 301cbcb.

⛔ Files ignored due to path filters (3)
  • dist/README.md is excluded by !**/dist/**
  • dist/cli/lib/husky/self-host.mjs is excluded by !**/dist/**
  • dist/package.json is excluded by !**/dist/**
📒 Files selected for processing (16)
  • .github/workflows/gate.yml
  • .husky/pre-commit
  • .oxfmtrc.json
  • README.md
  • cli/__tests__/self-host.test.mts
  • cli/lib/husky/self-host.mts
  • docs/benchmarks/experiments/2026-08-16-oxfmt-devkit/README.md
  • docs/decisions/oxc-toolchain-migration.md
  • gate-engine/critique/capture-normalizer.mts
  • gate-engine/decisions/__tests__/eval-bench.test.mts
  • gate-engine/decisions/decision-format.mts
  • gate-engine/eval/render.mts
  • gate-engine/review/baseline-gate.mts
  • gate-engine/review/run-review.mts
  • gate-engine/structure/walk.mts
  • package.json

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.

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