Skip to content

fix(oxc): preserve successful formatting with stderr notices - #594

Draft
SaKaNa-Y wants to merge 1 commit into
vitejs:mainfrom
SaKaNa-Y:fix/oxfmt-success-stderr
Draft

SaKaNa-Y wants to merge 1 commit into
vitejs:mainfrom
SaKaNa-Y:fix/oxfmt-success-stderr

Conversation

@SaKaNa-Y

Copy link
Copy Markdown
Collaborator

Important

Please take a moment to read this. Thank you!

I should include a brief explanation of the problem in my own words in every PR. If that explanation is missing, please @mention me and do not merge this PR until I have added it. You may also leave this PR unaddressed (because this means I have not fulfilled my responsibilities as the author).

If my explanation is unclear or difficult to follow, please ask me to clarify or provide reproduction steps or supporting evidence.

I welcome suggestions and counterarguments, especially questions about anything I may have overlooked. (Your feedback helps me learn and improve. 🙏)

I hold myself to this standard for every PR, regardless of its size.

Summary

When I run Format Inspector without an Oxfmt config, Oxfmt 0.70.0 prints a defaults notice to stderr. A clean check or successful write exits with code 0, but DevTools throws OXDT0007 and discards the result. In write mode, the file has already been formatted even though the UI reports failure.

Classify the command result using its exit code and parsed status before saving it. Successful runs and check-mode formatting findings are saved even when stderr contains a notice. Execution failures still produce OXDT0007, using stderr or an exit-code fallback when stderr is empty.

- nonempty stderr -> failure
+ exit 0 -> save result
+ exit 1 with check findings -> save result
+ other exits -> failure

Evidence

  • With real Oxfmt 0.70.0 and no config, the unchanged upstream handler rejects clean checks, checks with formatting findings, and successful writes. The patched handler saves all three results; write mode also produces the expected file contents.
  • Browser verification against the rebuilt package: no-config write saves a Formatted result, and a clean check saves a Passed result.
  • Regression tests: 6 fail against the original handler; all 16 pass after the fix. Coverage includes notices, formatting findings, execution errors, missing exit codes, and process startup failures.
  • pnpm lint, pnpm build --force, and pnpm test --run pass (351 tests passed, 2 skipped).
  • pnpm typecheck reports 8 existing Vite plugin type errors in the Oxc, Rolldown, and Vite RPC modules. Re-running with both changed files restored to the upstream baseline produces identical errors.

Merge Danger

Door: Two-way. No persisted result schema changes.

Blast Radius: Oxfmt. Changes command-result classification in Format Inspector.

@pkg-pr-new

pkg-pr-new Bot commented Sep 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@594

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@594

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@594

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@594

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@594

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@594

commit: d2f1821

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