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(warehouse_sources): support Split.io API version v2 (#74158)

Tom Owers828a7ade9335
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/split_io/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/split_io/settings.py
index b857dc220553..4329826dbf69 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/split_io/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/split_io/settings.py
@@ -1,8 +1,20 @@
from dataclasses import dataclass, field
from typing import Literal
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import UNVERSIONED_API_VERSION
from products.warehouse_sources.backend.types import IncrementalField
+# Vendor API versions. The Split (now Harness FME) Admin API is served under /internal/api/v2
+# (flag sets under v3) — the very paths this source already calls end-to-end, which the
+# UNVERSIONED_API_VERSION ("v1") placeholder resolved to. "v2" names that live API explicitly and
+# becomes the default new sources are stamped with; "v1" stays supported so pre-versioning pins
+# keep resolving to the identical request paths. Both labels hit the same wire (the request layer
+# does not branch on the pin), so a default flip leaves every existing and NULL-pinned row
+# byte-for-byte unchanged.
+SPLIT_IO_API_VERSION_V2 = "v2"
+SUPPORTED_VERSIONS = (UNVERSIONED_API_VERSION, SPLIT_IO_API_VERSION_V2)
+DEFAULT_VERSION = SPLIT_IO_API_VERSION_V2
+
# How a list endpoint pages through results:
# - "offset": `limit`/`offset` params with an `{"objects": [...], "offset", "limit", "totalCount"}` envelope
# - "marker": `limit`/`after` params, with `nextMarker`/`previousMarker` in the response envelope
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/split_io/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/split_io/source.py
index 6da7f3886555..19793b773d49 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/split_io/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/split_io/source.py
@@ -24,9 +24,11 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.generated_
SplitIoSourceConfig,
)
from products.warehouse_sources.backend.temporal.data_imports.sources.split_io.settings import (
+ DEFAULT_VERSION,
ENDPOINTS,
INCREMENTAL_FIELDS,
SPLIT_IO_ENDPOINTS,
+ SUPPORTED_VERSIONS,
)
from products.warehouse_sources.backend.temporal.data_imports.sources.split_io.split_io import (
SplitIoResumeConfig,
@@ -41,6 +43,9 @@ class SplitIoSource(ResumableSource[SplitIoSourceConfig, SplitIoResumeConfig]):
lists_tables_without_credentials = True # static endpoint catalog — safe for public docs
api_docs_url = "https://docs.split.io/reference/introduction"
+ supported_versions = SUPPORTED_VERSIONS
+ default_version = DEFAULT_VERSION
+
@property
def source_type(self) -> ExternalDataSourceType:
return ExternalDataSourceType.SPLITIO
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/split_io/tests/test_split_io_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/split_io/tests/test_split_io_source.py
index b837b81ab338..e06193883bb4 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/split_io/tests/test_split_io_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/split_io/tests/test_split_io_source.py
@@ -3,11 +3,15 @@ from unittest import mock
from posthog.schema import ReleaseStatus, SourceFieldInputConfig, SourceFieldInputConfigType
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import UNVERSIONED_API_VERSION
from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManager
from products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.splitio import (
SplitIoSourceConfig,
)
-from products.warehouse_sources.backend.temporal.data_imports.sources.split_io.settings import ENDPOINTS
+from products.warehouse_sources.backend.temporal.data_imports.sources.split_io.settings import (
+ ENDPOINTS,
+ SPLIT_IO_API_VERSION_V2,
+)
from products.warehouse_sources.backend.temporal.data_imports.sources.split_io.source import SplitIoSource
from products.warehouse_sources.backend.temporal.data_imports.sources.split_io.split_io import SplitIoResumeConfig
from products.warehouse_sources.backend.types import ExternalDataSourceType
@@ -55,6 +59,20 @@ class TestSplitIoSource:
observed_error = "500 Server Error for url: https://api.split.io/internal/api/v2/workspaces"
assert not any(key in observed_error for key in self.source.get_non_retryable_errors())
+ def test_version_declaration(self):
+ # v2 is the newest supported version and the default new sources are stamped with;
+ # v1 (the pre-versioning placeholder) stays supported so existing pins keep working.
+ assert self.source.default_version == SPLIT_IO_API_VERSION_V2
+ assert set(self.source.supported_versions) == {UNVERSIONED_API_VERSION, SPLIT_IO_API_VERSION_V2}
+ assert self.source.deprecated_versions == ()
+
+ @pytest.mark.parametrize("api_version", [None, UNVERSIONED_API_VERSION, SPLIT_IO_API_VERSION_V2])
+ def test_get_schemas_identical_across_pins(self, api_version):
+ # Both labels hit the same wire, so discovery must return the same tables regardless of
+ # pin — this is what makes the v1→v2 default flip byte-for-byte safe for existing rows.
+ schemas = self.source.get_schemas(self.config, self.team_id, api_version=api_version)
+ assert {schema.name for schema in schemas} == set(ENDPOINTS)
+
def test_get_schemas_lists_all_endpoints_full_refresh(self):
schemas = self.source.get_schemas(self.config, self.team_id)