Skip to content

feat(composer): add dependency relationships - #5234

Open
Xenira wants to merge 2 commits into
anchore:mainfrom
Xenira:feat/composer-relationships
Open

feat(composer): add dependency relationships#5234
Xenira wants to merge 2 commits into
anchore:mainfrom
Xenira:feat/composer-relationships

Conversation

@Xenira

@Xenira Xenira commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

Adds dependency relationships for composer.lock and installed.json files

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added unit tests that cover changed behavior
  • I have tested my code in common scenarios and confirmed there are no regressions
  • I have added comments to my code, particularly in hard-to-understand sections

Issue references

Collective issue for all types:

Refs: #572

Refs: anchore#572
Signed-off-by: Xenira <1288524+Xenira@users.noreply.github.com>

@CAOShurong CAOShurong left a comment

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.

Reviewed exact head e49c9f0 against base d3734dd. The new Composer resolver handles package names and provide aliases, but it drops Composer replace aliases.

Composer documents replace as satisfying requirements for the replaced package. In an exact-head composer.lock fixture where acme/implementation replaces acme/virtual and acme/application requires acme/virtual, parsing returns both packages but zero relationships; the provide-equivalent produces the expected relationship. Please parse replace metadata for both lock and installed entries, include those names in the resolver's provided set, and add a regression.

The existing Composer tests passed 20/20, parser-focused tests and package-scoped go vet passed. GitHub currently exposes only a successful DCO check for this head. git diff --check also reports an added blank line at dependency_test.go:255.

I used AI assistance to help inspect the change, check Composer's primary documentation, and run the reproducer; I verified the exact diff and results before submitting this review.

Comment thread syft/pkg/cataloger/php/dependency.go Outdated
Xenira added a commit to Xenira/syft that referenced this pull request Sep 1, 2026
Refs: anchore#5234
Signed-off-by: Xenira <1288524+Xenira@users.noreply.github.com>
Refs: anchore#5234
Signed-off-by: Xenira <1288524+Xenira@users.noreply.github.com>
@Xenira
Xenira force-pushed the feat/composer-relationships branch from b59478f to 56d20c4 Compare September 1, 2026 11:12
@Xenira

Xenira commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@CAOShurong thanks for the review.

I have added support for the replace property. Also added a new composer.lock to the testdata that contains a real world example using replace. Old packages but the simplest example I found.

The existing Composer tests passed 20/20, parser-focused tests and package-scoped go vet passed. GitHub currently exposes only a successful DCO check for this head.

Not sure if I need to do anything here. If so could you be a little more specific?

@Xenira
Xenira requested a review from CAOShurong September 1, 2026 11:14
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