Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide context necessary to resolve identity conflict. #8390

Merged
merged 3 commits into from
Mar 25, 2025

Conversation

yyvch
Copy link
Contributor

@yyvch yyvch commented Mar 20, 2025

Update error messaging to be a bit more clear where the conflict of identities is coming from.

Motivation:

#8311 — when multiple packages share the same identity (for example: gh/swiftlang/swift-driver and gh/apple/swift-driver share the same identity swift-driver) then the error doesn't help to resolve the conflict. It is particularly confusing when the conflicting package is pulled from transitive dependencies. I wanted to offer more context to resolve these types of conflicts, particularly:

  • how the conflict is introduced in relation to the root package
  • itemize all paths for both sides of the conflict, so that users can better understand how to approach resolution, but not overwhelm the error message with too many details

Modifications:

  • Rephrase error message for clarity, add a suggestion to work with maintainers of transitive dependencies.
  • Reconstruct the dependency chains from roots to the conflicting packages.

Result:

Before:

'swift-build': 'swift-build' dependency on 'https://github.com/swiftlang/swift-driver.git' conflicts with dependency on 'https://github.com/apple/swift-driver.git' which has the same identity 'swift-driver'.

After:

Conflicting identity for swift-driver: dependency 'github.com/swiftlang/swift-driver' and dependency 'github.com/apple/swift-driver' both point to the same package identity 'swift-driver'. The dependencies are introduced through the following chains: (A) /users/yy/pub/swift-package-manager->github.com/swiftlang/swift-build->github.com/swiftlang/swift-driver (B) /users/yy/pub/swift-package-manager->github.com/apple/swift-driver. If there are multiple chains that lead to the same dependency, only the first chain is shown here. To see all chains use debug output option. To resolve the conflict, coordinate with the maintainer of the package that introduces the conflicting dependency.

Plus also debug logs:

debug: 'swift-build': Conflicting identity for swift-driver: chains of dependencies for https://github.com/swiftlang/swift-driver.git: [[/users/yy/pub/swift-package-manager, github.com/swiftlang/swift-build, github.com/swiftlang/swift-driver]]

debug: 'swift-build': Conflicting identity for swift-driver: chains of dependencies for https://github.com/apple/swift-driver.git: [[/users/yy/pub/swift-package-manager, github.com/apple/swift-driver]]

Update error messaging to be a bit more clear where the conflict
of identities is coming from.
@yyvch
Copy link
Contributor Author

yyvch commented Mar 20, 2025

@swift-ci please test

@yyvch yyvch requested a review from MaxDesiatov March 20, 2025 23:29
@yyvch
Copy link
Contributor Author

yyvch commented Mar 20, 2025

@swift-ci please test

1 similar comment
@yyvch
Copy link
Contributor Author

yyvch commented Mar 24, 2025

@swift-ci please test

Copy link
Contributor

@bripeticca bripeticca left a comment

Choose a reason for hiding this comment

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

LGTM :)

@bripeticca bripeticca merged commit 00dc44a into swiftlang:main Mar 25, 2025
5 checks passed
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.

3 participants