[ANE-1400] Fix pipenv transitive dependencies being reported as direct
Overview
The pipenv strategy in fossa-cli is currently reporting all dependencies from pipenv graph as direct dependencies, even when they are actually transitive dependencies. This causes incorrect dependency trees in FOSSA, where transitive dependencies appear at the top level.
For example, if a project has:
- Direct dependency:
requests - Transitive dependency:
urllib3(required byrequests)
The current implementation shows both requests and urllib3 as direct dependencies, which is incorrect.
Changes
- Modified
buildEdgesinPipenv.hsto only mark top-level dependencies frompipenv graphas direct dependencies - Added a helper function
mkEdgesRecthat properly handles the dependency tree structure - Added a test case in
PipenvSpec.hsto verify correct handling of transitive dependencies - Updated changelog with the fix
Testing
Acceptance criteria
pipenv transitive dependencies should no longer be reported as direct dependencies.
Testing plan
- Added unit test verifying that:
- Direct dependencies are correctly marked as direct
- Transitive dependencies are not marked as direct
- Dependency relationships are preserved
- Manually tested with the example project from the GoodData support ticket:
git clone https://github.com/gooddata/gooddata-python-sdk.git cd gooddata-python-sdk/gooddata-pandas pipenv install -r requirements.txt fossa analyze
Risks
Highlight any areas that you're unsure of, want feedback on, or want reviewers to pay particular attention to.
Example: I'm not sure I did X correctly, can reviewers please double-check that for me?
Metrics
Is this change something that can or should be tracked? If so, can we do it today? And how? If its easy, do it
References
ANE-1400 Support tickets: TKT-9347 TKT-9567 TKT-10407
Checklist
- [x] I added tests for this PR's change (or explained in the PR description why tests don't make sense).
- [ ] If this PR introduced a user-visible change, I added documentation into
docs/. - [ ] If this PR added docs, I added links as appropriate to the user manual's ToC in
docs/README.msand gave consideration to how discoverable or not my documentation is. - [x] If this change is externally visible, I updated
Changelog.md. If this PR did not mark a release, I added my changes into an## Unreleasedsection at the top. - [ ] If I made changes to
.fossa.ymlorfossa-deps.{json.yml}, I updateddocs/references/files/*.schema.jsonAND I have updated example files used byfossa initcommand. You may also need to update these if you have added/removed new dependency type (e.g.pip) or analysis target type (e.g.poetry). - [ ] If I made changes to a subcommand's options, I updated
docs/references/subcommands/<subcommand>.md.