Skip to content

fix(migrate): protect Oxc references and recover interrupted migrations - #3115

Open
fengmk2 wants to merge 2 commits into
mainfrom
fix/migrate-oxc-reference-recovery
Open

fengmk2 wants to merge 2 commits into
mainfrom
fix/migrate-oxc-reference-recovery

Conversation

@fengmk2

@fengmk2 fengmk2 commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

vp migrate can remove Oxc JSON configs that scripts or imported modules still use. Existing Vite+ projects can also retain unmerged configs after an interrupted migration.

The migrator now checks references before it merges configs or removes source files. It compares resolved paths and limits uncertain references to their workspace package. Retained JSON configs keep their inherited dependencies.

Case Before After
A script uses oxlint -c .oxlintrc.json, or a module imports an Oxc JSON config. Migration can delete the file and break the consumer. Migration keeps the referenced file.
Root and package configs have the same filename; only the root config has an external reference. Migration can delete both files. Migration keeps the root config and merges the independent package config.
Vite+ is installed, but unreferenced Oxc configs remain without a pending migration marker. A regular migration leaves those configs outside vite.config.*. Migration merges the remaining configs, including supported inheritance through shared TypeScript configs.
A script or module starts using retained JSON after a partial migration. A retry can delete the file after it finds a completed migration marker. A retry checks current references before it merges or removes files.

Recovery prepares inheritance graphs and references across the workspace before it removes any source files. It preserves existing inline config blocks and user edits to generated shared modules.

Supersedes #2695. Uses the inheritance conversion from #3097, which is now on main.

@fengmk2
fengmk2 added this pull request to stack #3116 October 19, 2026 06:36
@fengmk2 fengmk2 changed the title fix/migrate oxc reference recovery fix(migrate): protect Oxc references and recover interrupted migrations Oct 19, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-migrate-oxc-reference-recovery-viteplus-dev.voidzero-docs.workers.dev (commit 45e5e20)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://d6f677b7-viteplus-dev.voidzero-docs.workers.dev 45e5e20 2026-10-21T10:20:16.082Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://a367208e-viteplus-dev.voidzero-docs.workers.dev 1d38939 2026-10-20T16:35:51.980Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://c421331e-viteplus-dev.voidzero-docs.workers.dev 95e937f 2026-10-19T06:37:17.075Z Visit the dashboard ↗

Base automatically changed from fix/migrate-oxlint-extends to main October 20, 2026 16:07
@fengmk2
fengmk2 force-pushed the fix/migrate-oxc-reference-recovery branch from 95e937f to 1d38939 Compare October 20, 2026 16:32
@fengmk2
fengmk2 marked this pull request as ready for review October 20, 2026 16:33
@fengmk2 fengmk2 self-assigned this Oct 20, 2026
@fengmk2
fengmk2 force-pushed the fix/migrate-oxc-reference-recovery branch from 1d38939 to 45e5e20 Compare October 21, 2026 10:19
@fengmk2

fengmk2 commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T06:30:30.898063Z 45e5e20 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 45e5e20215

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +101 to +103
const filenames = resolveConfigReferences(directory, reference);
if (!filenames?.length || changesDirectory) {
unresolvedConfigDirectories.add(directory);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Protect the target workspace when a script changes directories

For a root script such as cd packages/app && vp fmt -c .oxfmtrc.json src, this records uncertainty only for the root directory, not packages/app. Bash's help cd confirms that it will “Change the shell working directory,” so the referenced file belongs to the app package. The new existing-Vite+ finalization consequently treats the app's config as unreferenced, merges it, and deletes it, breaking the explicit-config script. Resolve the changed working directory or conservatively protect the potentially affected workspace configs before authorizing removal.

Useful? React with 👍 / 👎.

Comment on lines +154 to +155
const unresolvedContent = content.replace(
/(["'`])((?:\.{1,2}\/|\/|#)[^"'`\r\n]+)\1/g,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Follow bare workspace imports before deleting their JSON configs

When vite.config.ts imports a workspace config package by name, such as @repo/config, this regex skips the import entirely. If that package's exported module imports its own .oxfmtrc.json, the scanner never discovers the consumer. The new finalizeOxcConfigMigration path then merges and deletes that JSON file even in an existing Vite+ workspace without pending migration markers, leaving the root Vite config with a broken transitive import. Resolve bare workspace-package imports and inspect their exported modules before treating their standalone configs as removable.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
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