Skip to content

[rush-resolver-cache-plugin] Fix file: dependency context resolution mismatch (pnpm v9/v10) - #5802

Merged
Bharat Middha (bmiddha) merged 5 commits into
mainfrom
copilot/fix-file-protocol-error
Aug 13, 2026
Merged

[rush-resolver-cache-plugin] Fix file: dependency context resolution mismatch (pnpm v9/v10)#5802
Bharat Middha (bmiddha) merged 5 commits into
mainfrom
copilot/fix-file-protocol-error

Conversation

Copilot AI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Bug Fix

resolveDependencyKey() handled file: specifiers differently from package context key generation, producing non-matching .pnpm paths (missing name@ prefix + different hash input). This caused createContextSerializer to fail context lookups with Missing context and emit incomplete resolver cache entries for file: dependencies.

  • What was the bug?

    file: dependencies from importer specifiers were resolved directly from raw file: strings, while package contexts were keyed from canonical dependency keys (name@file:... in v9/v10 lockfile format). The mismatch broke contexts.get(contextRoot).

  • How did you fix it?

    Updated the file: branch in resolveDependencyKey() to follow the same canonical-key path as other specifiers:

    • Use packageKeys passthrough when the exact key exists.
    • Otherwise build the canonical key via helpers.buildDependencyKey(key, specifier).
    • Resolve path from that canonical key so dep-path filename generation and hashing align with package context generation.
    } else if (specifier.startsWith('file:')) {
      const resolvedKey: string = packageKeys?.has(specifier)
        ? specifier
        : helpers.buildDependencyKey(key, specifier);
      return getDescriptionFileRootFromKey(lockfileFolder, resolvedKey, helpers.depPathToFilename, key);
    }
  • Testing

    Added targeted regression coverage in helpers.test.ts for:

    • pnpm v9/v10-style file: specifiers with peer suffixes using canonical key shape
    • pnpm v8 compatibility path generation for file: specifiers
    • packageKeys passthrough behavior when file: key already exists

@github-project-automation github-project-automation Bot moved this to Needs triage in Bug Triage May 11, 2026
Copilot AI changed the title Fix file: dependency context resolution mismatch in rush-resolver-cache-plugin (pnpm v9/v10) refactor(rush-resolver-cache-plugin): extract repeated specifier strings into variables in tests May 11, 2026
Copilot stopped work on behalf of Bharat Middha (bmiddha) due to an error May 12, 2026 01:34
@bmiddha Bharat Middha (bmiddha) changed the title refactor(rush-resolver-cache-plugin): extract repeated specifier strings into variables in tests Fix file: dependency context resolution mismatch in rush-resolver-cache-plugin (pnpm v9/v10) May 12, 2026
@bmiddha
Bharat Middha (bmiddha) marked this pull request as ready for review May 27, 2026 20:42
@bmiddha Bharat Middha (bmiddha) changed the title Fix file: dependency context resolution mismatch in rush-resolver-cache-plugin (pnpm v9/v10) [rush-resolver-cache-plugin] Fix file: dependency context resolution mismatch (pnpm v9/v10) May 27, 2026
@iclanton

Copy link
Copy Markdown
Member

Copilot - this needs a changelog entry.

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Copilot - this needs a changelog entry.

Added in commit ef2a965 with a change file at common/changes/@rushstack/rush-resolver-cache-plugin/copilot-fix-file-protocol-error_2026-06-15-18-19.json.

@bmiddha
Bharat Middha (bmiddha) enabled auto-merge (squash) August 12, 2026 23:54
@bmiddha

Copy link
Copy Markdown
Member

Copilot rebase this PR with latest main

Copilot AI commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Copilot rebase this PR with latest main

I rebased the branch locally onto the latest main (new HEAD: 7f5fae98da), but I’m blocked from updating the remote branch history from this environment because it requires a force-push after the rebase. If you can force-update the branch (or provide a push-capable path), I can proceed immediately.

@bmiddha
Bharat Middha (bmiddha) force-pushed the copilot/fix-file-protocol-error branch from ef2a965 to b78b8e4 Compare August 13, 2026 00:05
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8ebd5bf2-c44b-42d5-be25-e7936d4b0a14
@bmiddha
Bharat Middha (bmiddha) merged commit 1e6149e into main Aug 13, 2026
9 checks passed
@bmiddha
Bharat Middha (bmiddha) deleted the copilot/fix-file-protocol-error branch August 13, 2026 00:51
@github-project-automation github-project-automation Bot moved this from Needs triage to Closed in Bug Triage Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

4 participants