Handle Swift registry identities - #29
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Swift PURL handling to avoid fabricating source-based Swift PURLs from Swift Package Registry identities, returning “unsupported” outputs instead, and keeps the struct-based and string-based construction paths aligned.
Changes:
- Refactors namespace/name extraction into
splitNamespaceand adds anokreturn to represent unsupported identifiers. - Adds Swift-specific parsing to accept only source-coordinate-style identifiers (
host/owner/package) and reject registry identities/paths. - Adds/updates tests to cover Swift source coordinates and registry identities across
MakePURL*andBuildPURLString.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| makepurl.go | Adds ok-returning splitNamespace, uses it in BuildPURLString, and introduces Swift-specific identifier validation. |
| makepurl_test.go | Adds BuildPURLString tests for Swift source coordinates vs registry identities/paths and aligns parity test coverage. |
| ecosystem.go | Routes MakePURL / MakePURLString through splitNamespace, returning nil/empty string for unsupported Swift registry identities. |
| ecosystem_test.go | Adds Swift source coordinate tests and explicit rejection tests for Swift registry identities for both struct and string APIs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Swift Package Registry identities do not include source repository coordinates, so treating
apple/swift-argument-parseras a namespace creates a misleading PURL.Return unsupported results for Swift registry identities and build source PURLs only from coordinates such as
github.com/apple/swift-argument-parser. This also keeps the struct and string construction paths aligned.Closes #28