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): add 5 missing tables to the Linode source (#118704)

Tom Owers0a2fbdb46c98
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
index 2cec5931fc59..f9477c45a6a1 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
@@ -7326,10 +7326,10 @@ Diffed against: <https://raw.githubusercontent.com/linode/linode-api-openapi/mai
- [x] `linode/types` — lookup resolving the plan type ID on every Linode instance we sync, plus its hourly/monthly price and specs (high)
- [x] `regions (and regions/availability)` — lookup resolving the region ID carried on instances, volumes, nodebalancers and buckets (high)
- [x] `account/transfer` — network transfer pool usage vs quota - the headline overage-risk metric (high)
-- [ ] `linode/instances/{linodeId}/transfer/{year}/{month}` — per-instance monthly bandwidth usage, the breakdown behind account-level transfer (medium)
-- [ ] `images` — custom and recovery images with size and expiry; a billed resource with no coverage today (medium)
-- [ ] `databases/instances (plus databases/types)` — managed database inventory, a billed service class entirely absent from the current tables (medium)
-- [ ] `lke/clusters/{clusterId}/pools` — node pool composition and autoscaling settings - the breakdown of the LKE clusters we already sync (medium)
+- [x] `linode/instances/{linodeId}/transfer/{year}/{month}` — per-instance monthly bandwidth usage, the breakdown behind account-level transfer (medium)
+- [x] `images` — custom and recovery images with size and expiry; a billed resource with no coverage today (medium)
+- [x] `databases/instances (plus databases/types)` — managed database inventory, a billed service class entirely absent from the current tables (medium)
+- [x] `lke/clusters/{clusterId}/pools` — node pool composition and autoscaling settings - the breakdown of the LKE clusters we already sync (medium)
- [ ] `nodebalancers/{nodeBalancerId}/configs (+ /nodes)` — backend node membership per nodebalancer, resolving which instances sit behind each load balancer (medium)
- [ ] `object-storage/buckets (+ object-storage/transfer, quotas usage)` — per-bucket size and object count plus transfer usage for storage cost attribution (medium)
- [ ] `support/tickets (+ /{ticketId}/replies)` — support ticket volume and response history (medium)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linode/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linode/canonical_descriptions.py
index 890a3981be66..3e52dc760b18 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linode/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linode/canonical_descriptions.py
@@ -178,4 +178,91 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"placement_group_limits": "The placement group limits for the region.",
},
},
+ "images": {
+ "description": "Disk images available to the account: private images (manual or automatic recovery images) and public distribution images.",
+ "docs_url": "https://techdocs.akamai.com/linode-api/reference/get-images",
+ "columns": {
+ "id": "The unique id of the image. Private image ids begin with private/, public ones with linode/.",
+ "label": "A short description of the image.",
+ "description": "A detailed description of the image.",
+ "type": "How the image was created: manual, automatic (from a deleted Linode), or shared.",
+ "is_public": "Whether the image is a public distribution image rather than a private, account-specific one.",
+ "status": "The current status of the image (available, creating or pending_upload).",
+ "size": "The minimum size in MB the image needs to deploy.",
+ "total_size": "The total size in bytes of all copies of the image, in all regions.",
+ "regions": "The regions where the image is stored, with the status in each region.",
+ "created_by": "The name of the user who created the image, or linode for public images.",
+ "vendor": "The upstream distribution vendor. Null for private images.",
+ "deprecated": "Whether the public image is deprecated.",
+ "eol": "When the public image is planned to be removed from service. Null for private images.",
+ "expiry": "When an automatic image expires. Only automatic images expire.",
+ "created": "When the image was created.",
+ "updated": "When the image was last updated.",
+ },
+ },
+ "databases": {
+ "description": "Managed Database clusters on the account, for every engine (MySQL, PostgreSQL and Valkey).",
+ "docs_url": "https://techdocs.akamai.com/linode-api/reference/get-databases-instances",
+ "columns": {
+ "id": "The unique id of the Managed Database.",
+ "label": "The name of the Managed Database, unique per engine type.",
+ "engine": "The Managed Database engine type (e.g. mysql or postgresql).",
+ "version": "The Managed Database engine version.",
+ "type": "The id of the database plan type used for the nodes. Joins to the id column on database_types.",
+ "region": "The region where the Managed Database lives. Joins to the id column on regions.",
+ "status": "The operating status of the Managed Database (e.g. provisioning, active, suspended, resizing).",
+ "cluster_size": "The number of nodes in the Managed Database cluster, from 1 to 3.",
+ "platform": "The back-end platform for relational databases, either rdbms-legacy or rdbms-default.",
+ "total_disk_size_gb": "The total disk size of the database, in GB.",
+ "used_disk_size_gb": "The amount of disk space in use, in GB. Null for Valkey.",
+ "hosts": "The primary hostname and standby read-only hostname of the Managed Database.",
+ "allow_list": "The IP addresses and CIDR ranges that can access the Managed Database.",
+ "updates": "The settings for automated patch update maintenance.",
+ "created": "When the Managed Database was created.",
+ "updated": "When the Managed Database was last updated.",
+ },
+ },
+ "database_types": {
+ "description": "Managed Database node plan types with their specs and prices per engine. Joins to the type column on databases.",
+ "docs_url": "https://techdocs.akamai.com/linode-api/reference/get-databases-types",
+ "columns": {
+ "id": "The id of the Managed Database node plan type.",
+ "label": "A human-readable name of the plan type.",
+ "class": "The class category of the plan type (e.g. dedicated, shared).",
+ "vcpus": "The number of CPUs allocated to databases of this plan type.",
+ "memory": "The amount of RAM allocated to databases of this plan type, in MB.",
+ "disk": "The disk space set aside for databases of this plan type, in MB.",
+ "engines": "The prices for each supported engine and cluster size.",
+ },
+ },
+ "lke_node_pools": {
+ "description": "Node pools of the LKE (Kubernetes) clusters on the account, with their size and autoscaling settings.",
+ "docs_url": "https://techdocs.akamai.com/linode-api/reference/get-lke-cluster-pools",
+ "columns": {
+ "cluster_id": "The id of the LKE cluster the node pool belongs to. Joins to the id column on lke_clusters.",
+ "id": "The unique id of the node pool.",
+ "label": "The optional label of the node pool.",
+ "type": "The Linode type for all of the nodes in the pool. Joins to the id column on linode_types.",
+ "count": "The number of nodes in the node pool.",
+ "autoscaler": "Whether autoscaling is enabled, and the minimum and maximum number of nodes.",
+ "nodes": "Status information for the nodes in the pool, including the Linode instance id of each node.",
+ "disk_encryption": "The local disk encryption status of the node pool, either enabled or disabled.",
+ "labels": "Kubernetes labels added to the nodes in the node pool.",
+ "taints": "Kubernetes taints added to the nodes in the node pool.",
+ "tags": "Tags applied to the node pool.",
+ },
+ },
+ "linode_monthly_transfer": {
+ "description": "Public network transfer of each Linode per calendar month. The row for the current month covers the past 30 days and changes until the month ends.",
+ "docs_url": "https://techdocs.akamai.com/linode-api/reference/get-linode-transfer-by-year-month",
+ "columns": {
+ "linode_id": "The id of the Linode. Joins to the id column on linodes.",
+ "year": "The year of the month the row covers.",
+ "month": "The month (1 to 12) the row covers.",
+ "month_start": "The first day of the month the row covers.",
+ "bytes_in": "The inbound public network traffic received by the Linode in the month, in bytes.",
+ "bytes_out": "The outbound public network traffic sent by the Linode in the month, in bytes.",
+ "bytes_total": "The total public network traffic sent and received by the Linode in the month, in bytes.",
+ },
+ },
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linode/linode.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linode/linode.py
index ed63cb1d5529..43cb35f7e7a6 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linode/linode.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linode/linode.py
@@ -1,19 +1,25 @@
import json
import dataclasses
-from collections.abc import Callable, Iterable
-from datetime import date, datetime
+from collections.abc import Callable, Iterable, Iterator
+from datetime import UTC, date, datetime
from typing import Any, Optional, cast
+from requests.exceptions import HTTPError
+
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.datetime_utils import parse_datetime_value
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.rest_source import (
RESTAPIConfig,
+ RESTClient,
rest_api_resource,
)
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.config_setup import create_auth
from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.fanout import (
build_dependent_resource,
)
from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.paginators import (
PageNumberPaginator,
+ SinglePagePaginator,
)
from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.typing import (
ClientConfig,
@@ -24,6 +30,8 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.sou
from products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceResponse
from products.warehouse_sources.backend.temporal.data_imports.sources.linode.settings import (
LINODE_ENDPOINTS,
+ LINODE_MONTHLY_TRANSFER,
+ MONTHLY_TRANSFER_LOOKBACK_MONTHS,
PAGE_SIZE,
LinodeEndpointConfig,
)
@@ -100,6 +108,14 @@ def linode_source(
) -> SourceResponse:
config = LINODE_ENDPOINTS[endpoint]
+ if endpoint == LINODE_MONTHLY_TRANSFER:
+ return _monthly_transfer_source(
+ api_token,
+ config,
+ resumable_source_manager,
+ db_incremental_field_last_value if should_use_incremental_field else None,
+ )
+
headers = _accept_headers()
# Attach the X-Filter header for incremental/append endpoints. Honor the user's chosen cursor
# field, falling back to the endpoint's declared filterable field. On the first sync the watermark
@@ -163,8 +179,8 @@ def _fanout_source(
job_id: str,
) -> SourceResponse:
assert config.fanout is not None
- # No resume state: the parent invoice list is small (one invoice per billing period), so a
- # restarted run re-walks it cheaply.
+ # No resume state: the parent lists (invoices, LKE clusters) are small, so a restarted run
+ # re-walks them cheaply.
dependent_resource = cast(
Iterable[Any],
build_dependent_resource(
@@ -184,6 +200,83 @@ def _fanout_source(
return _make_source_response(config, endpoint, lambda: dependent_resource)
+def _current_month_start() -> datetime:
+ now = datetime.now(UTC)
+ return datetime(now.year, now.month, 1, tzinfo=UTC)
+
+
+def _month_start(value: Any) -> datetime | None:
+ parsed = parse_datetime_value(value)
+ if parsed is None:
+ return None
+ return datetime(parsed.year, parsed.month, 1, tzinfo=UTC)
+
+
+def _add_months(month: datetime, count: int) -> datetime:
+ index = month.year * 12 + month.month - 1 + count
+ return datetime(index // 12, index % 12 + 1, 1, tzinfo=UTC)
+
+
+def _monthly_transfer_source(
+ api_token: str,
+ config: LinodeEndpointConfig,
+ resumable_source_manager: ResumableSourceManager[LinodeResumeConfig],
+ db_incremental_field_last_value: Optional[Any],
+) -> SourceResponse:
+ client = RESTClient(
+ base_url=LINODE_BASE_URL,
+ headers=_accept_headers(),
+ auth=create_auth({"type": "bearer", "token": api_token}),
+ )
+
+ def _list_linodes() -> list[tuple[Any, datetime | None]]:
+ linodes: list[tuple[Any, datetime | None]] = []
+ for page in client.paginate(
+ LINODE_ENDPOINTS["linodes"].path,
+ params={"page_size": PAGE_SIZE},
+ paginator=PageNumberPaginator(base_page=1, page_param="page", total_path="pages"),
+ data_selector="data",
+ ):
+ linodes.extend((linode["id"], _month_start(linode.get("created"))) for linode in page if "id" in linode)
+ # The listing yields no rows to the pipeline, so a long one must not hold up a shutdown.
+ resumable_source_manager.safe_point()
+ return linodes
+
+ def _rows() -> Iterator[dict[str, Any]]:
+ current_month = _current_month_start()
+ first_month = _month_start(db_incremental_field_last_value) or _add_months(
+ current_month, 1 - MONTHLY_TRANSFER_LOOKBACK_MONTHS
+ )
+ linodes = _list_linodes()
+
+ # Month-major order keeps rows ascending on `month_start` across all Linodes, so the
+ # watermark never passes a month that some Linode has not been read for yet.
+ month = first_month
+ while month <= current_month:
+ for linode_id, created_month in linodes:
+ if created_month is not None and created_month > month:
+ continue
+ path = config.path.format(linode_id=linode_id, year=month.year, month=month.month)
+ try:
+ for page in client.paginate(path, paginator=SinglePagePaginator(), data_selector="$"):
+ for stats in page:
+ yield {
+ "linode_id": linode_id,
+ "year": month.year,
+ "month": month.month,
+ "month_start": month,
+ **stats,
+ }
+ except HTTPError as error:
+ # The Linode can be deleted between the listing and this request.
+ if error.response is None or error.response.status_code != 404:
+ raise
+ resumable_source_manager.safe_point()
+ month = _add_months(month, 1)
+
+ return _make_source_response(config, LINODE_MONTHLY_TRANSFER, _rows)
+
+
def _make_source_response(
config: LinodeEndpointConfig, endpoint: str, items: Callable[[], Iterable[Any]]
) -> SourceResponse:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linode/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linode/settings.py
index d88de3b39791..b0a48b500260 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linode/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linode/settings.py
@@ -6,6 +6,12 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.res
)
from products.warehouse_sources.backend.types import IncrementalField, IncrementalFieldType
+LINODE_MONTHLY_TRANSFER = "linode_monthly_transfer"
+
+# Months of history the first monthly transfer sync reads, the current month included. Each month
+# costs one request per Linode, so the window stays bounded.
+MONTHLY_TRANSFER_LOOKBACK_MONTHS = 12
+
# Max allowed page_size is 500 (min 25). Using the max minimizes request count against the 200 req/min
# paginated-GET rate limit.
PAGE_SIZE = 500
@@ -46,7 +52,8 @@ class LinodeEndpointConfig:
# Incremental sync uses the JSON `X-Filter` header with the `+gte`/`+order_by`/`+order` operators on
# fields the API documents as filterable. Only `events` (by monotonic integer id) and `invoices` (by
# date) expose a genuine server-side filter; the infrastructure inventories are small and their
-# created/updated timestamps are not consistently filterable, so they ship full refresh.
+# created/updated timestamps are not consistently filterable, so they ship full refresh. The monthly
+# transfer table is incremental without X-Filter: the month is part of the request path.
LINODE_ENDPOINTS: dict[str, LinodeEndpointConfig] = {
"linodes": LinodeEndpointConfig(
name="linodes",
@@ -157,6 +164,57 @@ LINODE_ENDPOINTS: dict[str, LinodeEndpointConfig] = {
path="/regions",
incremental_fields=[],
),
+ "images": LinodeEndpointConfig(
+ name="images",
+ path="/images",
+ partition_key="created",
+ incremental_fields=[],
+ ),
+ "databases": LinodeEndpointConfig(
+ name="databases",
+ path="/databases/instances",
+ # The listing aggregates every engine (MySQL, PostgreSQL, Valkey), and the API does not say
+ # that ids are unique across engines.
+ primary_keys=["engine", "id"],
+ partition_key="created",
+ incremental_fields=[],
+ ),
+ "database_types": LinodeEndpointConfig(
+ name="database_types",
+ path="/databases/types",
+ incremental_fields=[],
+ ),
+ "lke_node_pools": LinodeEndpointConfig(
+ name="lke_node_pools",
+ path="/lke/clusters/{cluster_id}/pools",
+ primary_keys=["cluster_id", "id"],
+ # Pools carry no timestamp, so there is nothing stable to partition on.
+ incremental_fields=[],
+ fanout=DependentEndpointConfig(
+ parent_name="lke_clusters",
+ resolve_param="cluster_id",
+ resolve_field="id",
+ include_from_parent=["id"],
+ parent_field_renames={"id": "cluster_id"},
+ ),
+ ),
+ LINODE_MONTHLY_TRANSFER: LinodeEndpointConfig(
+ name=LINODE_MONTHLY_TRANSFER,
+ path="/linode/instances/{linode_id}/transfer/{year}/{month}",
+ # One row per Linode per calendar month. The source builds `month_start` itself and walks the
+ # months oldest first, so an incremental run requests only the months from the watermark on.
+ primary_keys=["linode_id", "month_start"],
+ partition_key="month_start",
+ incremental_field="month_start",
+ incremental_fields=[
+ {
+ "label": "month_start",
+ "type": IncrementalFieldType.DateTime,
+ "field": "month_start",
+ "field_type": IncrementalFieldType.DateTime,
+ },
+ ],
+ ),
}
ENDPOINTS = tuple(LINODE_ENDPOINTS.keys())
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linode/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linode/source.py
index 8f232beb687e..d4e9dfeb6d7d 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linode/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linode/source.py
@@ -73,6 +73,8 @@ Create a personal access token in the [Linode Cloud Manager](https://cloud.linod
- NodeBalancers
- Kubernetes
- Domains
+- Images
+- Databases
""",
iconPath="/static/services/linode.svg",
docsUrl="https://posthog.com/docs/cdp/sources/linode",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linode/tests/test_linode.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linode/tests/test_linode.py
index 9642b3daeb1c..10100c8d20e4 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linode/tests/test_linode.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linode/tests/test_linode.py
@@ -2,6 +2,8 @@ import json
from datetime import UTC, date, datetime
from typing import Any
+import time_machine
+
import requests
from parameterized import parameterized
@@ -9,6 +11,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.res
RESTClientRetryableError,
)
from products.warehouse_sources.backend.temporal.data_imports.sources.common.testing import (
+ RecordedRequest,
ScriptedResponse,
SourceDriver,
always,
@@ -137,6 +140,24 @@ class TestPagination:
assert result.saved_states == [LinodeResumeConfig(next_page=2), LinodeResumeConfig(next_page=3)]
assert result.committed_states == [LinodeResumeConfig(next_page=2), LinodeResumeConfig(next_page=3)]
+ def test_lke_node_pools_fan_out_per_cluster_and_carry_the_cluster_id(self) -> None:
+ result = _driver().run(
+ "lke_node_pools",
+ [
+ _page([{"id": 7, "label": "prod"}, {"id": 8, "label": "staging"}]),
+ _page([{"id": 70, "count": 3}]),
+ _page([{"id": 80, "count": 1}, {"id": 81, "count": 2}]),
+ ],
+ )
+
+ assert result.raised is None
+ assert result.paths == ["/v4/lke/clusters", "/v4/lke/clusters/7/pools", "/v4/lke/clusters/8/pools"]
+ assert [(row["cluster_id"], row["id"], row["count"]) for row in result.rows] == [
+ (7, 70, 3),
+ (8, 80, 1),
+ (8, 81, 2),
+ ]
+
def test_invoice_items_fan_out_per_invoice_and_carry_invoice_fields(self) -> None:
result = _driver().run(
"invoice_items",
@@ -171,6 +192,101 @@ class TestPagination:
assert len(result.requests) == 1
+_TRANSFER = {"bytes_in": 10, "bytes_out": 20, "bytes_total": 30}
+
+
+def _monthly_transfer_vendor(missing_linode_id: int | None = None, missing_status: int = 404):
+ linodes = [
+ {"id": 1, "created": "2019-06-01T08:00:00"},
+ {"id": 2, "created": "2026-02-10T12:30:00"},
+ {"id": 3, "created": "2018-01-01T00:00:00"},
+ ]
+
+ def respond(request: RecordedRequest) -> ScriptedResponse:
+ if request.path == "/v4/linode/instances":
+ return _page(linodes)
+ linode_id = int(request.path.split("/")[4])
+ if linode_id == missing_linode_id:
+ return ScriptedResponse(status=missing_status, json={"errors": [{"reason": "Not found"}]})
+ return ScriptedResponse(json=_TRANSFER)
+
+ return respond
+
+
+class TestMonthlyTransfer:
+ @parameterized.expand(
+ [
+ (
+ # A full refresh reads the lookback window and ignores a stale watermark.
+ "full_refresh_reads_the_lookback_window",
+ {"should_use_incremental_field": False, "db_incremental_field_last_value": datetime(2026, 2, 1)},
+ [(2025, month) for month in range(4, 13)] + [(2026, 1)],
+ ),
+ (
+ "first_incremental_sync_reads_the_lookback_window",
+ {"incremental_field": "month_start", "db_incremental_field_last_value": None},
+ [(2025, month) for month in range(4, 13)] + [(2026, 1)],
+ ),
+ (
+ "incremental_sync_starts_at_the_watermark_month",
+ {
+ "incremental_field": "month_start",
+ "db_incremental_field_last_value": datetime(2026, 2, 1, tzinfo=UTC),
+ },
+ [],
+ ),
+ (
+ "string_watermark_mid_month",
+ {"incremental_field": "month_start", "db_incremental_field_last_value": "2026-01-20T00:00:00"},
+ [(2026, 1)],
+ ),
+ ]
+ )
+ @time_machine.travel(datetime(2026, 3, 15, 9, 0, tzinfo=UTC), tick=False)
+ def test_walks_months_oldest_first_across_all_linodes(
+ self, _name: str, inputs: dict[str, Any], months_before_february: list[tuple[int, int]]
+ ) -> None:
+ # Linode 2 exists from February 2026, so it gets no request for earlier months.
+ expected = [(linode_id, year, month) for year, month in months_before_february for linode_id in (1, 3)]
+ expected += [(linode_id, 2026, month) for month in (2, 3) for linode_id in (1, 2, 3)]
+
+ result = _driver().run("linode_monthly_transfer", _monthly_transfer_vendor(), **inputs)
+
+ assert result.raised is None
+ assert [(row["linode_id"], row["year"], row["month"]) for row in result.rows] == expected
+ assert result.paths[1:] == [
+ f"/v4/linode/instances/{linode_id}/transfer/{year}/{month}" for linode_id, year, month in expected
+ ]
+ assert [row["month_start"] for row in result.rows] == [
+ datetime(year, month, 1, tzinfo=UTC) for _id, year, month in expected
+ ]
+ assert result.rows[0]["bytes_total"] == 30
+
+ @time_machine.travel(datetime(2026, 3, 15, tzinfo=UTC), tick=False)
+ def test_skips_a_linode_deleted_after_the_listing(self) -> None:
+ result = _driver().run(
+ "linode_monthly_transfer",
+ _monthly_transfer_vendor(missing_linode_id=3),
+ incremental_field="month_start",
+ db_incremental_field_last_value=datetime(2026, 3, 1, tzinfo=UTC),
+ )
+
+ assert result.raised is None
+ assert [row["linode_id"] for row in result.rows] == [1, 2]
+
+ @time_machine.travel(datetime(2026, 3, 15, tzinfo=UTC), tick=False)
+ def test_other_client_errors_fail_the_sync(self) -> None:
+ result = _driver().run(
+ "linode_monthly_transfer",
+ _monthly_transfer_vendor(missing_linode_id=1, missing_status=403),
+ incremental_field="month_start",
+ db_incremental_field_last_value=datetime(2026, 3, 1, tzinfo=UTC),
+ )
+
+ assert isinstance(result.raised, requests.HTTPError)
+ assert "403" in str(result.raised)
+
+
class TestRetries:
@parameterized.expand([("rate_limited", 429), ("server_error", 503)])
def test_retryable_statuses_are_retried_then_reraised(self, _name: str, status_code: int) -> None: