Skip to content

Rebase onto upstream 1.5.2#12

Open
doozMen wants to merge 16 commits intomainfrom
rebase-onto-upstream-1.5.2
Open

Rebase onto upstream 1.5.2#12
doozMen wants to merge 16 commits intomainfrom
rebase-onto-upstream-1.5.2

Conversation

@doozMen
Copy link
Owner

@doozMen doozMen commented Feb 14, 2026

Summary

  • Rebased fork onto upstream pointfreeco/sqlite-data 1.5.2 (10 new upstream commits)
  • Fixed unterminated block comment (#/*/) in Table+GRDB.swift
  • Added #if !compiler(>=6.2.3) guard to PrimaryKeyMigrationTests.swift
  • Kept all fork-specific changes (doozMen deps, CloudKit disabled for Swift 6.3, macOS 15 only)

Upstream commits gained

Test plan

  • swift build passes
  • swift test passes (221 tests, 2 known issues)

🤖 Generated with Claude Code

mbrandonw and others added 16 commits January 27, 2026 15:57
* Fix 'NULL DEFAULT _' migrations.

* clean up

* Add test for when old device makes change and syncs to new device.

* fixes

* clean up

* filter columnNames by allColumnNames

* clean up
* Fix user modification timestamp.

* wip
* Add a test for what happens with outside records.

* wip

* fix tests

* Skip records that don't have a userModificationTime.
* Fixes to date synchronization.

* add test for bad representation

* back out of pending changes stuff

* clean up

* wip
* Update start behavior for sync engine.

* wip

* wip

* wip

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
* Detect `SyncEngine.isSynchronizing` misuse in triggers

A warning is raised to suggest `$isSynchronizing`, instead.

* re-record snaps

* wip

* wip

* wip
* Fix preview temp directory for CKAsset

* reverted last commit

* forgot the foundation import from the revision

* fix

* added tests

* Use InMemoryDataManager for previews and fixed tests.

* Update inline snapshots.

* Delete Tests/SQLiteDataTests/Internal/TemporaryDirectoryDataManager.swift

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
"Claude PR Assistant workflow"

"Claude Code Review workflow"
… only (#1)

- Remove `import Perception` from FetchSubscription.swift (was unused)
- Add explicit `import ConcurrencyExtras` for LockIsolated
- Remove swift-perception package dependency from Package.swift
- Update platforms to macOS 15+ only (drop iOS/tvOS/watchOS)
- Update Package@swift-6.0.swift similarly

The Perception import was never actually used - the file only uses
LockIsolated (from ConcurrencyExtras) and SharedReader (from Sharing).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
… Swift 6.2.3+

- Fix #/ → */ typo in Table+GRDB.swift unterminated block comment
- Wrap PrimaryKeyMigrationTests.swift in #if !compiler(>=6.2.3) guard
  since migratePrimaryKeys is disabled on Swift 6.2.3+ due to compiler crash
- Update Package.resolved after rebase onto upstream 1.5.2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 14, 2026 16:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request rebases a fork onto upstream pointfreeco/sqlite-data version 1.5.2, incorporating 10 upstream commits while maintaining fork-specific changes. The PR addresses Swift 6.2.3/6.3 compiler compatibility issues by disabling problematic features through conditional compilation guards.

Changes:

  • Rebased onto upstream 1.5.2 with 10 new commits including CloudKit bug fixes, date synchronization improvements, and trigger enhancements
  • Added compiler guards to disable CloudKit on Swift 6.3+ and primary key migration on Swift 6.2.3+ due to compiler crashes
  • Switched to doozMen forks for GRDB, swift-sharing, and swift-perception to work around Swift 6.3 issues
  • Reduced platform support to macOS 15+ only (removed iOS, tvOS, watchOS support)
  • Changed test schemas from INTEGER PRIMARY KEY AUTOINCREMENT to INT PRIMARY KEY
  • Added GitHub Actions workflows for Claude Code integration

Reviewed changes

Copilot reviewed 65 out of 67 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
Sources/SQLiteData/CloudKit/*.swift Added && !compiler(>=6.3) guards to disable CloudKit on Swift 6.3+
Sources/SQLiteData/CloudKit/PrimaryKeyMigration.swift Disabled primary key migration on Swift 6.2.3+ with compiler guards
Sources/SQLiteData/CloudKit/SyncEngine.swift Multiple sync engine improvements including timestamp handling, record filtering, and API changes
Sources/SQLiteData/StructuredQueries+GRDB/Table+GRDB.swift Disabled PrimaryKeyedTable extension on Swift 6.2.3+
Sources/SQLiteData/Internal/ISO8601.swift Added .nextUp workaround for date precision issues
Sources/SQLiteData/FetchOne.swift Changed _OptionalProtocol to StructuredQueriesCore._OptionalProtocol
Tests/SQLiteDataTests/Internal/Schema.swift Changed schemas from INTEGER PRIMARY KEY AUTOINCREMENT to INT PRIMARY KEY
Tests/SQLiteDataTests/CloudKitTests/*.swift Updated test expectations for upstream changes and timestamp handling
Package.swift Reduced platforms to macOS 15+, switched to doozMen forks, updated swift-tools-version to 6.2.1
.github/workflows/*.yml Added Claude Code and Claude Code Review workflows

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,14 +1,11 @@
// swift-tools-version: 6.1
// swift-tools-version: 6.2.1
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.

The swift-tools-version has been increased from 6.1 to 6.2.1. This means the package now requires Swift 6.2.1+ to build, which may not be compatible with all development environments. Document this requirement clearly, especially since the PR also adds guards for Swift 6.2.3 and 6.3 issues.

Suggested change
// swift-tools-version: 6.2.1
// swift-tools-version: 6.2.1
//
// This package requires Swift 6.2.1 or newer to build.
// The manifest includes workarounds for known Swift 6.2.3 and 6.3 issues
// (for example, the Swift-DocC plugin conditional and forks with Swift 6.3 fixes),
// so older toolchains are not supported.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +3
// NB: migratePrimaryKeys is disabled on Swift 6.2.3+ due to compiler crash
// See: Sources/SQLiteData/CloudKit/PrimaryKeyMigration.swift
#if !compiler(>=6.2.3)
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.

The entire PrimaryKeyMigrationTests test suite is disabled on Swift 6.2.3+. This means critical migration functionality is untested on newer Swift versions. Consider:

  1. Adding a placeholder test that documents this limitation
  2. Tracking when the compiler bug is fixed so tests can be re-enabled
  3. Testing the migration feature manually on affected Swift versions before release

Copilot uses AI. Check for mistakes.
Comment on lines +1178 to +1180
await withErrorReporting(.sqliteDataCloudKitFailure) {
// NB: Fake 'sending' result.
nonisolated(unsafe) var result: T.QueryOutput?
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.

The nonisolated(unsafe) var result workaround to fake 'sending' is concerning. This bypasses Swift's concurrency checking and could introduce data races. The comment acknowledges this is a workaround. Consider filing an issue with the Swift compiler team and tracking this technical debt, as it undermines the safety guarantees of Swift 6's strict concurrency.

Copilot uses AI. Check for mistakes.
Comment on lines +1906 to +1911
guard
let recordPrimaryKey = serverRecord.recordID.recordPrimaryKey,
serverRecord.encryptedValues[CKRecord.userModificationTimeKey] != nil
else {
return
}
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.

The condition serverRecord.encryptedValues[CKRecord.userModificationTimeKey] != nil is added to guard against processing records without modification times. However, this silently skips records that might be valid but missing this field. Consider logging a warning or returning an error to make debugging easier when records are unexpectedly skipped.

Copilot uses AI. Check for mistakes.
? try DatabaseQueue(path: path)
: try DatabasePool(path: path)
_ = try database.write { db in
_ = try database.read { db in
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.

The change from database.write to database.read when checking database connectivity appears to be intentional (line 2244), but using a read operation to verify write access could miss write permission issues. If this change is necessary for metadatabase setup, add a comment explaining why read-only access is sufficient here.

Copilot uses AI. Check for mistakes.
containerIdentifier: String? = nil,
defaultZone: CKRecordZone = CKRecordZone(zoneName: "co.pointfree.SQLiteData.defaultZone"),
startImmediately: Bool = true,
startImmediately: Bool? = nil,
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.

The startImmediately parameter has been changed from Bool to Bool? with a default value of nil, which is then resolved to !isTesting. This is a breaking API change that could affect existing code that explicitly passes true or false. Consider keeping the signature as Bool with a default of nil internally, or document this as a breaking change.

Copilot uses AI. Check for mistakes.
stateSerialization: try? metadatabase.read { db in
try StateSerialization
.find(#bind(.private))
.where { $0.scope == #bind(.private) }
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.

The change from .find(#bind(.private)) to .where { $0.scope == #bind(.private) } alters the query semantics. The original used a primary key lookup which is more efficient, while the new version performs a table scan with a WHERE clause. Unless there's a specific reason for this change (e.g., a compiler bug), consider keeping the more efficient .find() approach.

Copilot uses AI. Check for mistakes.
Comment on lines +2444 to +2446
self.userModificationTime = #sql("""
max(\(self.userModificationTime), \(lastKnownServerRecord.userModificationTime))
""")
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.

Using max() to compare timestamps when updating userModificationTime could lead to unexpected behavior. If a stale server record arrives after a newer local change, this would prevent the timestamp from being rolled back. Consider if this is the intended behavior and document why max() is appropriate here.

Copilot uses AI. Check for mistakes.
extension Date {
@usableFromInline
var iso8601String: String {
let nextUpDate = Date(timeIntervalSinceReferenceDate: timeIntervalSinceReferenceDate.nextUp)
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.

The timeIntervalSinceReferenceDate.nextUp operation on Date is used to handle floating-point precision issues with ISO8601 formatting. This is a clever workaround but could cause subtle bugs if dates near the boundaries of representable values are used. Consider documenting why this is necessary and any edge cases where this could fail.

Copilot uses AI. Check for mistakes.
@@ -1,4 +1,4 @@
import Perception
import ConcurrencyExtras
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.

The import has changed from Perception to ConcurrencyExtras. Ensure that all functionality previously provided by the Perception module is still available through ConcurrencyExtras or other imports. This could be a breaking change if any public API exposed Perception types.

Copilot uses AI. Check for mistakes.
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.

5 participants