Skip to content

Fix package ID collisions for remapped inputs - #4767

Draft
jakebailey wants to merge 3 commits into
mainfrom
jabaile/fix-4758-package-id-dedup
Draft

Fix package ID collisions for remapped inputs#4767
jakebailey wants to merge 3 commits into
mainfrom
jabaile/fix-4758-package-id-dedup

Conversation

@jakebailey

Copy link
Copy Markdown
Member

Fixes #4758

See the second commit for the diff; note how the set reference mapped to get before but now correctly maps to set.

Copilot AI review requested due to automatic review settings July 27, 2026 18:40
@jakebailey
jakebailey marked this pull request as draft July 27, 2026 18:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes package-ID collisions when declaration outputs remap to source files outside the package directory.

Changes:

  • Omits invalid package IDs for remapped external inputs.
  • Correctly handles trailing package-directory separators.
  • Adds regression tests and baselines for colliding and non-colliding paths.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/module/resolver.go Validates resolved paths before constructing package IDs.
testdata/tests/cases/compiler/packageSelfNameSubpathExportsPackageIdCollision.ts Tests distinct package IDs at the filesystem root.
testdata/tests/cases/compiler/packageSelfNameSubpathExportsPackageIdOutsidePackage.ts Tests remapped inputs outside the package.
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdCollision.types Captures inferred types.
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdCollision.trace.json Captures distinct package IDs.
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdCollision.symbols Captures resolved symbols.
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdCollision.js Captures emitted output.
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdCollision.errors.txt Captures expected diagnostics.
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdOutsidePackage.types Captures corrected inferred types.
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdOutsidePackage.trace.json Confirms remapped paths omit package IDs.
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdOutsidePackage.symbols Captures corrected symbols.
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdOutsidePackage.js Captures emitted output.
testdata/baselines/reference/compiler/packageSelfNameSubpathExportsPackageIdOutsidePackage.errors.txt Confirms set resolves independently.

@jakebailey

Copy link
Copy Markdown
Member Author

I might have been bamboozled, I think this bug only happens if packageDirectory is / which the test case can make happen, but is very likely not reality for the real repro.

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.

disableSourceOfProjectReferenceRedirect causes lodash per-method submodule import to resolve to the wrong function

2 participants