Skip to content

fix(codemod): canonicalize project type proofs through symlinks - #3045

Merged
trueadm merged 6 commits into
octanejs:mainfrom
openai-oss-forks:fix/codemod-parent-symlink-proofs
Nov 18, 2026
Merged

trueadm merged 6 commits into
octanejs:mainfrom
openai-oss-forks:fix/codemod-parent-symlink-proofs

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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: true keeps 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:check
  • pnpm typecheck
  • pnpm test
  • targeted tests: three codemod cases passed for physical/linked project proof parity, explicit symlink preservation, and rejection of an external consumer symlink; the new regression failed before the fix.
  • node node_modules/typescript/bin/tsc -p packages/codemod/tsconfig.json
  • targeted Prettier check and pnpm sync

Risk / follow-ups

Full repository validation was not run locally.

Provenance

  • An agent produced this diff (agent-authored)

Codex task · Host com-79386


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with 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.

typesOf in project.ts now builds the strict proof Program from canonical paths via ts.sys.realpath for the project root, selected roots, and getSourceFile, and reloads tsconfig from the physical root when it differs. preserveSymlinks: true keeps 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.

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Nov 18, 2026
…symlink-proofs

# Conflicts:
#	packages/codemod/src/project.ts
@trueadm
trueadm marked this pull request as ready for review November 18, 2026 20:25

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

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.

Comment thread packages/codemod/src/project.ts Resolved
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

🟢 No byte growth, no added work, and no timing changes beyond ±3%.

Compares 22d39dbf0, the merge commit's first parent with 77995b812 on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 4.350 4.167 −0.9% −7.4% … +5.9% ⚪ within noise
octane-tsrx replace 9.825 9.308 −1.9% −16.1% … +3.6% ⚪ within noise
octane-tsrx add 3.508 3.492 +2.0% −10.4% … +10.4% ⚪ within noise
octane-tsrx update 0.121 0.118 −0.9% −9.1% … +6.7% ⚪ within noise
octane-tsrx select 0.008 0.008 +2.3% −1.2% … +11.3% ⚪ within noise
octane-tsrx swap 0.026 0.026 +5.5% −6.2% … +14.7% ⚪ within noise
octane-tsrx remove 0.023 0.024 +1.2% −1.0% … +3.8% ⚪ within noise
octane-tsrx runlots 34.275 33.317 +1.7% −7.4% … +9.7% ⚪ within noise
octane-tsrx select_lots 0.009 0.009 −0.6% −3.4% … +2.2% ⚪ within noise
octane-tsrx clear 58.342 61.183 +3.0% −6.1% … +12.0% ⚪ within noise
octane-jsx run 5.933 5.433 +0.8% −8.2% … +5.6% ⚪ within noise
octane-jsx replace 11.333 9.967 −1.8% −12.4% … +15.1% ⚪ within noise
octane-jsx add 5.150 5.267 −1.8% −13.6% … +5.4% ⚪ within noise
octane-jsx update 0.259 0.243 +2.8% −0.7% … +5.4% ⚪ within noise
octane-jsx select 0.124 0.119 −8.6% −16.2% … +4.8% ⚪ within noise
octane-jsx swap 0.187 0.205 +5.4% −1.4% … +18.0% ⚪ within noise
octane-jsx remove 0.182 0.175 +2.9% −4.3% … +18.9% ⚪ within noise
octane-jsx runlots 30.750 36.133 +10.0% −5.3% … +17.4% ⚪ within noise
octane-jsx select_lots 1.054 1.105 +3.9% −3.7% … +9.7% ⚪ within noise
octane-jsx clear 85.750 78.950 −0.6% −6.0% … +3.5% ⚪ within noise

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.

@trueadm
trueadm merged commit 5870e0e into octanejs:main Nov 18, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project type proofs change when the same app is reached through a parent symlink

2 participants