Skip to content

feat: return error when there is no root project without --all-projects#125

Merged
thomasschafer merged 1 commit intomainfrom
feat/return-error-when-no-root-and-not-all-projects
Mar 17, 2026
Merged

feat: return error when there is no root project without --all-projects#125
thomasschafer merged 1 commit intomainfrom
feat/return-error-when-no-root-and-not-all-projects

Conversation

@thomasschafer
Copy link
Copy Markdown
Contributor

@thomasschafer thomasschafer commented Mar 9, 2026

Currently we have a bug where, when testing or monitoring a uv virtual workspace (i.e. a workspace with no root package, only workspace packages), all workspace packages will be included in the results. This is wrong, as a virtual workspace has no root and hence no dependencies. This PR adds an error in this scenario, informing the user that they can instead use --all-projects if they would like to intentionally include workspace packages in the results.

I also updated some fixtures in other tests to include the is_project_root property, and add some other missing data which ensures that they are as realistic as possible.

@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented Mar 9, 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 github-actions Bot added the feat label Mar 9, 2026
@thomasschafer thomasschafer changed the title feat: return error when there is no root project without `--all-proje… feat: return error when there is no root project without --all-projects Mar 10, 2026
@thomasschafer thomasschafer force-pushed the feat/return-error-when-no-root-and-not-all-projects branch 3 times, most recently from 649c8e4 to e5846b0 Compare March 16, 2026 15:30
@thomasschafer thomasschafer marked this pull request as ready for review March 16, 2026 15:49
@thomasschafer thomasschafer requested review from a team as code owners March 16, 2026 15:49
@thomasschafer thomasschafer force-pushed the feat/return-error-when-no-root-and-not-all-projects branch 5 times, most recently from 4472154 to 4763b5d Compare March 17, 2026 16:01
Comment thread internal/uv/uv_plugin.go Outdated
if !options.AllProjects && !options.UvWorkspacePackages && !hasProjectRoot(parsedSbom) {
log.Info(ctx, "No root project found in SBOM", logger.Attr("lockFile", lockFilePath))
noRootErr := ecosystems.NewUvNoProjectRootError(
"Found uv project with no root. To scan non-root projects use the --all-projects flag.",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should stick to the same terminology that Astral use when warning the user. As this is related to virtual workspaces it would be better if the message was easier for the end user to understand. So something like:

Found uv workspace with no root project. To scan all workspace members use the --all-projects flag.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, done!

@thomasschafer thomasschafer force-pushed the feat/return-error-when-no-root-and-not-all-projects branch from 4763b5d to 8095c1b Compare March 17, 2026 16:35
@thomasschafer thomasschafer merged commit 404b181 into main Mar 17, 2026
11 checks passed
@thomasschafer thomasschafer deleted the feat/return-error-when-no-root-and-not-all-projects branch March 17, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants