pnp: run all resolution test suites; fix the two bugs they surface#8
Open
ejc3 wants to merge 1 commit into
Open
pnp: run all resolution test suites; fix the two bugs they surface#8ejc3 wants to merge 1 commit into
ejc3 wants to merge 1 commit into
Conversation
TestResolveUnqualified loaded the full berry/esbuild expectations file (5
suites, ~18 cases) but a `if si != 0 { continue }` ran only the first suite, so
11 of the imported cases never executed — including every fallback-pool,
fallbackExclusionList, ignorePatternData, and global-package scenario. Removing
the skip surfaced two real bugs, fixed here:
- Fallback pool aliases: `fallbackPool` was parsed as `[][2]string`, which drops
the `[name, [aliasName, reference]]` alias form, so a pooled alias never
resolved. Parse it as `[]PackageDependency` with the existing alias-aware
parser (the same shape packageDependencies already use) and return the matched
entry directly. Removes the now-unused parseStringPairs.
- ignorePatternData: an importer covered by the ignore pattern is not managed by
PnP (e.g. a nested project with its own node_modules). ResolveToUnqualified now
returns the specifier unchanged (the spec's passthrough) instead of "", and the
module resolver runs the classic ancestor node_modules walk for an ignored
importer instead of the PnP path — previously such imports could not resolve.
Adds IsPathIgnored (reused by FindLocator and the peer-dependency path).
All five suites now pass; the internal/module tests and the pnp* compiler
baselines are unchanged.
Claude-Session: https://claude.ai/code/session_016TJMzkr87UoE2Rv3GZ5c6X
GGomez99
reviewed
Jul 9, 2026
GGomez99
left a comment
Owner
There was a problem hiding this comment.
Hey, thank you very much for finding this issue!
Changes look good to me, but would you mind waiting for Fix alias resolution to be merged first?
It's handling the fallbackPool issue + aliases, and I received/reviewed it first 🙇
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on top of your Yarn PnP branch (microsoft#1966). Targets your branch so the diff is just these changes.
TestResolveUnqualifiedloads the full berry/esbuildtest-expectations.json— 5 suites, ~18 cases — but aif si != 0 { continue }in the suite loop runs only the first suite, so 11 of the imported cases never execute: every fallback-pool,fallbackExclusionList,ignorePatternData, and global-package scenario.Removing that one line surfaces two real bugs (both fixed here):
1. Fallback pool aliases
fallbackPoolwas parsed as[][2]string, which silently drops the[name, [aliasName, reference]]alias form Yarn emits — so a pooled alias never resolved (should allow the fallback pool to contain aliasesfailed). Parse it as[]PackageDependencywith the existing alias-awareparsePackageDependencies(the same shapepackageDependenciesalready use), and return the matched entry directly fromResolveViaFallback. The now-unusedparseStringPairsis removed.2.
ignorePatternDataimportersAn importer covered by the ignore pattern is not managed by PnP (e.g. a nested project with its own
node_modules).ResolveToUnqualifiedreturned"", and — because the PnP path replaces the classic ancestor walk entirely — such imports could not resolve at all (shouldn't go through PnP … covered by ignorePatternDatafailed).Fix, matching the PnP spec's fallback-to-classic behavior:
ResolveToUnqualifiedreturns the specifier unchanged for an ignored importer (the spec's passthrough).loadModuleFromNearestNodeModulesDirectoryWorkerruns the classic ancestornode_moduleswalk for an ignored importer instead of the PnP path.IsPathIgnoredhelper, reused byFindLocatorand guarding the peer-dependency resolution path (so an ignored package dir keeps its classicnode_modules + namefallback).Result
All 5 suites (18 cases) pass.
internal/moduletests and thepnp*compiler baselines are unchanged.gofmt/go vet/ the repo'sgolangci-lintare clean.Context: this is the salvageable part of my own PnP attempt (microsoft#4568, now closed in favor of yours) — I hit the same design decisions you did and this is where I could actually add value. Happy to adjust anything to fit your direction, split it, or drop pieces.
Disclosure: authored with Claude Code (agent-assisted); I've read and understood the changes and will respond to review, per microsoft/typescript-go's CONTRIBUTING AI-assistance policy.