Files
oxc-project__oxc/apps/oxfmt/src-js/cli.ts
Pablo García d35d89f78c fix(oxfmt): skip shutdown delay on fixed Node 24 releases (#26518)
Oxfmt still schedules its 50 ms forced-exit workaround on every Node 24
release, although Node 24.13.1 backported the ThreadsafeFunction fix.
Exempt fixed Node 24 releases while retaining the existing workaround
for older Node 20/22/24 versions and Node 25 before 25.4.0.

The backport is documented in [Node 24.13.1's release
notes](https://nodejs.org/en/blog/release/v24.13.1) and
[nodejs/node@1e13e84f16](https://github.com/nodejs/node/commit/1e13e84f162397f1adbe58f7a6f62974cfd0fa95).
This narrows the workaround introduced in #18980; it preserves worker
disposal and `process.exitCode` handling.

Earlier downstream validation of this same condition on Linux/Node 24.19
included ten successful checks of 12,032 synthetic files with complete
output. In eleven paired downstream Vite+ check rounds, removing the
timer saved a median of about 42 ms for full checks and 44 ms for
three-file checks. These are project-specific workflow timings, not a
universal 50 ms guarantee.

Validation on `805650e8f60e25abb8ae1038580ab799e7f8dcd9`, using the
repository's frozen pnpm 12.3.2 dependency installation and Rust 1.98.1:

- `pnpm --dir apps/oxfmt build-dev`: native and JavaScript build passed.
- `env -u NO_COLOR -u FORCE_COLOR pnpm --dir apps/oxfmt test
--maxWorkers=4`: **480 passed, 10 skipped**, using the pinned Vitest
5.0.0. This covers the complete Oxfmt JavaScript suite, including CLI,
API, LSP and the ten new regression cases. The first run had two color
snapshot mismatches caused by inherited `NO_COLOR`; clearing the ambient
color variables resolved them without changing tests or snapshots.
- `cargo test -p oxfmt --locked`: **84 passed**.
- `cargo clippy -p oxfmt --all-targets --locked -- -D warnings`: passed.
- Changed-file formatting and repository-configured type-aware
Oxlint/type checks: passed with the pinned tools.

Additional checks exercised the freshly built native CLI on **real Node
24.13.1 and 24.19.0**: five successful runs per runtime over 12,032
synthetic JS/Markdown files, including worker callbacks; no 50 ms timers
were registered. Both runtimes preserved all 497,780 bytes of a large
stdin-formatting result and the expected parse-error exit code 2. These
are correctness/stress checks of the dev build, not performance
benchmarks.

The entire Oxc workspace's other packages and the cross-platform CI
matrix were not run locally.

The follow-up commit `1c98d210501e276c2d6e3009562b2ebe41217ab3` removes
the ten mocked shutdown regression cases at the maintainer's request.
Its only change is deleting that test file; the production CLI is
byte-for-byte unchanged from the fully validated revision above. The
final PR changes only `apps/oxfmt/src-js/cli.ts`. The suite counts above
describe the earlier run, including the subsequently removed tests; no
new full-suite run is claimed for the deletion-only follow-up.

AI assistance: implementation and self-review performed with OpenAI
Codex using GPT-6 Astra (`gpt-6-astra`), with reasoning effort set to
`high`.
2026-09-10 16:45:24 +09:00

3.6 KiB