Repository navigation
fix(codemod): migrate verified selected context aliases - #3055
domgan-oai merged 4 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 24ca182. Configure here.
Benchmark report🟢 No byte growth, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)No changes across 111 measured values. Public-import reachability bundles (bytes)No changes across 141 measured values. |

Summary
A selected local context imported through a TypeScript path alias kept its React
Provider/Consumermembers after the exporter migrated to Octane, while ordinary provider objects could be mistaken for contexts by name. Promote only a direct source-backed migrated context reached through one unambiguous alias target, preserve proven ordinary objects, and block uncertain or retained React ownership before writing.Fixes #2608.
Validation
pnpm format:checkpnpm typecheckpnpm test<b title="original">night</b>.pnpm syncpassed; sync left no tracked changes.perf-review: not applicable (codemod-only diff).concise-code: src +59 −18 (runtime +0 −0); new files and exports: patch changeset only, no new module export; existing internaltypedFileis reused by the context owner to retain ambiguity blockers; alternatives: promote every typed alias (~5 lines) or rewrite aliases to relative imports (~15 lines), rejected because they misclassify competing targets or alter the import contract; bytes: not applicable.Risk / follow-ups
Promotion is limited to a single direct selected context and one alias target. Reexports, fallback mappings, attributes, runtime siblings, and retained React contexts remain explicit review boundaries.
Provenance
agent-authored)Originating task: Codex task, host
com-79386.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Changes codemod classification of imports through tsconfig paths; misclassification could skip migration or alter Provider/Consumer rewriting, though guards limit auto-migration to narrow verified cases.
Overview
The codemod now auto-migrates React
Provider/Consumerusage for contexts imported via TypeScript path aliases when the alias is unambiguous: one matching pattern, one target, typed resolution matches the runtime source, and the export is a verified selectedcreateContext(not a const object “provider”).Context detection now tracks alias targets alongside patterns, uses
typedFilevslocalFileto separate type resolution from runtime, and treats const-object exports, retained React contexts, wildcard/unresolved imports, fallback targets, and overlapping aliases as non-context orcontext-path-aliasreview errors that block writes.Tests cover successful alias migration (including DOM verification), preserved ordinary/third-party contexts, and unchanged output for blocked cases.
Reviewed by Cursor Bugbot for commit a8db817. Bugbot is set up for automated code reviews on this repo. Configure here.