fix: drop hardcoded team prefix to support external-contributor builds#1028
Merged
datlechin merged 3 commits intoTableProApp:mainfrom May 6, 2026
Merged
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Member
|
Thank you. |
This was referenced May 6, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #1020. Makes the codebase portable across Apple Developer teams so external contributors can build and run a Debug build on a personal team without hand-patching files. Release behavior under the official
D7HJ5TFYCUteam is unchanged: codesign reproduces the same effective entitlements.Three failure modes were blocking external contributors:
TablePro.entitlementsdeclared the iCloud capability, which free personal teams don't support, so Xcode refused to create a profile.KeychainHelper.accessGrouphardcodedD7HJ5TFYCU.com.TablePro.shared, an access group only the official team can sign for. Every keychain write returnederrSecMissingEntitlement. Visible symptom: "Access denied (using password: NO)" on Test Connection because the password write silently failed.CloudKitSyncEngine.initcalledCKContainer(identifier:)unconditionally, which traps withEXC_BREAKPOINTon launch when the iCloud entitlement is absent.Approach
Three pure-source changes to support both teams from the same code, plus one new shipped file and a docs update:
TablePro.entitlementskeychain group is now$(AppIdentifierPrefix)com.TablePro.shared.codesignsubstitutes the active team's prefix at sign time, so the official build still signs asD7HJ5TFYCU.com.TablePro.sharedand a personal-team build signs as<their-prefix>.com.TablePro.shared. Removed the redundantapplication-identifierandteam-identifierkeys (codesign auto-injects these).KeychainHelperreadskeychain-access-groupsfrom the running process viaSecTaskCopyValueForEntitlementat init, prefers the entry ending in.com.TablePro.shared, and validates it matches^[A-Z0-9]{10}\..+(rejects unsubstituted$(...)templates from ad-hoc builds). When no valid group is declared,baseQuerysimply omitskSecAttrAccessGroup, letting the keychain fall back to the default per-app group.CloudKitSyncEngineadds astatic func hasICloudEntitlement()and makescontainer/databaseoptional.initonly constructs them when the entitlement is present; otherwise it logs a warning and stays disabled. Each methodguard let container/database else { throw SyncError.accountUnavailable }.SyncCoordinator.currentAccountIdwas reaching across into a duplicatedCKContainer(identifier:)literal — it now delegates to a newengine.currentAccountId()method, removing that duplication.TablePro/TablePro.Debug.entitlementsis new: identical to the default minus the iCloud keys. Contributors on personal teams point Debug builds at it instead of the iCloud-enabled file. iCloud sync degrades gracefully at runtime when the entitlement is absent (existingdo/catchpaths surface "iCloud unavailable" through the existing UI).Tests
TableProTests/Core/Sync/CloudKitSyncEngineTests.swift— 6 cases verifying the soft-dependency path. Each gates withtry #require(!CloudKitSyncEngine.hasICloudEntitlement())so it auto-skips when the test host happens to be signed with iCloud (otherwise the tests would hit real CloudKit). CoverscheckAccountStatus,ensureZoneExists,push(non-empty + empty short-circuit),pull, andcurrentAccountId.Contributor setup
CONTRIBUTING.mdadds a section on the one-time Xcode UI setup for non-official teams: Team selection (with note about repeating for other targets if signing fails), Bundle Identifier change, and switchingCode Signing Entitlementsto the new Debug variant. Also documents that the resultingpbxprojchanges shouldn't be committed (revert or usegit update-index --skip-worktree).CHANGELOG
Entry under
[Unreleased]→### Fixed. Fixes #1020.Test plan
swiftlint lint --strict— 0 violationsxcodebuild ... test -only-testing:TableProTests/CloudKitSyncEngineTestspasses locallycodesign -d --entitlements -should still showD7HJ5TFYCU.com.TablePro.sharedas the keychain access group)