Skip to content

Create FoundationLabCore and define the first shared boundary#120

Open
rudrankriyam wants to merge 1 commit intomainfrom
stack/110-foundationlabcore
Open

Create FoundationLabCore and define the first shared boundary#120
rudrankriyam wants to merge 1 commit intomainfrom
stack/110-foundationlabcore

Conversation

@rudrankriyam
Copy link
Owner

Closes #110

Summary

  • add a new local Swift package, FoundationLabCore, as the first shared architectural seam
  • define minimal core conventions for capability use cases, requests, results, domain errors, and provider protocols
  • wire the package into the app target through a local Swift package dependency in the Xcode project

Why

This creates the first clean dependency boundary for later App Intents and CLI work without moving any major user-facing features yet.

Verification

  • swift test in FoundationLabCore
  • xcodebuild -project FoundationLab.xcodeproj -scheme "Foundation Lab" -destination "platform=macOS" build
  • app build completed with no warnings

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: associatedtype Result shadows Swift's built-in Result type
    • Renamed the associated type to Output and updated execute to return it, avoiding the standard library Result name collision.

Create PR

Or push these changes by commenting:

@cursor push 24b27fa83a
Preview (24b27fa83a)
diff --git a/FoundationLabCore/Sources/FoundationLabCore/Capabilities/Capability.swift b/FoundationLabCore/Sources/FoundationLabCore/Capabilities/Capability.swift
--- a/FoundationLabCore/Sources/FoundationLabCore/Capabilities/Capability.swift
+++ b/FoundationLabCore/Sources/FoundationLabCore/Capabilities/Capability.swift
@@ -19,9 +19,9 @@
 /// A task-oriented use case that can be shared by the app, App Intents, and CLI adapters.
 public protocol CapabilityUseCase: Sendable {
     associatedtype Request: CapabilityRequest
-    associatedtype Result: CapabilityResult
+    associatedtype Output: CapabilityResult
 
     static var descriptor: CapabilityDescriptor { get }
 
-    func execute(_ request: Request) async throws -> Result
+    func execute(_ request: Request) async throws -> Output
 }

/// A task-oriented use case that can be shared by the app, App Intents, and CLI adapters.
public protocol CapabilityUseCase: Sendable {
associatedtype Request: CapabilityRequest
associatedtype Result: CapabilityResult
Copy link
Contributor

Choose a reason for hiding this comment

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

associatedtype Result shadows Swift's built-in Result type

Medium Severity

The associatedtype Result in CapabilityUseCase shadows Swift's built-in Swift.Result type. Any type conforming to this protocol will find that Result resolves to the associated type rather than Swift.Result, leading to confusing compiler errors when trying to use Swift.Result for error handling within conforming types. This is a well-known Swift antipattern that creates friction for every future implementer of this protocol.

Fix in Cursor Fix in Web

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.

[Stack 1/9] Create FoundationLabCore package and define dependency rules

1 participant