Repository navigation
fix(codemod): canonicalize project type proofs through symlinks - #3045
Conversation
…symlink-proofs # Conflicts: # packages/codemod/src/project.ts
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 21f9b6c. 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
The codemod could give different project type proofs for the same app reached through a parent symlink: TypeScript resolved a workspace package physically while a relative import kept the linked path, creating two nominal class symbols. Build the type-proof program from physical selected files and the physical project config under TypeScript’s default symlink handling. Explicit
preserveSymlinks: truekeeps its existing behavior, and lexical write paths and ownership checks remain unchanged.Fixes #2851.
Validation
perf-review: not applicable (codemod-only diff).concise-code: src +13 −5 (runtime +0 −0); new files and exports: patch changeset only, no new export; alternatives: direct native realpath (~3 lines) rejected because it misses TypeScript's Windows and failure fallback behavior; bytes: not applicable.pnpm format:checkpnpm typecheckpnpm testnode node_modules/typescript/bin/tsc -p packages/codemod/tsconfig.jsonpnpm syncRisk / follow-ups
Full repository validation was not run locally.
Provenance
agent-authored)Codex task · Host
com-79386Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Note
Low Risk
Codemod-only type-checking path with a config-gated escape hatch; no runtime or auth changes, backed by new symlink regression tests.
Overview
Fixes inconsistent project type proofs when the codemod runs against an app directory reached through a parent symlink. TypeScript’s default resolution already follows package imports to physical files, while relative paths could stay on the linked spelling, so the proof program could treat the same nominal types as different symbols and flip rules such as
store-hook.typesOfinproject.tsnow builds the strict proofProgramfrom canonical paths viats.sys.realpathfor the project root, selected roots, andgetSourceFile, and reloads tsconfig from the physical root when it differs.preserveSymlinks: truekeeps the prior linked-path behavior. Lexical paths for writes and ownership checks are unchanged.Adds regression coverage for physical vs linked parents, explicit symlink preservation, mocked
realpath, and a macOS Unicode normalization case.Reviewed by Cursor Bugbot for commit 3955a48. Bugbot is set up for automated code reviews on this repo. Configure here.