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): deprecate profound api version v1 (#126927)

Tom Owers755f39a6fae2
diff --git a/products/warehouse_sources/backend/migrations/0190_repin_profound_api_version_v2.py b/products/warehouse_sources/backend/migrations/0190_repin_profound_api_version_v2.py
new file mode 100644
index 000000000000..7f7b8daf1d97
--- /dev/null
+++ b/products/warehouse_sources/backend/migrations/0190_repin_profound_api_version_v2.py
@@ -0,0 +1,37 @@
+from django.db import migrations
+
+# Profound is phasing out its V1 report endpoints (`/v1/reports/*`) in favor of `/v2/reports/*`, and
+# has not announced a sunset date yet. This source has read `/v2/reports/*` under both labels since
+# `v2` was added: there is no per-version dispatch, so `v1` and `v2` resolve to byte-identical
+# requests. The source marks `v1` deprecated, and this repins existing source-level pins from `v1` to
+# `v2` so they stop carrying a deprecated label. It is a pure relabel, not a version move, so no
+# data or schema transform is needed.
+PROFOUND_SOURCE_TYPE = "Profound"
+OLD_VERSION = "v1"
+NEW_VERSION = "v2"
+
+
+def repin_profound_v1_to_v2(apps, schema_editor):
+ ExternalDataSource = apps.get_model("warehouse_sources", "ExternalDataSource")
+
+ # Source-level pin only. Schema-level `ExternalDataSchema.api_version` overrides are user-managed
+ # (a customer intentionally pinned that schema) and are left alone. The schema-level deprecation
+ # warning prompts the user to migrate those.
+ #
+ # NULL pins already resolve to the source's `default_version` (`v2`), so they need no update.
+ # Matching only `api_version="v1"` keeps this idempotent: a second run matches nothing.
+ ExternalDataSource.objects.filter(source_type=PROFOUND_SOURCE_TYPE, api_version=OLD_VERSION).update(
+ api_version=NEW_VERSION
+ )
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("warehouse_sources", "0189_repin_lovable_api_version_2026_09_11"),
+ ]
+
+ operations = [
+ # Reverse is a no-op: once repinned, these rows are indistinguishable from natively-created
+ # ones, so a blanket downgrade would clobber legitimate `v2` pins made after this ran.
+ migrations.RunPython(repin_profound_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.txt
index 8464a2894e5d..396f6348cfae 100644
--- a/products/warehouse_sources/backend/migrations/max_migration.txt
+++ b/products/warehouse_sources/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0189_repin_lovable_api_version_2026_09_11
+0190_repin_profound_api_version_v2
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/profound/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/profound/source.py
index 56fa9570c770..6cb59f41eaad 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/profound/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/profound/source.py
@@ -8,7 +8,11 @@ from products.warehouse_sources.backend.facade.source_config import (
SourceFieldInputConfig,
SourceFieldInputConfigType,
)
-from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import FieldType, ResumableSource
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import (
+ FieldType,
+ ResumableSource,
+ VersionDeprecation,
+)
from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (
CanonicalDescriptions,
)
@@ -46,6 +50,9 @@ class ProfoundSource(ResumableSource[ProfoundSourceConfig, ProfoundResumeConfig]
# settings.py). v2 is the default so new sources record the surface they actually sync.
supported_versions = ("v1", "v2")
default_version = "v2"
+ # Profound is phasing out its V1 report endpoints with no sunset date yet. The `v1` label never
+ # called them, but it names the version being retired, so it is flagged for existing pins.
+ deprecated_versions = (VersionDeprecation(version="v1", sunset_at=None),)
api_docs_url = "https://docs.tryprofound.com/rest-api/introduction"
@property
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/profound/tests/test_profound_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/profound/tests/test_profound_source.py
index ab3444222c1f..71a289b7276a 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/profound/tests/test_profound_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/profound/tests/test_profound_source.py
@@ -57,14 +57,13 @@ class TestProfoundSource:
assert ok is expected
assert (message is None) is expected
- def test_version_declaration_defaults_to_v2_with_v1_supported(self) -> None:
- # Profound versions by URL path segment, so both labels resolve to the same requests;
- # the default tracks the newest label without deprecating the old one.
+ def test_version_declaration_defaults_to_v2_with_v1_deprecated(self) -> None:
+ # Profound has announced no sunset for its V1 reports, so `v1` stays supported with no date.
source = ProfoundSource()
assert source.supported_versions == ("v1", "v2")
assert source.default_version == "v2"
- assert source.deprecated_versions == ()
+ assert [(d.version, d.sunset_at) for d in source.deprecated_versions] == [("v1", None)]
@parameterized.expand([("unpinned", None), ("pinned_v1", "v1"), ("pinned_v2", "v2")])
def test_report_path_is_fixed_regardless_of_pin(self, _name: str, pinned: str | None) -> None: