Skip to content

fix(oxc): keep format failures in the inspector - #659

Open
SaKaNa-Y wants to merge 2 commits into
vitejs:mainfrom
SaKaNa-Y:fix/oxc-format-error-recovery
Open

SaKaNa-Y wants to merge 2 commits into
vitejs:mainfrom
SaKaNa-Y:fix/oxc-format-error-recovery

Conversation

@SaKaNa-Y

@SaKaNa-Y SaKaNa-Y commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

When Oxfmt finds a syntax error during Run Format, the Oxc error screen replaces the entire panel. The fix keeps the diagnostic in the dialog so users can open previous results, correct the file, and retry. If users dismiss the dialog before the run fails, the diagnostic appears above the format history.

- Oxfmt command fails → RPC rejects → Oxc replaces the panel with its error screen
+ Oxfmt command fails → RPC returns the diagnostic → Format shows it where the user can retry

Evidence

  • Before: In Chromium, running Check on invalid JavaScript removed the Oxc navigation and the Run Format button.
    After: On 7e6fbc5b, Check and Write both showed Unexpected token at example.js:1:18. The previous result stayed accessible. After correcting the file, Check passed in the same document.
  • RPC contract: Six command-failure cases failed on the previous revision with the new expectations. All 17 Run Format tests pass on this revision. When a real Write succeeded and saving history failed, Chromium showed ENOTDIR and the file on disk contained the formatted source.
  • Dismiss and disconnect: On the earlier revision fb9bb3c5, a late Write failure left a new Check dialog open. A late Check success preserved a new Write selection. Stopping Vite showed the connection screen.

Merge Danger

Door: Two-way. A revert restores the previous RPC contract. The format history needs no migration.

Blast Radius: Oxc and direct callers of devtools-oxc:run-format. Run Format is the only direct caller in this repository. Direct callers must check result.error for formatter failures and handle rejected calls for storage or connection failures.

Change Risk: Medium. Write can change a file before its history entry is saved. The RPC still rejects a storage failure, so the inspector can show that error after the file changes.

Return formatter command errors to the Run Format dialog when requested. Keep the diagnostic beside the history if the user dismisses the dialog, and keep a late result associated with its original run.

Preserve the existing RPC rejection for default callers and for history storage failures after Oxfmt has finished.
@pkg-pr-new

pkg-pr-new Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

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

@vitejs/devtools-kit

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

@vitejs/devtools-oxc

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

@vitejs/devtools-rolldown

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

@vitejs/devtools-vite

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

@vitejs/devtools-vite-task

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

@vitejs/devtools-vitest

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

commit: 7e6fbc5

Run Format has one in-tree UI caller. Use the same command result for every caller and keep history storage failures on the RPC rejection path.

BREAKING CHANGE: Callers of devtools-oxc:run-format must inspect result.error for formatter command failures. Handle RPC rejection for storage or transport failures.
@SaKaNa-Y SaKaNa-Y changed the title fix(oxc): keep format failures in the inspector fix(oxc)!: keep format failures in the inspector Dec 5, 2026
@SaKaNa-Y
SaKaNa-Y marked this pull request as ready for review December 5, 2026 07:19
@SaKaNa-Y SaKaNa-Y changed the title fix(oxc)!: keep format failures in the inspector fix(oxc): keep format failures in the inspector Dec 5, 2026
@SaKaNa-Y
SaKaNa-Y requested a review from yuyinws December 5, 2026 07:24
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