Skip to content

Conversation

ljones140
Copy link
Contributor

@ljones140 ljones140 commented Jun 19, 2025

There is a bug where components have themselves in top level referrers they mark themselves as indirect.

Extracted the component to snapshot manifest transformation and added tests for different permutations of direct and indirect dependencies.

If we look at this component returned by component detection we can see that it has itself in the top level referrers.
That was causing the previous implementation to mark it as indirect incorrectly.

    {
      "locationsFoundAt": [
        "/requirements.txt"
      ],
      "component": {
        "name": "h11",
        "version": "0.16.0",
        "author": "Nathaniel J. Smith",
        "license": "MIT",
        "type": "Pip",
        "packageUrl": {
          "Scheme": "pkg",
          "Type": "pypi",
          "Namespace": null,
          "Name": "h11",
          "Version": "0.16.0",
          "Qualifiers": null,
          "Subpath": null
        },
        "id": "h11 0.16.0 - pip"
      },
      "detectorId": "PipReport",
      "isDevelopmentDependency": null,
      "dependencyScope": null,
      "topLevelReferrers": [
        {
          "name": "httpcore",
          "version": "1.0.9",
          "author": "Tom Christie <[email protected]>",
          "license": "BSD License",
          "type": "Pip",
          "packageUrl": {
            "Scheme": "pkg",
            "Type": "pypi",
            "Namespace": null,
            "Name": "httpcore",
            "Version": "1.0.9",
            "Qualifiers": null,
            "Subpath": null
          },
          "id": "httpcore 1.0.9 - pip"
        }
      ],

Closes: https://github.com/github/dependency-graph/issues/6467

@ljones140 ljones140 marked this pull request as ready for review June 19, 2025 14:43
@ljones140 ljones140 requested review from a team as code owners June 19, 2025 14:43
@ljones140 ljones140 requested review from felickz and adrienpessu and removed request for a team June 19, 2025 14:43
Copy link
Contributor

@juxtin juxtin left a comment

Choose a reason for hiding this comment

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

Looks good!

@ljones140 ljones140 merged commit b242ddf into main Jun 20, 2025
5 checks passed
@ljones140 ljones140 deleted the ljones140/fix-direct-when-self-referring branch June 20, 2025 08:26
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.

2 participants