Fix test-private integration: subscription dedup + notification name collision (v1.0.0-beta.2)#388
Merged
Merged
Conversation
…collision
Phase 15 (SubscriptionRoundtripPhase) crashed test-private with
subscriptionLikelyDuplicate. CloudKit dedupes query subscriptions by their
query+firesOn signature, not subscriptionID, so a leftover subscription from an
interrupted prior run blocked the create (which throws outside the phase's
do/catch and crashed at top level). Pre-sweep stale test subscriptions before
creating, making the phase self-healing.
With Phase 15 fixed, Phase 17 (NotificationRoundtripPhase) was reached for the
first time and failed deterministically: it named the trigger record the same as
the subscription ID (mistkit-notif-<suffix>), colliding with the internal
_sub_trigger_sub_<hash> record CloudKit provisions for the subscription
("invalid attempt to update record from type '_sub_trigger_sub_…' to 'Note'").
Give the trigger record a distinct name (mistkit-notif-rec-<suffix>).
Verified live against iCloud.com.brightdigit.MistDemo (private DB): all 18
phases pass, twice back-to-back; Phase 17 receives the actual push.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Context
CI run 26439176787 (v1.0.0-beta.2 MistDemo Integration) failed in the Live CloudKit Integration → test-private job with an illegal-instruction crash (exit 132). Root cause was two bugs in the MistDemo integration phases — one masking the other.
Bug 1 — Phase 15 subscription duplicate (the reported crash)
CloudKit deduplicates query subscriptions by their query +
firesOnsignature, not bysubscriptionID(seeSources/MistKit/Models/SubscriptionTarget.swift).SubscriptionRoundtripPhasealways creates a query subscription on recordTypeNotefiring on create/update/delete; the ID is a fresh UUID but the signature is identical every run. A subscription left over from an interrupted/failed prior run blocked the create, which throwssubscriptionLikelyDuplicateoutside the phase'sdo/catch(it only wrappedverify), so it propagated to the top level and crashed.Fix:
SubscriptionRoundtripPhasenow pre-sweeps stale test subscriptions (matching themistkit-itest-ID convention and the test's query signature) before creating — self-healing across runs, leaving the container clean. MistKit'ssubscriptionLikelyDuplicatebehavior is unchanged (correct by design).Bug 2 — Phase 17 notification name collision (newly reached)
With Phase 15 no longer crashing, Phase 17 (
NotificationRoundtripPhase) ran for the first time and failed deterministically: it named the trigger record identically to the subscription ID (mistkit-notif-<suffix>), colliding with the internal_sub_trigger_sub_<hash>record CloudKit provisions for the subscription —invalid attempt to update record from type '_sub_trigger_sub_…' to 'Note'.Fix: the trigger record now uses a distinct name (
mistkit-notif-rec-<suffix>).Verification
Run live against
iCloud.com.brightdigit.MistDemo(private DB) viaswift run mistdemo test-private --record-count 5 --asset-size 50:reason recordCreated).swift build,swift-format, andswiftlintall clean.Scope: MistDemo integration phases only — no MistKit library changes.
🤖 Generated with Claude Code