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(okta): make applications endpoint full-refresh only (#67244)

Tom Owers34a102d8ed29
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/okta/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/okta/settings.py
index 721353fda180..7ff87debd8b9 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/okta/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/okta/settings.py
@@ -22,7 +22,7 @@ class OktaEndpointConfig:
# on most resources and `published` on the System Log.
default_incremental_field: Optional[str] = None
# How the incremental filter is sent to Okta:
- # "filter" -> ?filter=lastUpdated gt "<ts>" (Users, Groups, Apps)
+ # "filter" -> ?filter=lastUpdated gt "<ts>" (Users, Groups)
# "since" -> ?since=<ts> (System Log)
incremental_param: Optional[Literal["filter", "since"]] = None
# Stable, immutable field to partition by. Never use lastUpdated (it mutates).
@@ -59,9 +59,9 @@ OKTA_ENDPOINTS: dict[str, OktaEndpointConfig] = {
"applications": OktaEndpointConfig(
name="applications",
path="/apps",
- incremental_fields=[_datetime_incremental_field("lastUpdated")],
- default_incremental_field="lastUpdated",
- incremental_param="filter",
+ # The Apps API `filter` only supports status, user.id, group.id and
+ # credentials.signing.kid — not lastUpdated — so there is no server-side time
+ # filter and this is full-refresh only.
partition_key="created",
page_size=200,
),
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/okta/tests/test_okta.py b/products/warehouse_sources/backend/temporal/data_imports/sources/okta/tests/test_okta.py
index e11bedf15a18..76b9044b8517 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/okta/tests/test_okta.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/okta/tests/test_okta.py
@@ -96,6 +96,17 @@ class TestBuildInitialParams:
assert params["filter"] == 'lastUpdated gt "2024-01-01T00:00:00.000Z"'
assert params["limit"] == 200
+ def test_applications_never_sends_filter(self):
+ # Okta's Apps API `filter` does not support lastUpdated, so an incremental run must
+ # not send a server-side filter — it would 400.
+ params = _build_initial_params(
+ OKTA_ENDPOINTS["applications"],
+ should_use_incremental_field=True,
+ db_incremental_field_last_value=datetime(2024, 1, 1, tzinfo=UTC),
+ incremental_field="lastUpdated",
+ )
+ assert params == {"limit": 200}
+
def test_filter_endpoint_no_watermark_has_no_filter(self):
params = _build_initial_params(
OKTA_ENDPOINTS["users"],
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/okta/tests/test_okta_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/okta/tests/test_okta_source.py
index 264bcca17c79..641a073ff9f2 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/okta/tests/test_okta_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/okta/tests/test_okta_source.py
@@ -55,7 +55,7 @@ class TestOktaSource:
[
("users", True),
("groups", True),
- ("applications", True),
+ ("applications", False),
("logs", True),
("group_rules", False),
("user_types", False),