Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(platform-features): rename dataclasses to domain-concept names (#76159)

Arno Hillene213c575799f
diff --git a/posthog/api/proxy_record_diagnostics.py b/posthog/api/proxy_record_diagnostics.py
index 1d54468a201d..dab388627598 100644
--- a/posthog/api/proxy_record_diagnostics.py
+++ b/posthog/api/proxy_record_diagnostics.py
@@ -27,7 +27,7 @@ from posthog.exceptions_capture import capture_exception
from posthog.models import ProxyRecord
from posthog.temporal.proxy_service.cloudflare import (
CloudflareAPIError,
- CustomHostnameInfo,
+ CustomHostname,
CustomHostnameSSLStatus,
get_custom_hostname_by_domain,
)
@@ -327,7 +327,7 @@ def _check_cname(record: ProxyRecord) -> CheckResult:
)
-def _check_cloudflare(record: ProxyRecord) -> tuple[CheckResult, Optional[CustomHostnameInfo]]:
+def _check_cloudflare(record: ProxyRecord) -> tuple[CheckResult, Optional[CustomHostname]]:
try:
info = get_custom_hostname_by_domain(record.domain)
except CloudflareAPIError as e:
@@ -436,7 +436,7 @@ def _check_cloudflare(record: ProxyRecord) -> tuple[CheckResult, Optional[Custom
)
-def _check_caa(record: ProxyRecord, hostname_info: Optional[CustomHostnameInfo], *, is_cloudflare: bool) -> CheckResult:
+def _check_caa(record: ProxyRecord, hostname_info: Optional[CustomHostname], *, is_cloudflare: bool) -> CheckResult:
"""
Walk up the DNS tree from `record.domain` to apex, looking for the first non-empty
set of CAA records. Per RFC 8659, the first non-empty CAA result wins — climbing
@@ -515,7 +515,7 @@ def _extract_caa_issuers(answer: dns.resolver.Answer) -> list[str]:
return issuers
-def _check_http_challenge(record: ProxyRecord, hostname_info: CustomHostnameInfo) -> CheckResult:
+def _check_http_challenge(record: ProxyRecord, hostname_info: CustomHostname) -> CheckResult:
challenge_url = hostname_info.ssl.http_url
expected_body = hostname_info.ssl.http_body
if not challenge_url or not expected_body:
diff --git a/posthog/api/test/test_proxy_record_diagnostics.py b/posthog/api/test/test_proxy_record_diagnostics.py
index da6fb154ca45..f93cbf520dc5 100644
--- a/posthog/api/test/test_proxy_record_diagnostics.py
+++ b/posthog/api/test/test_proxy_record_diagnostics.py
@@ -9,7 +9,7 @@ from parameterized import parameterized
from posthog.api import proxy_record_diagnostics as diagnostics
from posthog.temporal.proxy_service.cloudflare import (
CloudflareAPIError,
- CustomHostnameInfo,
+ CustomHostname,
CustomHostnameSSL,
CustomHostnameSSLStatus,
CustomHostnameStatus,
@@ -36,8 +36,8 @@ def _hostname_info(
http_url: str | None = "http://e.example.com/.well-known/acme-challenge/tok",
http_body: str | None = "tok.body",
certificate_authority: str | None = "google",
-) -> CustomHostnameInfo:
- return CustomHostnameInfo(
+) -> CustomHostname:
+ return CustomHostname(
id="hostname-id",
hostname="e.example.com",
status=CustomHostnameStatus.ACTIVE,
diff --git a/posthog/temporal/proxy_service/cloudflare.py b/posthog/temporal/proxy_service/cloudflare.py
index 47918f1b4ced..1210bcdc93ae 100644
--- a/posthog/temporal/proxy_service/cloudflare.py
+++ b/posthog/temporal/proxy_service/cloudflare.py
@@ -107,7 +107,7 @@ class CustomHostnameSSL:
@dataclass
-class CustomHostnameInfo:
+class CustomHostname:
"""Information about a Custom Hostname."""
id: str
@@ -126,10 +126,10 @@ def _get_headers() -> dict[str, str]:
}
-def _parse_hostname(result: dict) -> "CustomHostnameInfo":
- """Build a CustomHostnameInfo from a Cloudflare API custom_hostname result object."""
+def _parse_hostname(result: dict) -> "CustomHostname":
+ """Build a CustomHostname from a Cloudflare API custom_hostname result object."""
ssl_payload = result.get("ssl", {})
- return CustomHostnameInfo(
+ return CustomHostname(
id=result["id"],
hostname=result["hostname"],
status=CustomHostnameStatus(result["status"]),
@@ -162,7 +162,7 @@ def _handle_response(response: requests.Response) -> dict:
return data
-def create_custom_hostname(domain: str) -> CustomHostnameInfo:
+def create_custom_hostname(domain: str) -> CustomHostname:
"""
Create a Custom Hostname in Cloudflare for SaaS.
@@ -175,7 +175,7 @@ def create_custom_hostname(domain: str) -> CustomHostnameInfo:
domain: The customer's domain (e.g., "analytics.customer.com")
Returns:
- CustomHostnameInfo with the created hostname details
+ CustomHostname with the created hostname details
Raises:
CloudflareAPIError: If the API request fails
@@ -195,7 +195,7 @@ def create_custom_hostname(domain: str) -> CustomHostnameInfo:
return _parse_hostname(data["result"])
-def get_custom_hostname(hostname_id: str) -> t.Optional[CustomHostnameInfo]:
+def get_custom_hostname(hostname_id: str) -> t.Optional[CustomHostname]:
"""
Get details of a Custom Hostname by ID.
@@ -203,7 +203,7 @@ def get_custom_hostname(hostname_id: str) -> t.Optional[CustomHostnameInfo]:
hostname_id: The Cloudflare Custom Hostname ID
Returns:
- CustomHostnameInfo or None if not found
+ CustomHostname or None if not found
Raises:
CloudflareAPIError: If the API request fails (except for 404)
@@ -219,7 +219,7 @@ def get_custom_hostname(hostname_id: str) -> t.Optional[CustomHostnameInfo]:
return _parse_hostname(data["result"])
-def get_custom_hostname_by_domain(domain: str) -> t.Optional[CustomHostnameInfo]:
+def get_custom_hostname_by_domain(domain: str) -> t.Optional[CustomHostname]:
"""
Find a Custom Hostname by domain name.
@@ -227,7 +227,7 @@ def get_custom_hostname_by_domain(domain: str) -> t.Optional[CustomHostnameInfo]
domain: The customer's domain (e.g., "analytics.customer.com")
Returns:
- CustomHostnameInfo or None if not found
+ CustomHostname or None if not found
Raises:
CloudflareAPIError: If the API request fails