Skip to content

Fix test-private integration: subscription dedup + notification name collision (v1.0.0-beta.2)#388

Merged
leogdion merged 2 commits into
v1.0.0-beta.2from
MistKit-push-fix
May 26, 2026
Merged

Fix test-private integration: subscription dedup + notification name collision (v1.0.0-beta.2)#388
leogdion merged 2 commits into
v1.0.0-beta.2from
MistKit-push-fix

Conversation

@leogdion
Copy link
Copy Markdown
Member

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 + firesOn signature, not by subscriptionID (see Sources/MistKit/Models/SubscriptionTarget.swift). SubscriptionRoundtripPhase always creates a query subscription on recordType Note firing 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 throws subscriptionLikelyDuplicate outside the phase's do/catch (it only wrapped verify), so it propagated to the top level and crashed.

Fix: SubscriptionRoundtripPhase now pre-sweeps stale test subscriptions (matching the mistkit-itest- ID convention and the test's query signature) before creating — self-healing across runs, leaving the container clean. MistKit's subscriptionLikelyDuplicate behavior 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) via swift run mistdemo test-private --record-count 5 --asset-size 50:

  • All 18 phases pass, twice back-to-back (confirming the Phase 15 pre-sweep self-heals).
  • Phase 17 receives the actual push (reason recordCreated).
  • swift build, swift-format, and swiftlint all clean.

Scope: MistDemo integration phases only — no MistKit library changes.

🤖 Generated with Claude Code

…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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 08a46833-b80d-4d55-ae35-6a608b5c58ed

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch MistKit-push-fix

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@leogdion leogdion changed the base branch from main to v1.0.0-beta.2 May 26, 2026 11:24
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@leogdion leogdion marked this pull request as ready for review May 26, 2026 12:43
@leogdion leogdion merged commit 89d19b8 into v1.0.0-beta.2 May 26, 2026
6 of 70 checks passed
@leogdion leogdion deleted the MistKit-push-fix branch May 26, 2026 15:35
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.

1 participant