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.

feat(data-warehouse): implement hetzner import source (#70010)

Tom Owers72128f63c948
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md b/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md
index 6a9e348de8eb..7de38567bfe2 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md
@@ -215,6 +215,7 @@ the row lists both.
| healthchecks | HTTP | requests | ✅ |
| height | HTTP | requests | ✅ |
| hellobaton | HTTP | requests | ✅ |
+| hetzner | HTTP | requests | ✅ |
| hibob | HTTP | requests | ✅ |
| humanitix | HTTP | requests | ✅ |
| hubplanner | HTTP | requests | ✅ |
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs.py b/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs.py
index 2fc66c0f7851..fb13d12d17df 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs.py
@@ -1912,7 +1912,7 @@ class HerokuSourceConfig(config.Config):
@config.config
class HetznerSourceConfig(config.Config):
- pass
+ api_token: str
@config.config
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/canonical_descriptions.py
new file mode 100644
index 000000000000..ee091174a342
--- /dev/null
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/canonical_descriptions.py
@@ -0,0 +1,223 @@
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (
+ CanonicalDescriptions,
+)
+
+# Descriptions sourced from the official Hetzner Cloud API reference (https://docs.hetzner.cloud/).
+# Partial coverage is fine — any table, column, or endpoint not listed here falls back to LLM enrichment.
+_API_DOCS = "https://docs.hetzner.cloud/"
+
+CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
+ "servers": {
+ "description": "Cloud servers (virtual machines) in the project.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the server.",
+ "name": "Name of the server (unique per project, must be a valid hostname).",
+ "status": "Current lifecycle status (e.g. running, initializing, off).",
+ "created": "Point in time when the server was created (ISO 8601).",
+ "server_type": "The server type (cores, memory, disk, and pricing) the server runs on.",
+ "datacenter": "Datacenter the server is located in.",
+ "image": "Image the server was created from.",
+ "public_net": "Public network configuration (IPv4, IPv6, and attached floating IPs).",
+ "private_net": "Private networks the server is attached to.",
+ "labels": "User-defined key/value labels attached to the server.",
+ },
+ },
+ "volumes": {
+ "description": "Block storage volumes that can be attached to servers.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the volume.",
+ "name": "Name of the volume.",
+ "size": "Size of the volume in GB.",
+ "server": "ID of the server the volume is attached to, if any.",
+ "location": "Location the volume was created in.",
+ "created": "Point in time when the volume was created (ISO 8601).",
+ "format": "Filesystem the volume was formatted with, if any.",
+ },
+ },
+ "load_balancers": {
+ "description": "Load balancers distributing traffic across targets.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the load balancer.",
+ "name": "Name of the load balancer.",
+ "load_balancer_type": "The load balancer type (connection limits and pricing).",
+ "location": "Location of the load balancer.",
+ "services": "Configured services (listen/destination ports and health checks).",
+ "targets": "Targets the load balancer forwards traffic to.",
+ "created": "Point in time when the load balancer was created (ISO 8601).",
+ },
+ },
+ "networks": {
+ "description": "Private networks connecting servers within the project.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the network.",
+ "name": "Name of the network.",
+ "ip_range": "IP range of the whole network in CIDR notation.",
+ "subnets": "Subnets allocated inside the network.",
+ "routes": "Custom routes configured on the network.",
+ "servers": "IDs of servers attached to the network.",
+ "created": "Point in time when the network was created (ISO 8601).",
+ },
+ },
+ "firewalls": {
+ "description": "Firewalls with inbound/outbound rules applied to resources.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the firewall.",
+ "name": "Name of the firewall.",
+ "rules": "Inbound and outbound rules that make up the firewall.",
+ "applied_to": "Resources the firewall is applied to.",
+ "created": "Point in time when the firewall was created (ISO 8601).",
+ },
+ },
+ "images": {
+ "description": "Images (system, snapshot, backup, or app) available to create servers from.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the image.",
+ "type": "Type of the image (system, snapshot, backup, or app).",
+ "name": "Unique identifier of a system image (null for snapshots/backups).",
+ "description": "Human-readable description of the image.",
+ "status": "Whether the image is available or still being created.",
+ "created": "Point in time when the image was created (ISO 8601).",
+ "created_from": "The server the image was created from, if any.",
+ },
+ },
+ "floating_ips": {
+ "description": "Floating IPs that can be assigned between servers.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the floating IP.",
+ "type": "IP protocol version (ipv4 or ipv6).",
+ "ip": "The floating IP address.",
+ "server": "ID of the server the floating IP is assigned to, if any.",
+ "home_location": "Location where the floating IP was created and is routed.",
+ "created": "Point in time when the floating IP was created (ISO 8601).",
+ },
+ },
+ "primary_ips": {
+ "description": "Primary IPs bound to servers.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the primary IP.",
+ "type": "IP protocol version (ipv4 or ipv6).",
+ "ip": "The primary IP address.",
+ "assignee_id": "ID of the resource the primary IP is assigned to.",
+ "datacenter": "Datacenter the primary IP is located in.",
+ "created": "Point in time when the primary IP was created (ISO 8601).",
+ },
+ },
+ "certificates": {
+ "description": "TLS certificates (managed or uploaded) for use with load balancers.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the certificate.",
+ "name": "Name of the certificate.",
+ "type": "Whether the certificate is uploaded or managed by Hetzner.",
+ "domain_names": "Domains and subdomains the certificate is valid for.",
+ "not_valid_before": "Start of the certificate validity period.",
+ "not_valid_after": "End of the certificate validity period.",
+ "created": "Point in time when the certificate was created (ISO 8601).",
+ },
+ },
+ "ssh_keys": {
+ "description": "SSH public keys that can be injected into new servers.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the SSH key.",
+ "name": "Name of the SSH key.",
+ "fingerprint": "Fingerprint of the public key.",
+ "public_key": "The public key in OpenSSH format.",
+ "created": "Point in time when the SSH key was created (ISO 8601).",
+ },
+ },
+ "placement_groups": {
+ "description": "Placement groups controlling how servers are spread across physical hosts.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the placement group.",
+ "name": "Name of the placement group.",
+ "type": "Placement strategy (e.g. spread).",
+ "servers": "IDs of servers in the placement group.",
+ "created": "Point in time when the placement group was created (ISO 8601).",
+ },
+ },
+ "actions": {
+ "description": "Append-only history of every operation performed in the project (create, delete, attach, etc.).",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the action.",
+ "command": "Command the action ran (e.g. create_server, attach_volume).",
+ "status": "Status of the action (running, success, or error).",
+ "progress": "Progress of the action in percent.",
+ "started": "Point in time when the action started (ISO 8601).",
+ "finished": "Point in time when the action finished, or null if still running.",
+ "resources": "Resources the action operated on.",
+ "error": "Error details when the action failed.",
+ },
+ },
+ "server_types": {
+ "description": "Catalog of available server types with their resources and pricing.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the server type.",
+ "name": "Unique machine-readable name of the server type (e.g. cx22).",
+ "description": "Human-readable description of the server type.",
+ "cores": "Number of vCPU cores.",
+ "memory": "Memory in GB.",
+ "disk": "Local disk size in GB.",
+ "cpu_type": "Whether the CPU is shared or dedicated.",
+ "architecture": "CPU architecture (x86 or arm).",
+ "prices": "Per-location pricing for the server type.",
+ },
+ },
+ "load_balancer_types": {
+ "description": "Catalog of available load balancer types with limits and pricing.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the load balancer type.",
+ "name": "Unique machine-readable name of the load balancer type.",
+ "max_connections": "Maximum number of simultaneous open connections.",
+ "max_services": "Maximum number of services.",
+ "max_targets": "Maximum number of targets.",
+ "prices": "Per-location pricing for the load balancer type.",
+ },
+ },
+ "datacenters": {
+ "description": "Catalog of datacenters and the server types available in each.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the datacenter.",
+ "name": "Unique machine-readable name of the datacenter (e.g. fsn1-dc14).",
+ "description": "Human-readable description of the datacenter.",
+ "location": "Location the datacenter belongs to.",
+ "server_types": "Server types supported and available in the datacenter.",
+ },
+ },
+ "locations": {
+ "description": "Catalog of locations (cities/regions) where resources can be created.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the location.",
+ "name": "Unique machine-readable name of the location (e.g. fsn1).",
+ "description": "Human-readable description of the location.",
+ "country": "ISO 3166-1 country code of the location.",
+ "city": "City the location is in.",
+ "network_zone": "Network zone the location belongs to.",
+ },
+ },
+ "isos": {
+ "description": "Catalog of ISO images that can be mounted to servers.",
+ "docs_url": _API_DOCS,
+ "columns": {
+ "id": "Unique identifier of the ISO.",
+ "name": "Unique machine-readable name of the ISO, if any.",
+ "description": "Human-readable description of the ISO.",
+ "type": "Whether the ISO is public or private.",
+ "architecture": "CPU architecture the ISO is compatible with.",
+ },
+ },
+}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/hetzner.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/hetzner.py
new file mode 100644
index 000000000000..a7140ebd1346
--- /dev/null
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/hetzner.py
@@ -0,0 +1,237 @@
+import random
+import dataclasses
+from collections.abc import Iterator
+from email.utils import parsedate_to_datetime
+from typing import Any
+from urllib.parse import urlencode
+
+import requests
+from structlog.types import FilteringBoundLogger
+from tenacity import RetryCallState, retry, retry_if_exception_type, stop_after_attempt, wait_exponential_jitter
+
+from products.warehouse_sources.backend.temporal.data_imports.pipelines.pipeline.batcher import Batcher
+from products.warehouse_sources.backend.temporal.data_imports.pipelines.pipeline.typings import SourceResponse
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.http import make_tracked_session
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManager
+from products.warehouse_sources.backend.temporal.data_imports.sources.hetzner.settings import (
+ HETZNER_ENDPOINTS,
+ HetznerEndpointConfig,
+)
+
+# Single global base URL — Hetzner Cloud has no regional hosts.
+HETZNER_BASE_URL = "https://api.hetzner.cloud/v1"
+
+# Max page size the API accepts; anything larger is clamped by the server. Bigger pages mean fewer
+# round trips against the 3600 req/hour budget.
+PAGE_SIZE = 50
+
+# Cap on how long we honor a rate-limit reset before retrying anyway, so a misreported reset header
+# can't stall a worker past the activity heartbeat window.
+MAX_RETRY_AFTER_SECONDS = 300.0
+
+
+class HetznerRetryableError(Exception):
+ """Raised for transient responses (429 / 5xx). Carries the server-advertised retry delay when
+ the response provided one so the retry can wait exactly that long instead of guessing."""
+
+ def __init__(self, message: str, retry_after: float | None = None) -> None:
+ super().__init__(message)
+ self.retry_after = retry_after
+
+
+class HetznerResumeConfig:
+ # Page number to fetch first on resume. In-flight we checkpoint the CURRENT page after yielding a
+ # batch: a crash re-fetches that one page rather than skipping its un-yielded tail (dropping rows
+ # is worse than re-reading a page). On clean completion we advance the checkpoint PAST the last
+ # page so a spurious retry resumes onto an empty page instead of replaying. These tables are full
+ # refresh, so any rows a re-fetched page duplicates are bounded to that single page and are wiped
+ # by the next non-resumed run, which overwrites the table from scratch.
+ page: int = 1
+
+
+def _get_headers(api_token: str) -> dict[str, str]:
+ return {
+ "Authorization": f"Bearer {api_token}",
+ "Accept": "application/json",
+ }
+
+
+def _parse_retry_after(response: requests.Response) -> float | None:
+ """Prefer the standard `Retry-After` (seconds); fall back to `RateLimit-Reset` (unix epoch
+ seconds), which Hetzner returns on a throttled request. Returns None when neither is usable."""
+ retry_after = response.headers.get("Retry-After")
+ if retry_after:
+ try:
+ return float(retry_after)
+ except ValueError:
+ pass
+ reset = response.headers.get("RateLimit-Reset")
+ if reset:
+ try:
+ # Reset is an absolute epoch second; Date gives the server's "now" so we don't depend on
+ # local clock skew. Fall back to a small delay if the delta is nonsensical.
+ server_now = response.headers.get("Date")
+ if server_now:
+ now_ts = parsedate_to_datetime(server_now).timestamp()
+ delta = float(reset) - now_ts
+ return delta if delta > 0 else None
+ except (ValueError, TypeError):
+ pass
+ return None
+
+
+_backoff_wait = wait_exponential_jitter(initial=1, max=30)
+
+
+def _retry_wait(state: RetryCallState) -> float:
+ """Wait the server-advertised reset (capped, plus jitter) when we got one; otherwise exponential
+ backoff. Jitter keeps sources sharing one project token from all waking at the same reset instant."""
+ if state.outcome is not None and state.outcome.failed:
+ exc = state.outcome.exception()
+ if isinstance(exc, HetznerRetryableError) and exc.retry_after is not None:
+ return min(exc.retry_after, MAX_RETRY_AFTER_SECONDS) + random.uniform(0, 1)
+ return _backoff_wait(state)
+
+
+@retry(
+ retry=retry_if_exception_type(
+ (
+ HetznerRetryableError,
+ requests.ReadTimeout,
+ requests.ConnectionError,
+ # A mid-stream break on a chunked body; transient, so a fresh GET re-fetches the page.
+ requests.exceptions.ChunkedEncodingError,
+ )
+ ),
+ stop=stop_after_attempt(5),
+ wait=_retry_wait,
+ reraise=True,
+)
+def _fetch_page(
+ session: requests.Session, url: str, headers: dict[str, str], logger: FilteringBoundLogger
+) -> dict[str, Any]:
+ response = session.get(url, headers=headers, timeout=60)
+
+ # 429 (rate limited) and 5xx are transient — retry, honoring the reset header on a 429.
+ if response.status_code == 429 or response.status_code >= 500:
+ raise HetznerRetryableError(
+ f"Hetzner API error (retryable): status={response.status_code}, url={url}",
+ retry_after=_parse_retry_after(response) if response.status_code == 429 else None,
+ )
+
+ if not response.ok:
+ logger.error(f"Hetzner API error: status={response.status_code}, body={response.text}, url={url}")
+ response.raise_for_status()
+
+ return response.json()
+
+
+def _build_url(config: HetznerEndpointConfig, page: int) -> str:
+ params: dict[str, Any] = {"page": page, "per_page": PAGE_SIZE}
+ if config.sort:
+ params["sort"] = config.sort
+ return f"{HETZNER_BASE_URL}{config.path}?{urlencode(params)}"
+
+
+def validate_credentials(api_token: str) -> tuple[bool, str | None]:
+ """One cheap authenticated probe to confirm the token is genuine. Hetzner project tokens grant
+ read access to every resource in the project (a read-only token still reads all of them), so
+ there is no per-endpoint scope to check — a valid token can sync any table."""
+ url = f"{HETZNER_BASE_URL}/ssh_keys?per_page=1"
+ try:
+ # redact_values masks the token in logged URLs / captured samples; allow_redirects=False keeps
+ # a redirect from ever replaying the Authorization header (or the token in a query param) to
+ # another host. Mirrors the hardened transport other warehouse sources use.
+ session = make_tracked_session(redact_values=(api_token,), allow_redirects=False)
+ response = session.get(url, headers=_get_headers(api_token), timeout=10)
+ except requests.exceptions.RequestException as e:
+ return False, str(e)
+
+ if response.status_code == 200:
+ return True, None
+ if response.status_code in (401, 403):
+ return False, "Invalid Hetzner Cloud API token"
+ try:
+ message = response.json().get("error", {}).get("message", response.text)
+ except (ValueError, AttributeError):
+ message = response.text
+ return False, message
+
+
+def get_rows(
+ api_token: str,
+ endpoint: str,
+ logger: FilteringBoundLogger,
+ resumable_source_manager: ResumableSourceManager[HetznerResumeConfig],
+) -> Iterator[Any]:
+ config = HETZNER_ENDPOINTS[endpoint]
+ headers = _get_headers(api_token)
+ batcher = Batcher(logger=logger, chunk_size=2000, chunk_size_bytes=100 * 1024 * 1024)
+ # redact_values keeps the token out of tracked telemetry/samples; allow_redirects=False stops a
+ # redirect from ever forwarding the Authorization header to another host.
+ session = make_tracked_session(redact_values=(api_token,), allow_redirects=False)
+
+ resume = resumable_source_manager.load_state() if resumable_source_manager.can_resume() else None
+ page = resume.page if resume is not None else 1
+ if resume is not None:
+ logger.debug(f"Hetzner: resuming {endpoint} from page {page}")
+
+ last_page = page
+ while True:
+ data = _fetch_page(session, _build_url(config, page), headers, logger)
+ items = data.get(config.response_key) or []
+ if not items:
+ break
+
+ last_page = page
+ next_page = data.get("meta", {}).get("pagination", {}).get("next_page")
+ # Checkpoint the CURRENT page: on resume we re-fetch it rather than jumping to next_page and
+ # dropping this page's un-yielded tail. A re-fetch can re-yield rows already written, but that
+ # is bounded to one page and self-heals on the next full-refresh run.
+ checkpoint_page = page
+
+ for item in items:
+ batcher.batch(item)
+ if batcher.should_yield():
+ yield batcher.get_table()
+ resumable_source_manager.save_state(HetznerResumeConfig(page=checkpoint_page))
+
+ if not next_page:
+ break
+ page = next_page
+
+ if batcher.should_yield(include_incomplete_chunk=True):
+ yield batcher.get_table()
+
+ # Every page is now written. Advance the checkpoint past the last page so a crash between this
+ # final write and the activity completing resumes onto an empty page (a no-op) instead of
+ # replaying already-written pages from the last in-flight checkpoint and appending duplicates.
+ resumable_source_manager.save_state(HetznerResumeConfig(page=last_page + 1))
+
+
+def hetzner_source(
+ api_token: str,
+ endpoint: str,
+ logger: FilteringBoundLogger,
+ resumable_source_manager: ResumableSourceManager[HetznerResumeConfig],
+) -> SourceResponse:
+ endpoint_config = HETZNER_ENDPOINTS[endpoint]
+
+ return SourceResponse(
+ name=endpoint,
+ items=lambda: get_rows(
+ api_token=api_token,
+ endpoint=endpoint,
+ logger=logger,
+ resumable_source_manager=resumable_source_manager,
+ ),
+ primary_keys=endpoint_config.primary_keys,
+ # id:asc (or default order for the catalog endpoints) — rows arrive oldest-id first.
+ sort_mode="asc",
+ partition_count=1,
+ partition_size=1,
+ partition_mode="datetime" if endpoint_config.partition_key else None,
+ partition_format="week" if endpoint_config.partition_key else None,
+ partition_keys=[endpoint_config.partition_key] if endpoint_config.partition_key else None,
+ )
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/settings.py
new file mode 100644
index 000000000000..b3daf5391647
--- /dev/null
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/settings.py
@@ -0,0 +1,149 @@
+from dataclasses import dataclass, field
+from typing import Optional
+
+from products.warehouse_sources.backend.types import IncrementalField
+
+
+@dataclass
+class HetznerEndpointConfig:
+ name: str
+ path: str
+ # JSON envelope key the list lives under, e.g. {"servers": [...], "meta": {...}}.
+ response_key: str
+ # Stable, immutable datetime field to partition by (never a mutable `updated`-style field).
+ # None for the pricing-catalog endpoints, which carry no timestamps.
+ partition_key: Optional[str] = None
+ # Value passed to the API's `sort` param (Hetzner format, e.g. "id:asc"). Sorting a stable
+ # monotonic column ascending keeps new rows appending to the end so a full-refresh sync can't
+ # skip or duplicate rows across page boundaries. None leaves the endpoint at its default order
+ # (used for the small catalog endpoints, whose sort support we could not curl-verify).
+ sort: Optional[str] = None
+ primary_keys: list[str] = field(default_factory=lambda: ["id"])
+ should_sync_default: bool = True
+
+
+# The Hetzner Cloud API exposes no server-side timestamp filter on any list endpoint (no
+# `created_since` / `updated_after` / `id_gt`), so every table is full refresh only — there is no
+# cursor that would make an "incremental" sync cheaper than re-reading every page. Actions are
+# append-only and immutable, but without a server filter they too must be full refreshed. Sorting
+# by `id:asc` gives a stable ascending order so pagination stays consistent while a full refresh runs.
+HETZNER_ENDPOINTS: dict[str, HetznerEndpointConfig] = {
+ "servers": HetznerEndpointConfig(
+ name="servers",
+ path="/servers",
+ response_key="servers",
+ partition_key="created",
+ sort="id:asc",
+ ),
+ "volumes": HetznerEndpointConfig(
+ name="volumes",
+ path="/volumes",
+ response_key="volumes",
+ partition_key="created",
+ sort="id:asc",
+ ),
+ "load_balancers": HetznerEndpointConfig(
+ name="load_balancers",
+ path="/load_balancers",
+ response_key="load_balancers",
+ partition_key="created",
+ sort="id:asc",
+ ),
+ "networks": HetznerEndpointConfig(
+ name="networks",
+ path="/networks",
+ response_key="networks",
+ partition_key="created",
+ sort="id:asc",
+ ),
+ "firewalls": HetznerEndpointConfig(
+ name="firewalls",
+ path="/firewalls",
+ response_key="firewalls",
+ partition_key="created",
+ sort="id:asc",
+ ),
+ "images": HetznerEndpointConfig(
+ name="images",
+ path="/images",
+ response_key="images",
+ partition_key="created",
+ sort="id:asc",
+ ),
+ "floating_ips": HetznerEndpointConfig(
+ name="floating_ips",
+ path="/floating_ips",
+ response_key="floating_ips",
+ partition_key="created",
+ sort="id:asc",
+ ),
+ "primary_ips": HetznerEndpointConfig(
+ name="primary_ips",
+ path="/primary_ips",
+ response_key="primary_ips",
+ partition_key="created",
+ sort="id:asc",
+ ),
+ "certificates": HetznerEndpointConfig(
+ name="certificates",
+ path="/certificates",
+ response_key="certificates",
+ partition_key="created",
+ sort="id:asc",
+ ),
+ "ssh_keys": HetznerEndpointConfig(
+ name="ssh_keys",
+ path="/ssh_keys",
+ response_key="ssh_keys",
+ partition_key="created",
+ sort="id:asc",
+ ),
+ "placement_groups": HetznerEndpointConfig(
+ name="placement_groups",
+ path="/placement_groups",
+ response_key="placement_groups",
+ partition_key="created",
+ sort="id:asc",
+ ),
+ # Append-only audit history of every operation. No `created` field, so no datetime partition;
+ # `id` is monotonic, so sort ascending for stable pagination.
+ "actions": HetznerEndpointConfig(
+ name="actions",
+ path="/actions",
+ response_key="actions",
+ sort="id:asc",
+ ),
+ # Pricing / infrastructure catalog. Same for every project, no timestamps, small enough to fit a
+ # page or two, so no partitioning and no explicit sort.
+ "server_types": HetznerEndpointConfig(
+ name="server_types",
+ path="/server_types",
+ response_key="server_types",
+ ),
+ "load_balancer_types": HetznerEndpointConfig(
+ name="load_balancer_types",
+ path="/load_balancer_types",
+ response_key="load_balancer_types",
+ ),
+ "datacenters": HetznerEndpointConfig(
+ name="datacenters",
+ path="/datacenters",
+ response_key="datacenters",
+ ),
+ "locations": HetznerEndpointConfig(
+ name="locations",
+ path="/locations",
+ response_key="locations",
+ ),
+ "isos": HetznerEndpointConfig(
+ name="isos",
+ path="/isos",
+ response_key="isos",
+ ),
+}
+
+ENDPOINTS = tuple(HETZNER_ENDPOINTS.keys())
+
+# Hetzner has no server-side timestamp filter, so no endpoint advertises incremental fields. Kept
+# for parity with the other sources and so `get_schemas` can read a single source of truth.
+INCREMENTAL_FIELDS: dict[str, list[IncrementalField]] = {name: [] for name in HETZNER_ENDPOINTS}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/source.py
index 094eecac8200..26fa11504a64 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/source.py
@@ -1,19 +1,45 @@
-from typing import cast
+from typing import Optional, cast
from posthog.schema import (
DataWarehouseSourceCategory,
ExternalDataSourceType as SchemaExternalDataSourceType,
+ ReleaseStatus,
SourceConfig,
+ SourceFieldInputConfig,
+ SourceFieldInputConfigType,
)
-from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import FieldType, SimpleSource
+from products.warehouse_sources.backend.temporal.data_imports.pipelines.pipeline.typings import (
+ SourceInputs,
+ SourceResponse,
+)
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import FieldType, ResumableSource
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (
+ CanonicalDescriptions,
+)
from products.warehouse_sources.backend.temporal.data_imports.sources.common.registry import SourceRegistry
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManager
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.schema import SourceSchema
from products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs import HetznerSourceConfig
+from products.warehouse_sources.backend.temporal.data_imports.sources.hetzner.hetzner import (
+ HetznerResumeConfig,
+ hetzner_source,
+ validate_credentials as validate_hetzner_credentials,
+)
+from products.warehouse_sources.backend.temporal.data_imports.sources.hetzner.settings import (
+ ENDPOINTS,
+ HETZNER_ENDPOINTS,
+ INCREMENTAL_FIELDS,
+)
from products.warehouse_sources.backend.types import ExternalDataSourceType
@SourceRegistry.register
-class HetznerSource(SimpleSource[HetznerSourceConfig]):
+class HetznerSource(ResumableSource[HetznerSourceConfig, HetznerResumeConfig]):
+ # get_schemas iterates a static endpoint catalog with no I/O, so the table list is safe to
+ # publish in the public docs.
+ lists_tables_without_credentials = True
+
@property
def source_type(self) -> ExternalDataSourceType:
return ExternalDataSourceType.HETZNER
@@ -24,8 +50,88 @@ class HetznerSource(SimpleSource[HetznerSourceConfig]):
name=SchemaExternalDataSourceType.HETZNER,
category=DataWarehouseSourceCategory.ENGINEERING___MONITORING,
label="Hetzner Cloud",
- iconPath="/static/services/hetzner.png",
+ releaseStatus=ReleaseStatus.ALPHA,
+ caption="""Enter a Hetzner Cloud API token to sync your Hetzner Cloud project into the PostHog Data warehouse.
+
+Create a token under **Security > API tokens** in the [Hetzner Cloud Console](https://console.hetzner.cloud/). A `Read` token is enough. Each token is scoped to a single project, so connect one source per project you want to sync.""",
+ iconPath="/static/services/hetzner.svg",
+ docsUrl="https://posthog.com/docs/cdp/sources/hetzner",
keywords=["cloud", "infrastructure", "servers", "hosting"],
- fields=cast(list[FieldType], []),
- unreleasedSource=True,
+ fields=cast(
+ list[FieldType],
+ [
+ SourceFieldInputConfig(
+ name="api_token",
+ label="API token",
+ type=SourceFieldInputConfigType.PASSWORD,
+ required=True,
+ placeholder="",
+ secret=True,
+ ),
+ ],
+ ),
+ )
+
+ def get_canonical_descriptions(self) -> CanonicalDescriptions:
+ from products.warehouse_sources.backend.temporal.data_imports.sources.hetzner.canonical_descriptions import (
+ CANONICAL_DESCRIPTIONS,
+ )
+
+ return CANONICAL_DESCRIPTIONS
+
+ def get_non_retryable_errors(self) -> dict[str, str | None]:
+ return {
+ # A revoked or invalid token surfaces as an HTTPError when `_fetch_page` calls
+ # `raise_for_status()`. Retrying can never fix a credential problem, so stop the sync.
+ # Match the stable status text and base host, not the per-request path/query.
+ "401 Client Error: Unauthorized for url: https://api.hetzner.cloud": "Your Hetzner Cloud API token is invalid or has been revoked. Create a new token in the Hetzner Cloud Console, then reconnect.",
+ "403 Client Error: Forbidden for url: https://api.hetzner.cloud": "Your Hetzner Cloud API token does not have access to this project. Check the token and reconnect.",
+ }
+
+ def get_schemas(
+ self,
+ config: HetznerSourceConfig,
+ team_id: int,
+ with_counts: bool = False,
+ names: list[str] | None = None,
+ force_refresh: bool = False,
+ ) -> list[SourceSchema]:
+ # The Hetzner Cloud API has no server-side timestamp filter on any list endpoint, so every
+ # table is full refresh only — no incremental, no append (append would re-append the whole
+ # list every run and materialize duplicates).
+ def _build_schema(endpoint: str) -> SourceSchema:
+ endpoint_config = HETZNER_ENDPOINTS[endpoint]
+ return SourceSchema(
+ name=endpoint,
+ supports_incremental=False,
+ supports_append=False,
+ incremental_fields=INCREMENTAL_FIELDS.get(endpoint, []),
+ should_sync_default=endpoint_config.should_sync_default,
+ )
+
+ schemas = [_build_schema(endpoint) for endpoint in ENDPOINTS]
+ if names is not None:
+ names_set = set(names)
+ schemas = [s for s in schemas if s.name in names_set]
+ return schemas
+
+ def validate_credentials(
+ self, config: HetznerSourceConfig, team_id: int, schema_name: Optional[str] = None
+ ) -> tuple[bool, str | None]:
+ return validate_hetzner_credentials(config.api_token)
+
+ def get_resumable_source_manager(self, inputs: SourceInputs) -> ResumableSourceManager[HetznerResumeConfig]:
+ return ResumableSourceManager[HetznerResumeConfig](inputs, HetznerResumeConfig)
+
+ def source_for_pipeline(
+ self,
+ config: HetznerSourceConfig,
+ resumable_source_manager: ResumableSourceManager[HetznerResumeConfig],
+ inputs: SourceInputs,
+ ) -> SourceResponse:
+ return hetzner_source(
+ api_token=config.api_token,
+ endpoint=inputs.schema_name,
+ logger=inputs.logger,
+ resumable_source_manager=resumable_source_manager,
)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/tests/test_hetzner.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/tests/test_hetzner.py
new file mode 100644
index 000000000000..6ff72d626da7
--- /dev/null
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/tests/test_hetzner.py
@@ -0,0 +1,219 @@
+from typing import Any
+from urllib.parse import parse_qs, urlparse
+
+import pytest
+from unittest.mock import MagicMock, patch
+
+import requests
+from parameterized import parameterized
+
+from products.warehouse_sources.backend.temporal.data_imports.pipelines.pipeline.batcher import Batcher
+from products.warehouse_sources.backend.temporal.data_imports.sources.hetzner import hetzner
+from products.warehouse_sources.backend.temporal.data_imports.sources.hetzner.hetzner import (
+ HETZNER_BASE_URL,
+ HetznerResumeConfig,
+ HetznerRetryableError,
+ _build_url,
+ _parse_retry_after,
+ get_rows,
+ hetzner_source,
+ validate_credentials,
+)
+from products.warehouse_sources.backend.temporal.data_imports.sources.hetzner.settings import HETZNER_ENDPOINTS
+
+
+class _FakeResumableManager:
+ def __init__(self, state: HetznerResumeConfig | None = None) -> None:
+ self._state = state
+ self.saved: list[HetznerResumeConfig] = []
+
+ def can_resume(self) -> bool:
+ return self._state is not None
+
+ def load_state(self) -> HetznerResumeConfig | None:
+ return self._state
+
+ def save_state(self, data: HetznerResumeConfig) -> None:
+ self.saved.append(data)
+
+
+class _OneRowBatcher(Batcher):
+ """Force a yield after every row so pagination/resume checkpoints are observable without
+ materializing the 2000-row default chunk."""
+
+ def __init__(self, *args: Any, **kwargs: Any) -> None:
+ kwargs["chunk_size"] = 1
+ super().__init__(*args, **kwargs)
+
+
+def _mock_response(status_code: int, headers: dict[str, str] | None = None, body: Any = None) -> MagicMock:
+ response = MagicMock()
+ response.status_code = status_code
+ response.ok = 200 <= status_code < 300
+ response.headers = headers or {}
+ response.json.return_value = body if body is not None else {}
+ response.text = "" if body is None else str(body)
+ if not response.ok:
+ response.raise_for_status.side_effect = requests.HTTPError(
+ f"{status_code} Client Error for url: {HETZNER_BASE_URL}/servers", response=response
+ )
+ return response
+
+
+def _servers_page(items: list[dict], next_page: int | None) -> dict:
+ return {"servers": items, "meta": {"pagination": {"next_page": next_page}}}
+
+
+class TestBuildUrl:
+ def test_includes_pagination_and_sort(self) -> None:
+ url = _build_url(HETZNER_ENDPOINTS["servers"], page=3)
+ query = parse_qs(urlparse(url).query)
+ assert url.startswith(f"{HETZNER_BASE_URL}/servers?")
+ assert query["page"] == ["3"]
+ assert query["per_page"] == ["50"]
+ assert query["sort"] == ["id:asc"]
+
+ def test_catalog_endpoint_omits_sort(self) -> None:
+ # server_types has no verified sort support, so we must not send a sort param that could 400.
+ url = _build_url(HETZNER_ENDPOINTS["server_types"], page=1)
+ assert "sort" not in parse_qs(urlparse(url).query)
+
+
+class TestParseRetryAfter:
+ def test_prefers_retry_after_header(self) -> None:
+ response = _mock_response(429, headers={"Retry-After": "12"})
+ assert _parse_retry_after(response) == 12.0
+
+ def test_falls_back_to_ratelimit_reset_minus_server_now(self) -> None:
+ # Date parses to 1445412480 (server's "now"); reset is 60s later, so we wait ~60s using the
+ # server clock rather than the local one (which may be skewed).
+ response = _mock_response(
+ 429,
+ headers={"RateLimit-Reset": "1445412540", "Date": "Wed, 21 Oct 2015 07:28:00 GMT"},
+ )
+ assert _parse_retry_after(response) == 60.0
+
+ def test_returns_none_without_usable_headers(self) -> None:
+ assert _parse_retry_after(_mock_response(429)) is None
+
+
+class TestValidateCredentials:
+ @parameterized.expand(
+ [
+ ("valid", 200, None, True),
+ ("unauthorized", 401, None, False),
+ ("forbidden", 403, None, False),
+ ]
+ )
+ def test_status_maps_to_validity(self, _name: str, status: int, body: Any, expected: bool) -> None:
+ session = MagicMock()
+ session.get.return_value = _mock_response(status, body=body)
+ with patch.object(hetzner, "make_tracked_session", return_value=session):
+ valid, _message = validate_credentials("token")
+ assert valid is expected
+
+ def test_network_error_is_invalid_not_raised(self) -> None:
+ session = MagicMock()
+ session.get.side_effect = requests.ConnectionError("boom")
+ with patch.object(hetzner, "make_tracked_session", return_value=session):
+ valid, message = validate_credentials("token")
+ assert valid is False
+ assert message == "boom"
+
+
+class TestFetchPageRetries:
+ @parameterized.expand([("rate_limited", 429), ("server_error", 503)])
+ def test_transient_status_raises_retryable(self, _name: str, status: int) -> None:
+ session = MagicMock()
+ session.get.return_value = _mock_response(status, headers={"Retry-After": "1"} if status == 429 else {})
+ with patch.object(hetzner._fetch_page.retry, "sleep", lambda *_: None): # type: ignore[attr-defined]
+ with pytest.raises(HetznerRetryableError):
+ hetzner._fetch_page(session, f"{HETZNER_BASE_URL}/servers", {}, MagicMock())
+ # 5 attempts (stop_after_attempt(5)) before giving up.
+ assert session.get.call_count == 5
+
+ def test_retries_then_succeeds(self) -> None:
+ session = MagicMock()
+ session.get.side_effect = [
+ requests.ReadTimeout("slow"),
+ _mock_response(200, body=_servers_page([], None)),
+ ]
+ with patch.object(hetzner._fetch_page.retry, "sleep", lambda *_: None): # type: ignore[attr-defined]
+ result = hetzner._fetch_page(session, f"{HETZNER_BASE_URL}/servers", {}, MagicMock())
+ assert result == _servers_page([], None)
+ assert session.get.call_count == 2
+
+ def test_client_error_is_not_retried(self) -> None:
+ # A 404/401 is fatal; raising HTTPError immediately (not retrying) lets get_non_retryable_errors act.
+ session = MagicMock()
+ session.get.return_value = _mock_response(401)
+ with pytest.raises(requests.HTTPError):
+ hetzner._fetch_page(session, f"{HETZNER_BASE_URL}/servers", {}, MagicMock())
+ assert session.get.call_count == 1
+
+
+class TestGetRows:
+ @staticmethod
+ def _collect(manager: _FakeResumableManager, responses: dict[int, dict], endpoint: str = "servers") -> list[dict]:
+ def fake_fetch(session: Any, url: str, headers: dict[str, str], logger: Any) -> dict:
+ page = int(parse_qs(urlparse(url).query)["page"][0])
+ return responses[page]
+
+ rows: list[dict] = []
+ with patch.object(hetzner, "_fetch_page", fake_fetch):
+ for table in get_rows("token", endpoint, MagicMock(), manager): # type: ignore[arg-type]
+ rows.extend(table.to_pylist())
+ return rows
+
+ def test_paginates_until_next_page_is_null(self) -> None:
+ responses = {
+ 1: _servers_page([{"id": 1}, {"id": 2}], next_page=2),
+ 2: _servers_page([{"id": 3}], next_page=None),
+ }
+ rows = self._collect(_FakeResumableManager(), responses)
+ assert [r["id"] for r in rows] == [1, 2, 3]
+
+ def test_stops_when_response_key_empty(self) -> None:
+ rows = self._collect(_FakeResumableManager(), {1: _servers_page([], next_page=2)})
+ assert rows == []
+
+ def test_resumes_from_saved_page(self) -> None:
+ # A saved page must skip already-synced pages instead of restarting at page 1.
+ responses = {2: _servers_page([{"id": 99}], next_page=None)}
+ rows = self._collect(_FakeResumableManager(HetznerResumeConfig(page=2)), responses)
+ assert [r["id"] for r in rows] == [99]
+
+ def test_checkpoints_current_page_then_advances_past_end(self) -> None:
+ # In-flight we checkpoint the CURRENT page (not next_page) so a crash re-fetches that page
+ # instead of skipping its un-yielded tail and dropping rows. On completion we advance the
+ # checkpoint past the last page so a post-final-write crash resumes onto an empty page rather
+ # than replaying already-written pages into the full-refresh table.
+ responses = {
+ 1: _servers_page([{"id": 1}, {"id": 2}], next_page=2),
+ 2: _servers_page([{"id": 3}], next_page=None),
+ }
+ manager = _FakeResumableManager()
+ with patch.object(hetzner, "Batcher", _OneRowBatcher):
+ self._collect(manager, responses)
+ saved_pages = [state.page for state in manager.saved]
+ # Page 1 yields twice (checkpoint 1), page 2 yields once (checkpoint 2), then the completion
+ # sentinel advances to page 3 (the empty page past the end).
+ assert saved_pages == [1, 1, 2, 3]
+
+
+class TestHetznerSourceResponse:
+ def test_datetime_partition_for_resource_endpoint(self) -> None:
+ response = hetzner_source("token", "servers", MagicMock(), MagicMock())
+ assert response.name == "servers"
+ assert response.primary_keys == ["id"]
+ assert response.sort_mode == "asc"
+ assert response.partition_mode == "datetime"
+ assert response.partition_keys == ["created"]
+
+ @parameterized.expand([("actions",), ("server_types",), ("locations",)])
+ def test_no_partition_for_timestampless_endpoints(self, endpoint: str) -> None:
+ # actions has no `created`; catalog endpoints carry no timestamps — partitioning on a null or
+ # absent field would rewrite partitions every sync, so these must stay unpartitioned.
+ response = hetzner_source("token", endpoint, MagicMock(), MagicMock())
+ assert response.partition_mode is None
+ assert response.partition_keys is None
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/tests/test_hetzner_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/tests/test_hetzner_source.py
new file mode 100644
index 000000000000..eab0a6ae8a71
--- /dev/null
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/tests/test_hetzner_source.py
@@ -0,0 +1,111 @@
+from unittest import mock
+
+from parameterized import parameterized
+
+from posthog.schema import ReleaseStatus, SourceFieldInputConfig, SourceFieldInputConfigType
+
+from products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs import HetznerSourceConfig
+from products.warehouse_sources.backend.temporal.data_imports.sources.hetzner.hetzner import HetznerResumeConfig
+from products.warehouse_sources.backend.temporal.data_imports.sources.hetzner.settings import ENDPOINTS
+from products.warehouse_sources.backend.temporal.data_imports.sources.hetzner.source import HetznerSource
+from products.warehouse_sources.backend.types import ExternalDataSourceType
+
+
+class TestHetznerSource:
+ def setup_method(self) -> None:
+ self.source = HetznerSource()
+ self.team_id = 1
+
+ def test_source_type(self) -> None:
+ assert self.source.source_type == ExternalDataSourceType.HETZNER
+
+ def test_config_has_single_secret_token_field(self) -> None:
+ # The token is a credential — it must render as a masked password input and be marked secret,
+ # or it would be stored/echoed in plaintext.
+ config = self.source.get_source_config
+ assert config.releaseStatus == ReleaseStatus.ALPHA
+ assert config.docsUrl == "https://posthog.com/docs/cdp/sources/hetzner"
+ fields = config.fields
+ assert len(fields) == 1
+ field = fields[0]
+ assert isinstance(field, SourceFieldInputConfig)
+ assert field.name == "api_token"
+ assert field.type == SourceFieldInputConfigType.PASSWORD
+ assert field.required is True
+ assert field.secret is True
+
+ def test_all_endpoints_are_full_refresh_only(self) -> None:
+ # Hetzner exposes no server-side timestamp filter, so no table may advertise incremental or
+ # append — otherwise the picker offers a mode that either syncs nothing new or duplicates rows.
+ schemas = self.source.get_schemas(mock.MagicMock(), self.team_id)
+ assert {s.name for s in schemas} == set(ENDPOINTS)
+ for schema in schemas:
+ assert schema.supports_incremental is False, schema.name
+ assert schema.supports_append is False, schema.name
+ assert schema.incremental_fields == []
+
+ def test_get_schemas_filters_by_names(self) -> None:
+ schemas = self.source.get_schemas(mock.MagicMock(), self.team_id, names=["servers", "volumes"])
+ assert {s.name for s in schemas} == {"servers", "volumes"}
+
+ @parameterized.expand(
+ [
+ (
+ "unauthorized",
+ "401 Client Error: Unauthorized for url: https://api.hetzner.cloud/v1/servers?page=1",
+ ),
+ (
+ "forbidden",
+ "403 Client Error: Forbidden for url: https://api.hetzner.cloud/v1/volumes",
+ ),
+ ]
+ )
+ def test_credential_errors_are_non_retryable(self, _name: str, observed_error: str) -> None:
+ non_retryable = self.source.get_non_retryable_errors()
+ assert any(key in observed_error for key in non_retryable)
+
+ @parameterized.expand(
+ [
+ ("rate_limited", "429 Client Error: Too Many Requests for url: https://api.hetzner.cloud/v1/servers"),
+ ("server_error", "503 Server Error for url: https://api.hetzner.cloud/v1/servers"),
+ ]
+ )
+ def test_transient_errors_stay_retryable(self, _name: str, observed_error: str) -> None:
+ non_retryable = self.source.get_non_retryable_errors()
+ assert not any(key in observed_error for key in non_retryable)
+
+ def test_validate_credentials_delegates_to_transport(self) -> None:
+ config = HetznerSourceConfig(api_token="tok")
+ with mock.patch(
+ "products.warehouse_sources.backend.temporal.data_imports.sources.hetzner.source.validate_hetzner_credentials",
+ return_value=(True, None),
+ ) as validate:
+ result = self.source.validate_credentials(config, self.team_id)
+ validate.assert_called_once_with("tok")
+ assert result == (True, None)
+
+ def test_resumable_manager_bound_to_resume_config(self) -> None:
+ inputs = mock.MagicMock()
+ manager = self.source.get_resumable_source_manager(inputs)
+ assert manager._data_class is HetznerResumeConfig
+
+ def test_source_for_pipeline_plumbs_schema_name(self) -> None:
+ config = HetznerSourceConfig(api_token="tok")
+ inputs = mock.MagicMock()
+ inputs.schema_name = "servers"
+ response = self.source.source_for_pipeline(config, mock.MagicMock(), inputs)
+ assert response.name == "servers"
+ assert response.primary_keys == ["id"]
+
+ def test_documented_tables_published_for_docs(self) -> None:
+ # lists_tables_without_credentials must stay on so the public docs render the table catalog.
+ assert self.source.lists_tables_without_credentials is True
+ tables = self.source.get_documented_tables()
+ names = {t["name"] for t in tables}
+ assert set(ENDPOINTS).issubset(names)
+
+ def test_canonical_descriptions_key_on_real_endpoints(self) -> None:
+ # A description keyed on a name that isn't an endpoint never reaches enrichment (silent typo).
+ descriptions = self.source.get_canonical_descriptions()
+ assert set(descriptions).issubset(set(ENDPOINTS))
+ assert "servers" in descriptions