Skip to content

fix(cdn): recover Fastly certificates and preserve DNS failure details - #222

Open
HarshMN2345 wants to merge 4 commits into
mainfrom
codex/fix-fastly-orphan-domains
Open

fix(cdn): recover Fastly certificates and preserve DNS failure details#222
HarshMN2345 wants to merge 4 commits into
mainfrom
codex/fix-fastly-orphan-domains

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Sep 7, 2026

Copy link
Copy Markdown
Member

Fastly can return service_id: null for both classic domains and unlinked versionless domains. The managed provider previously treated both as classic, so an orphan could remain without a service association or TLS subscription indefinitely. It now links a confirmed orphan to the configured service before requesting TLS.

Ownership checks preserve classic exact and wildcard routes across services, existing routing configurations, and TLS-first transfers between services. Repair requires unrestricted token and user visibility through /tokens/self, /current_user, and the complete service inventory. Failed lookups, malformed responses, incomplete results, and insufficient permissions stop mutation.

Certificate polling now reads the subscription's referenced TLS authorizations. An explicit failed subscription or blocked authorization throws Utopia\Cdn\Exception\Certificate, carrying its status, provider instructions, and relevant DNS record types, names, and values. Pending warnings remain pending; an issued subscription stays issued even if an included authorization is stale. Unrelated authorization details are excluded.

Deletion removes owned orphan records before their TLS subscription so retries can finish partial cleanup. It preserves domains belonging to other services, routing configurations, and wildcard routes, and refuses to delete shared TLS subscriptions. Missing-domain cleanup also checks classic ownership before removing TLS.

Validation:

  • Full CDN suite: 203 tests, 432 assertions.
  • bin/monorepo check cdn: Pint, PHPStan, and Rector pass.
  • bin/monorepo validate and git diff --check pass.
  • Regression coverage includes orphan issuance and renewal, ownership and permissions, incomplete or malformed provider responses, blocked DNS instructions, stale authorizations, shared subscriptions, and retrying partial deletion.

The CDN suite uses scripted HTTP responses; it does not perform live Fastly, DNS, or CA E2E requests.

Companion Appwrite retry handling: appwrite/appwrite#13467. Cloud status handling: https://github.com/appwrite-labs/cloud/pull/5639.

@HarshMN2345 HarshMN2345 changed the title fix(cdn): repair unlinked Fastly domains before TLS issuance fix(cdn): recover Fastly certificates and preserve DNS failure details Sep 7, 2026
@HarshMN2345
HarshMN2345 marked this pull request as ready for review September 7, 2026 13:01
* @param array{resource:array<string, mixed>,included:array<int, array<string, mixed>>} $subscription
* @return list<string>|null
*/
private function getSubscriptionDomains(array $subscription): ?array

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets have exact params

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.

2 participants