test: cover --include-component-metadata for poetry projects - #7048
Draft
calhar-snyk wants to merge 3 commits into
Draft
test: cover --include-component-metadata for poetry projects#7048calhar-snyk wants to merge 3 commits into
calhar-snyk wants to merge 3 commits into
Conversation
Mirrors npm-include-component-metadata.spec.ts for poetry: asserts hash: labels appear on dep-graph nodes with the flag and are absent without it. Poetry PyPI deps carry no download URL, so (unlike npm) only hash: labels are asserted, not distribution:url.
Cover distribution:url alongside hash labels, asserting the pypi.org project-page shape with the flag and absence without it.
5 tasks
✅ 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
The referenced design doc isn't checked in; the comment already explains the project-page URL shape on its own.
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
are release-note ready, emphasizing
what was changed, not how.
What does this PR do?
Adds acceptance coverage for
snyk test --include-component-metadataon poetryprojects, so the flag's behaviour is pinned for python the way it already is for
npm, maven, go and yarn.
Test-only — no product code changes. The CLI already forwards
--include-component-metadatainto plugin options through its genericsingle-plugin path (
get-single-plugin-result.ts), and poetry rides that samepath, so nothing in
src/needed touching. This PR is the missing test.test/jest/acceptance/snyk-test/poetry-include-component-metadata.spec.ts—mirrors
npm-include-component-metadata.spec.ts: assertshash:anddistribution:urllabels appear on the printed dep-graph with the flag, andare absent without it.
test/fixtures/poetry-include-component-metadata/— apyproject.toml+poetry.lockpair. The hashes live in the lockfile, so nopoetry installornetwork access is needed.
Risk assessment: Low — test and fixture only; no runtime code paths change.
No breaking API changes.
This PR deliberately contains no version bumps. The assertions only pass once
the poetry parser emits the labels and the python plugin threads the flag:
snyk-poetry-lockfile-parser— feat: emit component-metadata (hash/distribution) labels for SBOM export snyk-poetry-lockfile-parser#43snyk-python-plugin— feat: emit component-metadata labels for poetry projects snyk-python-plugin#376 (bump the parser there first)Once both are published, bump
snyk-python-plugininpackage.json(currently^3.2.1) to the release containing (2). Until then this spec fails — thepublished plugin ignores the flag, so no labels are produced. That failure is
expected and is the only thing between this and mergeable; no other work is
outstanding.
Where should the reviewer start?
The spec file — it's a close copy of the npm sibling, with two poetry-specific
differences worth a look:
--all-projectscase.distribution:urlfor poetry is a PEP 503 project-page URL with a#<filename>fragment (e.g.https://pypi.org/simple/jinja2/#Jinja2-2.11.2-py2.py3-none-any.whl), not adirect download URL like npm's registry tarball —
poetry.locknever recordsone. The assertion matches that shape deliberately.
How should this be manually tested?
With local checkouts of the two upstream repos wired in:
Note
test:acceptanceneeds aSNYK_TOKEN(the spec runs a realsnyk test);without one it exits 2, exactly as the existing npm/maven component-metadata
specs do locally.
The label behaviour itself was verified through the built binary:
(
markupsafepublishes no universal wheel, so it resolves to its sdist — thefixture exercises both branches of the parser's artifact selection.)
What's the product update that needs to be communicated to CLI users?
None for this PR — it is test-only. The user-facing change (poetry SBOMs gaining
component hashes and distribution URLs) ships with the parser/plugin releases
listed above and should be announced alongside those.
What are the relevant tickets?
CMPA-656