Skip to content

fix(cdn): create TLS activations for issued Fastly subscriptions - #14114

Merged
HarshMN2345 merged 7 commits into
mainfrom
claude/fastly-tls-activations
Oct 5, 2026
Merged

HarshMN2345 merged 7 commits into
mainfrom
claude/fastly-tls-activations

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Draft. Hold until it is confirmed that TLS activations are how subscription-issued certificates get attached to hostnames. Fastly documents POST /tls/activations as enabling TLS for a domain using a custom certificate; this PR uses it for certificates issued through a TLS subscription. Before merging, check a custom domain that already serves HTTPS correctly: if it has no TLS activation either, activations are not the mechanism and this PR should be closed.

When FastlyTls has a TLS configuration id, it ensures a TLS activation exists for every hostname on an issued or renewing subscription before reporting that status:

  • It uses the certificate with the latest not_after, so a renewal attaches the new certificate.
  • An existing activation is left alone.
  • A 409 is re-checked rather than taken as success, because it can mean another certificate already holds the hostname.
  • An issued subscription with no certificate on it yet reports processing.

Fastly takes tlsConfigurationId as a constructor parameter and forwards it; it was hardcoded empty. An empty id keeps today's behaviour exactly: the subscription stays unpinned and nothing is activated, so nothing changes until a deployment sets the id. A Site custom domain is handled by the network provider (Proxy::select() routes site, network and redirect there), so that is the provider that needs it.

Test Plan

  • FastlyTlsTest: activates a missing apex, www and multi-SAN certificate (newest not_after); skips an existing activation; accepts a 409 once our certificate is confirmed attached and fails when another certificate holds the hostname; reports processing for an issued or renewing subscription with no certificate; throws when activation fails; sends no activation request without a TLS configuration.
  • FastlyTest: given an id, an issued subscription gets a POST /tls/activations carrying it; given none, no activation request is made.

packages/cdn passes locally: tests, Pint, PHPStan against the package baseline, Rector. These are canned-response tests. They prove the request is built correctly, not that Fastly accepts it or that the edge then serves the right certificate.

Related PRs and Issues

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Generated by Claude Code

Split out of #14009 so it can be judged on its own.

When FastlyTls has a TLS configuration id, an issued or renewing
subscription gets a TLS activation for every hostname on it, using the
certificate that expires last. A 409 is re-checked rather than taken as
success, since it can mean another certificate already holds the
hostname. An issued subscription that carries no certificate yet reports
processing.

Fastly takes the id as a constructor parameter and forwards it; it was
hardcoded empty. Empty keeps today's behaviour exactly: the subscription
stays unpinned and nothing is activated.
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → claude/fastly-tls-activations (after).

Metric Before After Change
🚀 Requests/sec 203.83 204.77 ⚪ +0.5%
⏱️ Latency P50 84.62 ms 84.21 ms ⚪ -0.5%
⏱️ Latency P95 200.39 ms 201.2 ms ⚪ +0.4%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 84.21 201.2 12,597 204.77 +0.82
Account 160.31 299.04 663 11.05 -2.62
TablesDB 79.41 154.03 6,851 112.55 -1.55
Storage 82.24 179.13 3,315 56.75 +2.82
Functions 124.32 245.02 1,768 30.87 -3.1

Top API waits (after)

API request Max wait (ms)
account.name.update 421.57
account.prefs.update 382.62
storage.buckets.create 369.09
functions.variables.update 354.59
tablesdb.rows.increment 354.56

…tions

No behaviour change.

- Comments and docblocks cut to the density of the rest of FastlyTls.
- tlsConfigurationId moves to the end of Fastly's constructor, so
  positional callers keep working.
- getCertificateStatus checks activation before the existing issued
  branch, which is identical to main again.
- hostnames() and references() lose guards for ids Fastly never returns
  empty, and issuedCertificateId() a check array_last() already covers.
- Tests use the file's existing subscription() and json() helpers instead
  of a second fixture builder and hand-built responses. The www case is
  dropped: the apex and multi-SAN cases already cover it.
@HarshMN2345
HarshMN2345 force-pushed the claude/fastly-tls-activations branch from 69b1b6b to 0deb57f Compare October 5, 2026 08:04
@HarshMN2345
HarshMN2345 marked this pull request as ready for review October 5, 2026 08:26
@ghost

ghost commented Oct 5, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The incremental test-helper refactor preserves the existing extraction behavior and introduces no identified defects.

Adds optional TLS configuration forwarding to Fastly and ensures hostname activations before reporting issued or renewing subscriptions. It selects the latest-expiring certificate, reports processing when none is available, and updates existing activations only when their certificate belongs to the same subscription. The latest changes inline the test helper's relationship-ID extraction without changing its behavior.

Latest changes: The new commit inlines relationship-ID extraction in the activation test helper, removes the separate reference helper, and broadens the return type annotation.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 4
File Change
packages/cdn/src/Certificates/Provider/Fastly.php Accepts and forwards an optional TLS configuration ID.
packages/cdn/src/Certificates/Provider/FastlyTls.php Selects subscription certificates and creates or updates hostname activations while rejecting unrelated certificates.
packages/cdn/tests/Certificates/Provider/FastlyTest.php Covers configuration forwarding and configuration-free behavior.
packages/cdn/tests/Certificates/Provider/FastlyTlsTest.php Covers activation and renewal behavior, conflicts and failures; inlines relationship-ID extraction in the test helper.

Reviewed the commits since 331e4c3 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Tier B · 1 blocking finding to address. Summary

Activate once extractRenewDate() finds an issued or renewing certificate instead of reading the state again, and build the hostname list where it is used.
…cate

The activation lookup filtered on the new certificate, so after a renewal it missed the activation still on the previous one, the create conflicted, and every retry threw. Look the hostname's activation up on the TLS configuration alone: keep it when it already holds the new certificate, move it when it holds one of the subscription's older certificates, and fail as before when another certificate holds the hostname.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Tier S · Looks good to merge. Summary

@HarshMN2345
HarshMN2345 merged commit 5a00f2a into main Oct 5, 2026
1 check passed
abnegate added a commit that referenced this pull request Oct 5, 2026
Merges main a2cca78 (#14009, #14106, #14117, #14115, #14119, #14114,
#14101, #14125, #14129, #14127) so cloud#5410 can require a train head
that contains main at or after 0ed7232.

Conflicts: none.

Database 8.0 port: none needed. Main's new code only uses Document
getAttribute/setAttribute and Query::equal/lessThan/orderAsc/limit
(Tasks/Interval.php), all unchanged in database 8.0; no removed
Database::* constants, config collections, or model magic reads.
composer.json and composer.lock are untouched by main, so the train's
database and migration pins stay as they are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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