: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(warehouse_sources): deprecate rippling api version v1 (#126931)
Tom Owerse4c9b347d69a
diff --git a/products/warehouse_sources/backend/migrations/0195_repin_rippling_api_version_v2.py b/products/warehouse_sources/backend/migrations/0195_repin_rippling_api_version_v2.pynew file mode 100644index 000000000000..1328c17cc94f--- /dev/null+++ b/products/warehouse_sources/backend/migrations/0195_repin_rippling_api_version_v2.py@@ -0,0 +1,32 @@+from django.db import migrations++# Rippling calls its V1 API (api.rippling.com) legacy, with no published sunset date. This source has+# always read the v2 REST API (rest.ripplingapis.com) and sends no version header, so the `v1` and+# `v2` labels resolve to byte-identical requests. This repins source-level pins from `v1` to `v2` so+# they stop carrying a deprecated label. It is a pure relabel, not a version move: no data/schema+# transform is needed.+RIPPLING_SOURCE_TYPE = "Rippling"+OLD_VERSION = "v1"+NEW_VERSION = "v2"+++def repin_rippling_v1_to_v2(apps, schema_editor):+ ExternalDataSource = apps.get_model("warehouse_sources", "ExternalDataSource")++ # Only the source-level pin is touched. Schema-level `ExternalDataSchema.api_version` overrides+ # are user-managed and are left alone. NULL pins already resolve to `v2`, and matching only+ # `api_version="v1"` keeps this idempotent: a second run matches nothing.+ ExternalDataSource.objects.filter(source_type=RIPPLING_SOURCE_TYPE, api_version=OLD_VERSION).update(+ api_version=NEW_VERSION+ )+++class Migration(migrations.Migration):+ dependencies = [+ ("warehouse_sources", "0194_externaldatasource_credentials_integration_idx"),+ ]++ operations = [+ # Reverse is a no-op: repinned rows are indistinguishable from natively-created `v2` pins.+ migrations.RunPython(repin_rippling_v1_to_v2, migrations.RunPython.noop, elidable=True),+ ]diff --git a/products/warehouse_sources/backend/migrations/max_migration.txt b/products/warehouse_sources/backend/migrations/max_migration.txtindex e8f52c13c054..c1111aeb707e 100644--- a/products/warehouse_sources/backend/migrations/max_migration.txt+++ b/products/warehouse_sources/backend/migrations/max_migration.txt@@ -1 +1 @@-0194_externaldatasource_credentials_integration_idx+0195_repin_rippling_api_version_v2diff --git a/products/warehouse_sources/sources/rippling/source.py b/products/warehouse_sources/sources/rippling/source.pyindex 1e33cc2ac96a..71c270f519d5 100644--- a/products/warehouse_sources/sources/rippling/source.py+++ b/products/warehouse_sources/sources/rippling/source.py@@ -22,6 +22,7 @@ from products.warehouse_sources.sources.sdk import (SourceRegistry,SourceResponse,SourceSchema,+ VersionDeprecation,build_endpoint_schemas,detect,)@@ -37,11 +38,14 @@ class RipplingSource(ResumableSource[RipplingSourceConfig, RipplingResumeConfig]# header, so every pin issues byte-for-byte identical requests; the pin only records which tier# a source targets, and adding a header would override the customer's token version — the silent# move this framework prevents. New sources default to v2, Rippling's current REST API tier.+ # Rippling calls its V1 tier legacy with no published sunset date, so the v1 label is deprecated+ # and its pins are repinned to v2 by data migration (a pure relabel).supported_versions = ("v1", "v2")default_version = "v2"+ deprecated_versions = (VersionDeprecation(version="v1", sunset_at=None),)lists_tables_without_credentials = True # static endpoint catalog — safe for public docs- api_docs_url = "https://developer.rippling.com/documentation/rest-api/guides/versioning"+ api_docs_url = "https://developer.rippling.com/documentation/rest-api/essentials/versioning"@propertydef source_type(self) -> ExternalDataSourceType:diff --git a/products/warehouse_sources/sources/rippling/tests/test_rippling_source.py b/products/warehouse_sources/sources/rippling/tests/test_rippling_source.pyindex c069116a107b..0b62d7185da2 100644--- a/products/warehouse_sources/sources/rippling/tests/test_rippling_source.py+++ b/products/warehouse_sources/sources/rippling/tests/test_rippling_source.py@@ -3,6 +3,7 @@ import pytestfrom products.warehouse_sources.sources.rippling._config import RipplingSourceConfigfrom products.warehouse_sources.sources.rippling.settings import RIPPLING_ENDPOINTSfrom products.warehouse_sources.sources.rippling.source import RipplingSource+from products.warehouse_sources.sources.sdk import VersionDeprecationfrom products.warehouse_sources.sources.sdk.testing import ScriptedResponse, SourceDriver, always, scripted_network@@ -26,12 +27,10 @@ class TestRipplingSource:assert error_message == expected_messageassert network.requests_log[0].headers["authorization"] == "Bearer api-token"- def test_version_declaration_defaults_to_v2_with_v1_supported(self):- # Rippling's REST API version is bound to the token account-side, so both labels issue the- # same requests; the default tracks the newest label without repinning existing v1 sources.+ def test_version_declaration_defaults_to_v2_with_v1_deprecated(self):assert self.source.supported_versions == ("v1", "v2")assert self.source.default_version == "v2"- assert self.source.deprecated_versions == ()+ assert self.source.deprecated_versions == (VersionDeprecation(version="v1", sunset_at=None),)@pytest.mark.parametrize("pinned_version", [None, "v1", "v2"])@pytest.mark.parametrize("endpoint", ["workers", "work_locations"])