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.

fix(data-imports): read a non-mapping job_inputs as legacy ingest mode (#91402)

Tom Owers7dbb5b281247
diff --git a/products/warehouse_sources/backend/temporal/data_imports/cdc/tests/test_source_manager.py b/products/warehouse_sources/backend/temporal/data_imports/cdc/tests/test_source_manager.py
index c49417590c64..c029646d39dd 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/cdc/tests/test_source_manager.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/cdc/tests/test_source_manager.py
@@ -299,6 +299,7 @@ class TestBufferedGating:
[
("source_never_flipped", {}),
("no_job_inputs", {"job_inputs": None}),
+ ("job_inputs_not_a_mapping", {"job_inputs": "buffered"}),
("companion_lane", {"job_inputs": {"cdc_ingest_mode": "buffered"}, "cdc_table_mode": "cdc_only"}),
("still_snapshotting", {"job_inputs": {"cdc_ingest_mode": "buffered"}, "cdc_mode": "snapshot"}),
]
diff --git a/products/warehouse_sources/backend/temporal/data_imports/cdc/types.py b/products/warehouse_sources/backend/temporal/data_imports/cdc/types.py
index 7d399ccc6a61..c451c2f64ceb 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/cdc/types.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/cdc/types.py
@@ -16,8 +16,11 @@ IngestMode = Literal["legacy", "buffered"]
def parse_ingest_mode(job_inputs: Mapping[str, Any] | None) -> IngestMode:
"""Anything unrecognized reads as legacy: an unknown value must not route a source onto a
- path it was never flipped to."""
- return "buffered" if (job_inputs or {}).get("cdc_ingest_mode") == "buffered" else "legacy"
+ path it was never flipped to. `job_inputs` decrypts from EncryptedJSONField, so it is not
+ always a mapping — a non-mapping value is unrecognized too, not an error."""
+ if not isinstance(job_inputs, Mapping):
+ return "legacy"
+ return "buffered" if job_inputs.get("cdc_ingest_mode") == "buffered" else "legacy"
@dataclass(frozen=True)