Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.3.3"),
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.9.0"),
// NB: Fork with Swift 6.3 fixes (uses doozMen/swift-perception)
.package(url: "https://github.com/doozMen/swift-sharing", branch: "main"),
// NB: Fork with Swift 6.3 fixes
.package(url: "https://github.com/doozMen/swift-sharing", branch: "fix/swift-623-optimizer-crash"),
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The dependency on the third-party package swift-sharing is pinned to a mutable Git branch (branch: "fix/swift-623-optimizer-crash"), which means future builds will automatically pick up any new commits pushed to that branch. If the doozMen/swift-sharing repository or this branch is ever compromised, an attacker can silently inject malicious code into your build artifacts without any change to this repository. To mitigate this supply-chain risk, pin the dependency to an immutable reference such as a specific tagged version or commit SHA and only update it intentionally after review.

Copilot uses AI. Check for mistakes.
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.18.4"),
Comment on lines +33 to 35
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

This PR also changes the swift-sharing dependency to a different branch, but the PR description only mentions the SwiftPM member-lookup/circular-reference fix. Please document why this dependency branch change is required here (or move it to a dedicated PR) to keep the change scoped and traceable.

Copilot uses AI. Check for mistakes.
// NB: Fork with Swift 6.3 fixes
.package(
Expand Down Expand Up @@ -70,9 +70,6 @@ let package = Package(
"SQLiteData",
.product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"),
.product(name: "CustomDump", package: "swift-custom-dump"),
.product(name: "Perception", package: "swift-perception"),
.product(name: "Sharing", package: "swift-sharing"),
.product(name: "StructuredQueriesSQLite", package: "swift-structured-queries"),
]
),
.testTarget(
Expand All @@ -82,7 +79,6 @@ let package = Package(
"SQLiteDataTestSupport",
.product(name: "DependenciesTestSupport", package: "swift-dependencies"),
.product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"),
package: "swift-tagged",
.product(name: "SnapshotTestingCustomDump", package: "swift-snapshot-testing"),
.product(name: "StructuredQueries", package: "swift-structured-queries"),
]
Expand Down
37 changes: 21 additions & 16 deletions Sources/SQLiteData/StructuredQueries+GRDB/Statement+GRDB.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,24 +186,29 @@ extension SelectStatement where QueryValue == (), Joins == () {
}
}

extension SelectStatement where QueryValue == (), From: PrimaryKeyedTable, Joins == () {
/// Returns a single value fetched from the database for a given primary key.
///
/// - Parameters
/// - db: A database connection.
/// - primaryKey: A primary key identifying a table row.
/// - Returns: A single value decoded from the database.
@inlinable
public func find(
_ db: Database,
key primaryKey: some QueryExpression<From.PrimaryKey>
) throws -> From.QueryOutput {
guard let record = try asSelect().find(primaryKey).fetchOne(db) else {
throw NotFound()
// NB: Swift 6.2.3 and 6.3-dev guard Select.find(_:) in swift-structured-queries due to compiler crashes.
// This extension depends on that method, so it must also be guarded.
// Tracking: https://github.com/swiftlang/swift/issues/82529
#if !compiler(>=6.2.3)
extension SelectStatement where QueryValue == (), From: PrimaryKeyedTable, Joins == () {
Comment on lines +189 to +193
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

PR description/title focus on the SwiftPM circular-reference fix, but this file also introduces a new compiler-version guard that removes SelectStatement.find(_:key:) on Swift 6.2.3+. Please update the PR description to mention this behavioral/API availability change (or split it into a separate PR) so reviewers/users understand why the method disappears on newer compilers.

Copilot uses AI. Check for mistakes.
/// Returns a single value fetched from the database for a given primary key.
///
/// - Parameters
/// - db: A database connection.
/// - primaryKey: A primary key identifying a table row.
/// - Returns: A single value decoded from the database.
@inlinable
public func find(
_ db: Database,
key primaryKey: some QueryExpression<From.PrimaryKey>
) throws -> From.QueryOutput {
guard let record = try asSelect().find(primaryKey).fetchOne(db) else {
throw NotFound()
}
return record
}
return record
}
}
#endif

@available(iOS 17, macOS 14, tvOS 17, watchOS 10, *)
extension SelectStatement where QueryValue == () {
Expand Down
2 changes: 1 addition & 1 deletion Sources/SQLiteData/StructuredQueries+GRDB/Table+GRDB.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extension StructuredQueriesCore.PrimaryKeyedTable {
try all.find(db, key: primaryKey)
}
}
#/
*/

// NB: Swift 6.2.3 and 6.3-dev guard Select.find(_:) in swift-structured-queries due to compiler crashes.
// This extension depends on that method, so it must also be guarded.
Expand Down
Loading