fix: relative file path#6814
Closed
neema-beglou-snyk wants to merge 1 commit into
Closed
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
|
This comment has been minimized.
This comment has been minimized.
7d2b57f to
d373a7d
Compare
This comment has been minimized.
This comment has been minimized.
thomasschafer
approved these changes
May 18, 2026
d373a7d to
3f536f6
Compare
PR Reviewer Guide 🔍
|
Contributor
|
closed in favour of: #6818 |
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.
Pull Request Submission Checklist
What does this PR do?
Fixes incorrect file path normalisation in
printDepGraphError. Previously,path.relative(root, targetFile)was called with a relativetargetFile, which resolves against the current working directory instead of the projectroot. This produced incorrect paths in error output (e.g.../../subdir/package.jsoninstead ofsubdir/package.json).The fix anchors the target file to
rootfirst usingpath.resolve(root, targetFile)before computing the relative path, ensuring correct behaviour for both relative and absolutetargetFilevalues.Where should the reviewer start?
src/lib/snyk-test/common.ts— the two-line change inprintDepGraphError.How should this be manually tested?
Run
snyk test --all-projects --print-effective-graph-with-errorson a project with nested subdirectories that contain failing scans. Verify that thenormalisedTargetFilein the JSONL error output shows a correct relative path from the project root (e.g.subdir/package.json), not an incorrectly resolved path.What's the product update that needs to be communicated to CLI users?
Fixed a bug where error output from
--print-effective-graph-with-errorscould display incorrect file paths for failed project scans in multi-project workspaces.Risk assessment (Low | Medium | High)?
Low — the change is a two-line fix scoped to error output path normalisation, with no impact on scan logic or results.
What are the relevant tickets?
CSENG-200