RTECO-1055 - Treat pnpm workspace as standalone#3451
Open
Conversation
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
5 tasks
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.
masterbranch.go vet ./....go fmt ./....Problem
jf pnpm installunconditionally ranpnpm ls -r --depth Infinity --jsonwhen collecting build-info. This ignored the user's workspace intent in two scenarios:cd apps/web-app && jf pnpm installproduced a multi-module build-info containing every workspace package, not justweb-app.--ignore-workspaceflag —pnpm install --ignore-workspacewas honored by pnpm during install, but the subsequentpnpm ls -rre-enumerated the entire monorepo, leaking sibling/root deps into the build-info.Downstream SBOM / Xray consumers therefore saw phantom dependencies that didn't actually belong to the built package.
Fix
The build-info
pnpm lscall now matches the user's intent:isPnpmWorkspaceSubPackage— usespnpm root -wplus symlink-resolved path compare. When the working directory is a workspace sub-package,-ris dropped and only the current package's deps are collected.extractLsForwardFlags— forwards--ignore-workspacefrom the install args topnpm ls, so build-info respects the flag.buildPnpmLsArgs— also drops-rwhen--ignore-workspaceis forwarded (pnpm would otherwise emit concatenated JSON arrays that aren't parseable byencoding/json).Workspace-root invocation without
--ignore-workspacekeeps the existing-rmulti-module behavior — no regression for current CI flows.Summary
Adds two end-to-end tests covering the fix in
jfrog-cli-artifactorythat scopes pnpm build-info to the invoked package:TestPnpmInstallSubPackageScopesBuildInfo— runsjf pnpm installfrompackages/nested1/and asserts the resulting build-info contains exactlynested1:1.0.0with only its ownloadashdependency. Noxmlfrom siblingnested2, nojsonfrom the workspace root.TestPnpmInstallIgnoreWorkspaceScopesBuildInfo— runsjf pnpm install --ignore-workspacefrom the workspace root and asserts onlypnpm-workspace-root:1.0.0with itsjsondevDep is present (no sibling leakage).Fixture change
The
pnpmworkspacetestdata is tweaked so each package has a distinct dependency, making leakage a positive assertion (presence of a foreign dep fails the test):xml+json(dev)json(dev)packages/nested1loadashloadashpackages/nested2loadashxmlImpact on existing tests
None.
TestPnpmPublishWorkspaceandTestPnpmInstallAndPublishWorkspaceassert on structural properties (module count, tarball names, has-deps) — all still hold after the fixture change.depends on: