Skip to content

fix: relative file path#6818

Merged
mihaibuzgau merged 1 commit into
mainfrom
fix/CSENG-200_relative-file-path
May 20, 2026
Merged

fix: relative file path#6818
mihaibuzgau merged 1 commit into
mainfrom
fix/CSENG-200_relative-file-path

Conversation

@mihaibuzgau
Copy link
Copy Markdown
Contributor

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

This is a cherry pick from #6814. All credit for the work goes to neema-beglou-snyk.

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

@mihaibuzgau mihaibuzgau requested review from a team as code owners May 19, 2026 09:52
@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented May 19, 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.

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

cc @neema-beglou-snyk

@snyk-pr-review-bot

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

Warnings
⚠️

"fix: resolve relative path normalisation in printDepGraphError[CSENG-200]" is too long. Keep the first line of your commit message under 72 characters.

Generated by 🚫 dangerJS against f0eb4d0

@mihaibuzgau mihaibuzgau force-pushed the fix/CSENG-200_relative-file-path branch from f279ab2 to 11df1d5 Compare May 19, 2026 09:55
@snyk-pr-review-bot

This comment has been minimized.

@mihaibuzgau mihaibuzgau force-pushed the fix/CSENG-200_relative-file-path branch from 11df1d5 to 6b2c109 Compare May 19, 2026 12:26
@snyk-pr-review-bot

This comment has been minimized.

@mihaibuzgau mihaibuzgau enabled auto-merge May 19, 2026 12:29
@mihaibuzgau mihaibuzgau force-pushed the fix/CSENG-200_relative-file-path branch from 6b2c109 to be88b6a Compare May 19, 2026 13:54
@snyk-pr-review-bot

This comment has been minimized.

Comment thread src/lib/snyk-test/common.ts
@mihaibuzgau mihaibuzgau force-pushed the fix/CSENG-200_relative-file-path branch from be88b6a to 9aca200 Compare May 19, 2026 16:16
@snyk-pr-review-bot

This comment has been minimized.

@CatalinSnyk CatalinSnyk disabled auto-merge May 19, 2026 16:21
@CatalinSnyk
Copy link
Copy Markdown
Contributor

Hey @mihaibuzgau, I disabled auto-merge to get #6803 in first. I can look to rebase and get this PR merge after 😄 Hope you don't mind

@mihaibuzgau mihaibuzgau force-pushed the fix/CSENG-200_relative-file-path branch from 9aca200 to f0eb4d0 Compare May 20, 2026 14:37
@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 6 relevant code sections from 6 files (average relevance: 0.97)

@mihaibuzgau mihaibuzgau enabled auto-merge May 20, 2026 14:48
@mihaibuzgau mihaibuzgau merged commit 82cfb8a into main May 20, 2026
9 checks passed
@mihaibuzgau mihaibuzgau deleted the fix/CSENG-200_relative-file-path branch May 20, 2026 15:21
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.

4 participants