Skip to content

Swift relies on Version, not hash - #1885

Merged
Ryan Brandenburg (ryanbrandenburg) merged 2 commits into
mainfrom
users/rybrande/SwiftComputeBase
Oct 1, 2026
Merged

Ryan Brandenburg (ryanbrandenburg) merged 2 commits into
mainfrom
users/rybrande/SwiftComputeBase

Conversation

@ryanbrandenburg

Copy link
Copy Markdown
Contributor

After chatting with some team-members we decided that Version was the more useful identifier after all. This PR makes version the ComponentBaseId identifier and removes the constructors which weren't really achieving anything anyway.

Most of the test changes relate to either the expected ID changing or the lack of constructor enforcement for some parameters.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The detector version was not incremented, and removing a public constructor breaks existing Contracts consumers.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity · 2 Low severity

Open (4)
What changed in this PR

Updates Swift component identity to rely on repository URL and package version rather than commit hash.

Changes:

  • Uses version in Swift component IDs.
  • Skips packages without versions while allowing missing revisions.
  • Replaces constructor usage with object initializers and updates tests.
File Description
src/​Microsoft.ComponentDetection.Contracts/​TypedComponent/​SwiftComponent.cs Changes identity and removes constructors.
src/​Microsoft.ComponentDetection.Detectors/​swiftpm/​SwiftResolvedComponentDetector.cs Requires versions during detection.
test/​Microsoft.ComponentDetection.Contracts.Tests/​TypedComponentSerializationTests.cs Updates Swift serialization setup.
test/​Microsoft.ComponentDetection.Detectors.Tests/​SwiftComponentTests.cs Updates identity and initialization tests.
test/​Microsoft.ComponentDetection.Detectors.Tests/​SwiftResolvedDetectorTests.cs Updates detector expectations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 23:17
@github-actions

Copy link
Copy Markdown

👋 Hi! It looks like you modified some files in the Detectors folder.
You may need to bump the detector versions if any of the following scenarios apply:

  • The detector detects more or fewer components than before
  • The detector generates different parent/child graph relationships than before
  • The detector generates different devDependencies values than before

If none of the above scenarios apply, feel free to ignore this comment 🙂

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

The implementation and tests consistently apply the intended version-based Swift identity behavior.

Review effort: Balanced
Findings: None

Resolved since last review (4)

@ryanbrandenburg

Copy link
Copy Markdown
Contributor Author

The change in detections count is expected, the "revision+branch" sample is no longer valid.

@ryanbrandenburg
Ryan Brandenburg (ryanbrandenburg) merged commit 2f00ab9 into main Oct 1, 2026
13 of 16 checks passed
@ryanbrandenburg
Ryan Brandenburg (ryanbrandenburg) deleted the users/rybrande/SwiftComputeBase branch October 1, 2026 16:46
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