Skip to content

fix: throw accountUnavailable from CloudKitSyncEngine.currentAccountId for consistency#1036

Merged
datlechin merged 1 commit intomainfrom
fix/cloudkit-current-account-id-consistency
May 6, 2026
Merged

fix: throw accountUnavailable from CloudKitSyncEngine.currentAccountId for consistency#1036
datlechin merged 1 commit intomainfrom
fix/cloudkit-current-account-id-consistency

Conversation

@datlechin
Copy link
Copy Markdown
Member

Fixes #1034.

Summary

CloudKitSyncEngine has six methods that touch the optional container/database. Five throw SyncError.accountUnavailable when the entitlement is absent; the sixth, currentAccountId, returned nil instead. This PR makes it throw, matching its peers.

The single caller (SyncCoordinator.checkAccountStatus at TablePro/Core/Sync/SyncCoordinator.swift:632) already wraps the call in try?, so the observable behavior is unchanged. The fix is a contract-tightening only.

The matching test in TableProTests/Core/Sync/CloudKitSyncEngineTests.swift flips from currentAccountIdReturnsNil to currentAccountIdThrows, mirroring the other five test cases.

CHANGELOG

No entry: this tightens an internal contract on a feature still in [Unreleased] (added by #1028, not yet released).

Test plan

  • swiftlint lint --strict clean (no Swift body changes touch lint rules)
  • xcodebuild ... test -only-testing:TableProTests/CloudKitSyncEngineTests passes (skips when host is iCloud-entitled)

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin datlechin merged commit e30898c into main May 6, 2026
2 checks passed
@datlechin datlechin deleted the fix/cloudkit-current-account-id-consistency branch May 6, 2026 11:07
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.

CloudKitSyncEngine.currentAccountId returns nil while peer methods throw accountUnavailable

1 participant