Skip to content

pnpm store rule on Windows: links through a missing drive, links out of the project, and test gaps (follow-ups to #2446) #2456

Backlog

Description

Follow-ups to #2446, which runs the rule for a pnpm store entry that nothing links (#2353) on Windows. None of them changes what the rule does on Linux or macOS.

Links through a drive that is missing from the session

A mapped or subst drive is there for one session and not for another (an elevated shell does not see it). #2446 already keeps every entry when a link's own target names such a drive. Two paths miss that check, found by code review. Both rest on the same premise as the existing check, that a link into a missing drive fails with ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND; that code has not been measured.

  1. The node_modules above a linked file. For a link to a file outside the project, vex looks for a node_modules in each directory above the file. A node_modules there that is a junction into a missing drive reads as "no node_modules", so the store is judged in that session and every entry is kept in the other. The lookup should treat such a junction the way link_leads_nowhere treats a link in the project.
  2. A link whose path passes through a second link. link_leads_nowhere reads the first hop only. A relative link whose target path passes through a junction into a missing drive is left out as a link that leads nowhere. The target should be resolved level by level, with the drive check on each link on the way.

Following a link out of the project on Windows

#2443 follows a link to a directory outside the project (a link: dependency on another checkout, Bazel's bazel-* links). On Windows such a link still keeps every entry, because following was never run there. Turning it on needs the tests of #2443 to run with junctions on a Windows runner. Until then a Bazel workspace on Windows keeps the old behaviour.

Tests

  1. test_link_into_a_drive_that_is_not_there_does_not_lead_nowhere returns early where a junction into a missing drive letter cannot be made, and a passing test prints nothing. Whether it has ever made one on a runner is not known. It should fail on a runner where it cannot, or make the junction another way.
  2. test_pnpm_store_linked_with_symbolic_links_is_judged_on_windows fails on any Actions runner that cannot make a symbolic link, also a self-hosted one without the privilege. It should key on something this repository's workflow sets.
  3. The home directory is told by its file identity as well as by its path. On a volume whose driver gives every directory the same identity (not verified that one exists), a directory could be taken for the home directory, which ends the node_modules lookup above a linked file early. Requiring the path to match there would close it.

Not run on Windows

  • The vendored in-place leg (e2e_vendor_pnpm_build has no Windows runner leg).
  • Real pnpm writing junctions: the runner may make symbolic links, so pnpm wrote those.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions