Skip to content

fix: relative file path#6814

Closed
neema-beglou-snyk wants to merge 1 commit into
mainfrom
fix/CSENG-200/relative-file-path
Closed

fix: relative file path#6814
neema-beglou-snyk wants to merge 1 commit into
mainfrom
fix/CSENG-200/relative-file-path

Conversation

@neema-beglou-snyk
Copy link
Copy Markdown

Pull Request Submission Checklist

  • Follows CONTRIBUTING guidelines
  • Commit messages are release-note ready, emphasizing what was changed, not how.
  • Includes detailed description of changes
  • Contains risk assessment (Low | Medium | High)
  • Highlights breaking API changes (if applicable)
  • Links to automated tests covering new functionality
  • Includes manual testing instructions (if necessary)
  • Updates relevant GitBook documentation (PR link: ___)
  • Includes product update to be announced in the next stable release notes

What does this PR do?

Fixes incorrect file path normalisation in printDepGraphError. Previously, path.relative(root, targetFile) was called with a relative targetFile, which resolves against the current working directory instead of the project root. This produced incorrect paths in error output (e.g. ../../subdir/package.json instead of subdir/package.json).

The fix anchors the target file to root first using path.resolve(root, targetFile) before computing the relative path, ensuring correct behaviour for both relative and absolute targetFile values.

Where should the reviewer start?

src/lib/snyk-test/common.ts — the two-line change in printDepGraphError.

How should this be manually tested?

Run snyk test --all-projects --print-effective-graph-with-errors on a project with nested subdirectories that contain failing scans. Verify that the normalisedTargetFile in 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-errors could 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

@neema-beglou-snyk neema-beglou-snyk requested review from a team as code owners May 18, 2026 10:33
@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented May 18, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

Warnings
⚠️

"[fix: resolve relative file path normalisation in printDepGraphError CSENG-200](https://api.github.com/repos/snyk/cli/git/commits/3f536f6f393d7798c6073b3e85d9e6c7ec137e9e)" is too long. Keep the first line of your commit message under 72 characters.

Generated by 🚫 dangerJS against 3f536f6

@snyk-pr-review-bot

This comment has been minimized.

@neema-beglou-snyk neema-beglou-snyk changed the title Fix/cseng 200/relative file path Fix: relative file path May 18, 2026
@neema-beglou-snyk neema-beglou-snyk force-pushed the fix/CSENG-200/relative-file-path branch from 7d2b57f to d373a7d Compare May 18, 2026 10:49
@snyk-pr-review-bot

This comment has been minimized.

@neema-beglou-snyk neema-beglou-snyk changed the title Fix: relative file path fix: relative file path May 18, 2026
@neema-beglou-snyk neema-beglou-snyk force-pushed the fix/CSENG-200/relative-file-path branch from d373a7d to 3f536f6 Compare May 18, 2026 12:41
@snyk-pr-review-bot
Copy link
Copy Markdown

PR Reviewer Guide 🔍

🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected
📚 Repository Context Analyzed

This review considered 4 relevant code sections from 4 files (average relevance: 0.99)

@mihaibuzgau mihaibuzgau mentioned this pull request May 19, 2026
9 tasks
@mihaibuzgau
Copy link
Copy Markdown
Contributor

closed in favour of: #6818

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants