Skip to content

Conversation

@navtoj
Copy link
Contributor

@navtoj navtoj commented Aug 5, 2025

Resolves: #262

Summary by CodeRabbit

  • Bug Fixes

    • Prevented a system framework from being used on unsupported platforms — now restricted to macOS to avoid errors.
    • Enforced its source and path resolution on macOS for more reliable framework access.
  • Tests

    • Added tests verifying the unsupported-platform error and correct macOS behavior.

@coderabbitai
Copy link

coderabbitai bot commented Aug 5, 2025

Walkthrough

Added special-case handling for "XcodeKit.framework": loadMetadata forces its SDKSource to .developer, restricts it to macOS (throws unsupportedSDKPlatform otherwise), and adjusts path resolution for developer-sourced XcodeKit to the Library-based path.

Changes

Cohort / File(s) Change Summary
SystemFrameworkMetadataProvider updates for XcodeKit.framework
Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift
Added unsupportedSDKPlatform(sdk:platform:supported:) error case. Renamed source parameter to sdkSource in loadMetadata, force-set .developer for "XcodeKit.framework", validate platform == macOS (throwing unsupportedSDKPlatform otherwise), and special-case sdkPath to use the developer Library root for XcodeKit.
Unit tests for XcodeKit.framework handling
Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift
Added loadMetadataUnsupportedPlatform() to assert unsupportedSDKPlatform is thrown for non-macOS, and loadMetadataXcodeKit() to assert metadata (name, path, status, source) for macOS with developer source.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant SystemFrameworkMetadataProvider

    Caller->>SystemFrameworkMetadataProvider: loadMetadata(sdkName, status, platform, sdkSource)
    alt sdkName == "XcodeKit.framework"
        alt platform == macOS
            SystemFrameworkMetadataProvider->>SystemFrameworkMetadataProvider: set sdkSource = .developer
            SystemFrameworkMetadataProvider->>SystemFrameworkMetadataProvider: resolve sdkPath -> /Library/Frameworks/XcodeKit.framework
            SystemFrameworkMetadataProvider-->>Caller: return SystemFrameworkMetadata(name, path, status, .developer)
        else
            SystemFrameworkMetadataProvider-->>Caller: throw unsupportedSDKPlatform(sdk, platform, [macOS])
        end
    else
        SystemFrameworkMetadataProvider-->>Caller: proceed with existing loadMetadata logic
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
Add SDKSource for XcodeKit (#262) The change forces .developer and special-cases the developer Library root, but the implemented path is /Library/Frameworks/... (relative adjustment) rather than the full $(DEVELOPER_DIR)/Library/Frameworks/XcodeKit.framework. Unclear if this satisfies the exact path requirement.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
None found

"I nibble paths and hop through code,
XcodeKit's home I help decode.
Only macOS I will abide,
Developer-sourced, I set with pride.
A rabbit checks the framework's road." 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 45850a0 and 3cf850f.

📒 Files selected for processing (2)
  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift (4 hunks)
  • Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift
  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@navtoj navtoj marked this pull request as ready for review August 7, 2025 10:16
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request labels Aug 7, 2025
@navtoj
Copy link
Contributor Author

navtoj commented Aug 7, 2025

@fortmarek Any other changes I need to make?

Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

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

Would you mind updating also the tests for the changes you've made?

Comment on lines 71 to 74
if name == "XcodeKit.framework" && platform == .macOS {
let sdkRootPath = try AbsolutePath(validating: "/Library/Frameworks")
return sdkRootPath.appending(component: name)
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure this is not the correct path. This needs to be prefixed with the xcodeDeveloperSdkRootPath

Copy link
Contributor Author

@navtoj navtoj Aug 8, 2025

Choose a reason for hiding this comment

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

This needs to be prefixed with the xcodeDeveloperSdkRootPath

There are frameworks at 3 different locations. The xcodeDeveloperSdkRootPath and xcodeSdkRootPath paths don't work for XcodeKit.

Framework Location (inside /Applications/Xcode.app/Contents/Developer/)
XcodeKit Library/Frameworks
XCTest Platforms/MacOSX.platform/Developer/Library/Frameworks
CloudKit Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks

public var xcodeDeveloperSdkRootPath: String {
switch self {
case .iOS:
return "Platforms/iPhoneOS.platform/Developer/Library"
case .macOS:
return "Platforms/MacOSX.platform/Developer/Library"

public var xcodeSdkRootPath: String {
switch self {
case .iOS:
return "Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
case .macOS:
return "Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Aug 8, 2025
@navtoj
Copy link
Contributor Author

navtoj commented Aug 8, 2025

Would you mind updating also the tests for the changes you've made?

Added the test for loadMetadata. Also, updated the code to match the switch/case code.


Edit: Based on @coderabbitai's comments...

  1. Added an error case for unsupported platforms and moved path logic within switch block.
  2. Fixed the parameter reassignment issue.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift (1)

109-129: Add negative tests for unsupported combinations

To lock behavior down, consider adding:

  • XcodeKit with source .system (should throw)
  • XcodeKit with non-macOS platforms (e.g., .iOS, .tvOS; should throw)

This will prevent regressions if the provider logic changes.

If helpful, I can draft these test cases once we confirm the exact error type thrown for these scenarios.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4e89be and d38ffdb.

📒 Files selected for processing (2)
  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift (1 hunks)
  • Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift
🧰 Additional context used
📓 Path-based instructions (2)
Tests/**/*

📄 CodeRabbit Inference Engine (AGENT.md)

Unit tests for each module should be placed in the corresponding Tests/ directories

Files:

  • Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift
**/*.swift

📄 CodeRabbit Inference Engine (AGENT.md)

Use Swift 6.0.3+ with StrictConcurrency enabled

Files:

  • Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraph/Models/**/* : Core data structures like Project, Target, Scheme, and BuildConfiguration should be implemented in `Sources/XcodeGraph/Models/`
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeMetadata/Providers/**/* : Binary metadata extraction for frameworks and libraries should be implemented in `Sources/XcodeMetadata/Providers/`
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Tests/Fixtures/**/* : XCFramework fixtures for metadata testing should be placed in `Tests/Fixtures/`
📚 Learning: 2025-08-07T14:29:08.174Z
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Tests/Fixtures/**/* : XCFramework fixtures for metadata testing should be placed in `Tests/Fixtures/`

Applied to files:

  • Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift
📚 Learning: 2025-08-07T14:29:08.174Z
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeMetadata/Providers/**/* : Binary metadata extraction for frameworks and libraries should be implemented in `Sources/XcodeMetadata/Providers/`

Applied to files:

  • Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift
📚 Learning: 2025-08-07T14:29:08.174Z
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Linux support is available with limited testing; XcodeGraphMapperTests and XcodeMetadataTests require Xcode utilities

Applied to files:

  • Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift
🔇 Additional comments (2)
Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift (2)

109-129: LGTM: Solid coverage for XcodeKit developer path on macOS

This test accurately captures the expected developer-relative path for XcodeKit and guards the newly supported case.


121-126: No change needed: developer-relative semantics are correct

The test for XcodeKit.framework expects the path "/Library/Frameworks/XcodeKit.framework", matching how other developer‐sourced frameworks are represented (e.g. "/Platforms/.../Developer/Library/Frameworks/..."). The special‐case in sdkPath using AbsolutePath(validating: "/Library") produces that same developer‐relative string, not an absolute system root lookup. Paths remain consistently anchored to the DEVELOPER_DIR across all tests.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Aug 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 8, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the implementation in SystemFrameworkMetadataProvider.swift
echo "=== Checking SystemFrameworkMetadataProvider.swift implementation ==="
cat Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift | head -100

echo -e "\n=== Checking the test file ==="
cat Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift | grep -A 20 "loadMetadataXcodeKit"

echo -e "\n=== Checking for error handling in the implementation ==="
ast-grep --pattern 'case .developer:
  $$$
}'

Length of output: 5113


@navtoj Thanks for adding the test and implementing the error handling for unsupported platforms! The changes look good overall.

I noticed one potential issue in the implementation: on line 67 of SystemFrameworkMetadataProvider.swift, you're reassigning the source parameter:

if sdkName == "XcodeKit.framework" {
    guard platform == .macOS else {
        throw SystemFrameworkMetadataProviderError
            .unsupportedSDKPlatform(sdk: sdkName, platform: platform, supported: [.macOS])
    }
    source = .developer  // This reassigns a function parameter
}

Since source is a function parameter, reassigning it here could be confusing. Consider either:

  1. Making it explicit that .developer is the only valid source for XcodeKit by checking both conditions
  2. Using a local variable for the effective source

The test coverage for the XcodeKit case and the error handling for unsupported platforms are well implemented! The error message clearly indicates which platforms are supported.


🧠 Learnings used
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Linux support is available with limited testing; XcodeGraphMapperTests and XcodeMetadataTests require Xcode utilities

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraph/Models/**/* : Core data structures like Project, Target, Scheme, and BuildConfiguration should be implemented in `Sources/XcodeGraph/Models/`

@coderabbitai
Copy link

coderabbitai bot commented Aug 8, 2025

Tip

For best results, initiate chat on the files or code changes.

@navtoj Thank you for implementing the requested changes! Based on the updates you've made:

✅ Added test for loadMetadataXcodeKit() to verify the XcodeKit framework path handling
✅ Updated the implementation to use consistent switch/case pattern
✅ Added error handling for unsupported platforms
✅ Moved path logic within the switch block for better code organization

The changes look good and properly address the feedback from both fortmarek and myself. The test coverage for the new XcodeKit framework path functionality is now in place, and the code structure is more consistent with the existing pattern.


🧠 Learnings used
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraph/Models/**/* : Core data structures like Project, Target, Scheme, and BuildConfiguration should be implemented in `Sources/XcodeGraph/Models/`

@coderabbitai
Copy link

coderabbitai bot commented Aug 8, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the current implementation of SystemFrameworkMetadataProvider.swift
echo "=== Checking current implementation around line 67 ==="
cat Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift | sed -n '60,80p'

echo -e "\n=== Checking the full sdkPath method implementation ==="
ast-grep --pattern 'private func sdkPath($$$) throws -> String {
  $$$
}'

echo -e "\n=== Checking the test implementation ==="
cat Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift | grep -A 15 "func loadMetadataXcodeKit"

Length of output: 1881


🏁 Script executed:

#!/bin/bash
# Get the full sdkPath method implementation
echo "=== Full sdkPath method implementation ==="
sed -n '/private func sdkPath/,/^[[:space:]]*}$/p' Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift

Length of output: 1422


@navtoj Great work on adding the test and implementing the error handling! I can see you've also moved the XcodeKit-specific path logic into the sdkPath method, which is a clean approach.

However, I notice that the parameter reassignment issue on line 70 is still present:

source = .developer  // This reassigns a function parameter

Since the test already passes .developer as the source when testing XcodeKit, and the sdkPath method correctly handles the special path for XcodeKit when source is .developer, this reassignment seems unnecessary. The caller should be responsible for providing the correct source value.

Consider removing the source = .developer line, as the validation for XcodeKit being macOS-only is sufficient, and the source should already be correctly set by the caller.


🧠 Learnings used
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeMetadata/Providers/**/* : Binary metadata extraction for frameworks and libraries should be implemented in `Sources/XcodeMetadata/Providers/`

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Linux support is available with limited testing; XcodeGraphMapperTests and XcodeMetadataTests require Xcode utilities

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Tests/Fixtures/**/* : XCFramework fixtures for metadata testing should be placed in `Tests/Fixtures/`

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraphMapper/Mappers/**/* : Conversion logic from XcodeProj to XcodeGraph models should be implemented in `Sources/XcodeGraphMapper/Mappers/`

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraph/Models/**/* : Core data structures like Project, Target, Scheme, and BuildConfiguration should be implemented in `Sources/XcodeGraph/Models/`

@coderabbitai
Copy link

coderabbitai bot commented Aug 8, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the current implementation of SystemFrameworkMetadataProvider.swift
echo "=== Current implementation of sdkPath method ==="
cat Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift | sed -n '50,100p'

echo -e "\n=== Check the complete loadMetadata method ==="
ast-grep --pattern 'func loadMetadata(
    $$$
) throws -> SystemFrameworkMetadata {
    $$$
}'

echo -e "\n=== Check the test implementation ==="
cat Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift | grep -A 15 "func test_loadMetadata_XcodeKit"

Length of output: 2598


🏁 Script executed:

#!/bin/bash
# Search for XcodeKit related tests with different patterns
echo "=== Searching for XcodeKit tests ==="
rg -A 20 "XcodeKit" Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift

echo -e "\n=== Check if there's a validation for source parameter ==="
ast-grep --pattern 'if sdkName == "XcodeKit.framework" {
    $$$
}'

Length of output: 2605


@navtoj Great work on addressing the feedback! The tests look comprehensive, and the error handling for unsupported platforms is well implemented.

I notice that on line 70, you're still reassigning the source parameter to .developer for XcodeKit.framework. Since XcodeKit only exists in the developer directory, consider either:

  1. Validating the source (throw an error if it's not .developer):
if sdkName == "XcodeKit.framework" {
    guard platform == .macOS else {
        throw SystemFrameworkMetadataProviderError
            .unsupportedSDKPlatform(sdk: sdkName, platform: platform, supported: [.macOS])
    }
    guard source == .developer else {
        throw SystemFrameworkMetadataProviderError
            .unsupportedSDKSource(sdk: sdkName, source: source, supported: [.developer])
    }
}
  1. Or documenting the override with a comment explaining why:
if sdkName == "XcodeKit.framework" {
    guard platform == .macOS else {
        throw SystemFrameworkMetadataProviderError
            .unsupportedSDKPlatform(sdk: sdkName, platform: platform, supported: [.macOS])
    }
    // XcodeKit.framework only exists in the developer directory, override the source
    source = .developer
}

The rest of the changes look solid - the test coverage is good and the path logic in the switch block is clean! 👍


🧠 Learnings used
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeMetadata/Providers/**/* : Binary metadata extraction for frameworks and libraries should be implemented in `Sources/XcodeMetadata/Providers/`

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Linux support is available with limited testing; XcodeGraphMapperTests and XcodeMetadataTests require Xcode utilities

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Tests/Fixtures/**/* : XCFramework fixtures for metadata testing should be placed in `Tests/Fixtures/`

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraphMapper/Mappers/**/* : Conversion logic from XcodeProj to XcodeGraph models should be implemented in `Sources/XcodeGraphMapper/Mappers/`

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraph/Models/**/* : Core data structures like Project, Target, Scheme, and BuildConfiguration should be implemented in `Sources/XcodeGraph/Models/`

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift (2)

16-18: Tighten error message consistency (platform display and naming)

Use platform.caseValue for the single platform (as you already do for the supported list) and rename the local var to reflect platforms, not types.

-        case let .unsupportedSDKPlatform(sdk, platform, supported):
-            let supportedTypes = supported.map { $0.caseValue }.joined(separator: ", ")
-            return "The Platform type of \(platform) is not currently supported for \(sdk) - only \(supportedTypes) are supported."
+        case let .unsupportedSDKPlatform(sdk, platform, supported):
+            let supportedPlatforms = supported.map { $0.caseValue }.joined(separator: ", ")
+            return "The platform \(platform.caseValue) is not supported for \(sdk) - only \(supportedPlatforms) are supported."

65-71: Avoid duplicating magic string “XcodeKit.framework” and improve readability

The special-casing appears twice (in loadMetadata and sdkPath). Consider centralizing the check and using a named constant.

+private let xcodeKitFrameworkName = "XcodeKit.framework"
@@
-        if sdkName == "XcodeKit.framework" {
+        if sdkName == xcodeKitFrameworkName {
@@
-            let xcodeDeveloperSdkRootPath = name == "XcodeKit.framework" ? "Library" : platform.xcodeDeveloperSdkRootPath
+            let xcodeDeveloperSdkRootPath = name == xcodeKitFrameworkName ? "Library" : platform.xcodeDeveloperSdkRootPath

Also applies to: 85-85

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d38ffdb and 48efa29.

📒 Files selected for processing (2)
  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift (3 hunks)
  • Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift
🧰 Additional context used
📓 Path-based instructions (2)
**/*.swift

📄 CodeRabbit Inference Engine (AGENT.md)

Use Swift 6.0.3+ with StrictConcurrency enabled

Files:

  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift
Sources/XcodeMetadata/Providers/**/*

📄 CodeRabbit Inference Engine (AGENT.md)

Binary metadata extraction for frameworks and libraries should be implemented in Sources/XcodeMetadata/Providers/

Files:

  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeMetadata/Providers/**/* : Binary metadata extraction for frameworks and libraries should be implemented in `Sources/XcodeMetadata/Providers/`
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraph/Models/**/* : Core data structures like Project, Target, Scheme, and BuildConfiguration should be implemented in `Sources/XcodeGraph/Models/`
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Linux support is available with limited testing; XcodeGraphMapperTests and XcodeMetadataTests require Xcode utilities
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Tests/Fixtures/**/* : XCFramework fixtures for metadata testing should be placed in `Tests/Fixtures/`
📚 Learning: 2025-08-07T14:29:08.174Z
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeMetadata/Providers/**/* : Binary metadata extraction for frameworks and libraries should be implemented in `Sources/XcodeMetadata/Providers/`

Applied to files:

  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift
📚 Learning: 2025-08-07T14:29:08.174Z
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Tests/Fixtures/**/* : XCFramework fixtures for metadata testing should be placed in `Tests/Fixtures/`

Applied to files:

  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift
📚 Learning: 2025-08-07T14:29:08.174Z
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraph/Models/**/* : Core data structures like Project, Target, Scheme, and BuildConfiguration should be implemented in `Sources/XcodeGraph/Models/`

Applied to files:

  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift
📚 Learning: 2025-08-07T14:29:08.174Z
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraph/Graph/**/* : Graph representation with dependencies and relationships should be implemented in `Sources/XcodeGraph/Graph/`

Applied to files:

  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift
📚 Learning: 2025-08-07T14:29:08.174Z
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraphMapper/Mappers/**/* : Conversion logic from XcodeProj to XcodeGraph models should be implemented in `Sources/XcodeGraphMapper/Mappers/`

Applied to files:

  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift
📚 Learning: 2025-08-07T14:29:08.174Z
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Linux support is available with limited testing; XcodeGraphMapperTests and XcodeMetadataTests require Xcode utilities

Applied to files:

  • Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift
🧬 Code Graph Analysis (1)
Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift (2)
Sources/XcodeGraphMapper/Mappers/Targets/PBXTarget+PlatformInference.swift (1)
  • platform (29-38)
Sources/XcodeGraph/Models/DeploymentTargets.swift (1)
  • macOS (65-67)
🔇 Additional comments (1)
Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift (1)

9-9: Good addition: explicit platform-specific error case

Adding unsupportedSDKPlatform improves diagnosability and keeps the API precise.

@coderabbitai
Copy link

coderabbitai bot commented Aug 8, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the current implementation of SystemFrameworkMetadataProvider.swift
echo "=== Checking loadMetadata method implementation ==="
cat Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift | sed -n '60,85p'

echo -e "\n=== Checking if source parameter is being reassigned ==="
grep -n "source = " Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift || echo "No source reassignment found"

echo -e "\n=== Checking the XcodeKit specific handling ==="
sed -n '/if sdkName == "XcodeKit.framework"/,/^[[:space:]]*}/p' Sources/XcodeMetadata/Providers/SystemFrameworkMetadataProvider.swift

echo -e "\n=== Checking test implementation for XcodeKit ==="
grep -A 20 "loadMetadataXcodeKit\|loadMetadataUnsupportedPlatform" Tests/XcodeMetadataTests/SystemFrameworkMetadataProviderTests.swift

Length of output: 3494


@navtoj Excellent work! I can confirm that you've successfully addressed all the feedback:

Edit 2 fix confirmed: You've resolved the parameter reassignment issue by using a local variable sdkSource instead of modifying the source parameter directly. This is a clean solution that maintains the immutability of the function parameter.

Test coverage: The tests for both the happy path (loadMetadataXcodeKit) and error case (loadMetadataUnsupportedPlatform) are comprehensive and well-structured.

Code consistency: The implementation now follows the existing switch/case pattern consistently.

The changes properly handle the XcodeKit framework path as requested in issue #262. Great job on the iterative improvements! 🎯


🧠 Learnings used
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeMetadata/Providers/**/* : Binary metadata extraction for frameworks and libraries should be implemented in `Sources/XcodeMetadata/Providers/`

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Tests/Fixtures/**/* : XCFramework fixtures for metadata testing should be placed in `Tests/Fixtures/`

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraph/Models/**/* : Core data structures like Project, Target, Scheme, and BuildConfiguration should be implemented in `Sources/XcodeGraph/Models/`

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeGraphMapper/Mappers/**/* : Conversion logic from XcodeProj to XcodeGraph models should be implemented in `Sources/XcodeGraphMapper/Mappers/`

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Linux support is available with limited testing; XcodeGraphMapperTests and XcodeMetadataTests require Xcode utilities

@navtoj navtoj changed the title Add XcodeKit Framework Path Add XcodeKit Framework Support Aug 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 9, 2025

Tip

For best results, initiate chat on the files or code changes.

@navtoj Thanks for the comprehensive update! I can confirm that all the changes you've made based on the feedback are excellent:

✅ The test for loadMetadata with XcodeKit framework coverage
✅ Consistent switch/case pattern implementation
✅ Error handling for unsupported platforms with clear messaging
✅ Parameter reassignment fix using the local sdkSource variable

The implementation properly addresses issue #262 and the code quality is solid. Great job on iterating through the feedback! 👍


🧠 Learnings used
Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Sources/XcodeMetadata/Providers/**/* : Binary metadata extraction for frameworks and libraries should be implemented in `Sources/XcodeMetadata/Providers/`

Learnt from: CR
PR: tuist/XcodeGraph#0
File: AGENT.md:0-0
Timestamp: 2025-08-07T14:29:08.174Z
Learning: Applies to Tests/Fixtures/**/* : XCFramework fixtures for metadata testing should be placed in `Tests/Fixtures/`

Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

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

Thanks for updating the tests, this looks good now 🙂

@fortmarek fortmarek changed the title Add XcodeKit Framework Support feat: add XcodeKit Framework Support Aug 11, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 11, 2025
@navtoj
Copy link
Contributor Author

navtoj commented Aug 11, 2025

@fortmarek This workflow requires approval from a maintainer.

I think its because I updated this line after the lint test failed.

@navtoj
Copy link
Contributor Author

navtoj commented Aug 11, 2025

@fortmarek All checks passed. I just need to update branch now?

image

Which option should I pick?


Edit 1

Soo.. I picked "Update with merge commit" and its asking for "workflow approval" again. Was I not supposed to press the "Update branch" button?

@fortmarek
Copy link
Member

Soo.. I picked "Update with merge commit" and its asking for "workflow approval" again. Was I not supposed to press the "Update branch" button?

As a first-time contributor, the workflow needs to be approved every time a new commit is pushed to the branch. I'll merge this once the CI passes 🙂

@fortmarek fortmarek merged commit d598000 into tuist:main Aug 11, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SDKSource for XcodeKit

2 participants