Repository navigation
fix(messaging): honour bundle IDs stored under the legacy credentials.bundle key - #14592
Conversation
….bundle key Until #14589, updating an APNs provider's bundle ID wrote it to credentials.bundle and left credentials.bundleId on the value from creation. Those rows still deliver and route with the old bundle ID, and the API shows it, until the provider is updated with a bundle ID again. Prefer a legacy `bundle` value wherever APNs credentials are read: the APNs adapter, push target routing and the Provider response model. Any update of the provider now promotes it into bundleId, so the row repairs itself on the next save. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review complete. No issues found — approved ✅. The change retires the legacy
Reviewed commit: daa9198 |
🟢 Tier S · Ready to merge
This change makes legacy APNs Latest changes: The newest commits add an end-to-end test that seeds a legacy APNs credential directly in the project database and verifies routing, API serialization, and promotion on a name-only provider update.
📂 Walkthrough · 6
Reviewed the commits since |
Security rulesNo new WARNING or ERROR findings from security rules. 19 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
…o end Seed an APNs provider's stored credentials with the legacy `bundle` key through the project database, since the API can no longer write it, and assert that create and update push target route by it, the provider API shows it as bundleId, and the next provider save repairs the row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
What does this PR do?
Since 1.5.0,
PATCH /v1/messaging/providers/apns/:providerIdwrote a changed bundle ID tocredentials.bundle, while everything readscredentials.bundleId. #14589 fixed the write. Rows saved before that fix still hold:credentials.bundleId: the bundle ID from creation (stale);credentials.bundle: the bundle ID the developer set later (current).Until such a provider is updated with a bundle ID again:
apns-topic);Only the update endpoint ever wrote
bundle, so when it's present it's always the newest value.Fix (read-time promotion, no data migration)
Wherever APNs credentials are read,
bundlewins overbundleId:Workers/Messaging.phpgetPushAdapter()bundle ?? bundleIdaccount.phpcreate and update push target routingbundle ?? bundleIdResponse/Model/Provider.phpfilter()bundleasbundleIdand hidebundleProviders/Apns/Update.phpbundleintobundleIdand unsets it, so the enable check passes and the row repairs itselfThere's no migration. Rows stay as they are until their next save, and every read already behaves as if they were repaired. The trade-off is that the
bundle ?? bundleIdreads stay in the code. A follow-up data migration (asrc/Appwrite/Migration/Versionstep plus a Cloud patch) could repair the rows and remove these reads.Test Plan
Unit:
tests/unit/Utopia/Response/Model/ProviderTest.php:bundleis shown asbundleIdand hidden;E2E:
testPushTargetRoutesApnsByLegacyBundleKeyinAccountCustomClientTest. The API can no longer write a legacy row, so the test seedscredentials.bundledirectly through the project database, using the samedatabaseFactoryaccess asTraits/InternalTableName.php. It asserts:GET /messaging/providers/:idshows it asbundleId;bundleIdand removesbundle;The worker's APNs adapter read is the same expression, and isn't exercised end to end because that would mean sending through Apple.
Locally:
php -land Pint on the changed files. Unit and e2e run in CI.Related PRs and Issues
appwrite/server-cebump.🤖 Generated with Claude Code