: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 LlamaCloud API version v1 (#113220)
Tom Owers2a53a9203cb2
diff --git a/products/warehouse_sources/backend/migrations/0175_repin_llama_cloud_api_version.py b/products/warehouse_sources/backend/migrations/0175_repin_llama_cloud_api_version.pynew file mode 100644index 000000000000..d895f09cbf58--- /dev/null+++ b/products/warehouse_sources/backend/migrations/0175_repin_llama_cloud_api_version.py@@ -0,0 +1,37 @@+from django.db import migrations++# LlamaCloud now files its v1 API under "Deprecated (v1)". This source has always read LlamaCloud's+# v2-generation endpoints on the wire — the framework label was the unversioned `v1` default. The+# source declares `v2` as the default and marks the legacy `v1` label deprecated. There is no+# per-version dispatch, so `v1` and `v2` resolve to byte-identical requests; 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 — no data/schema transform is needed.+LLAMA_CLOUD_SOURCE_TYPE = "LlamaCloud"+OLD_VERSION = "v1"+NEW_VERSION = "v2"+++def repin_llama_cloud_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 (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=LLAMA_CLOUD_SOURCE_TYPE, api_version=OLD_VERSION).update(+ api_version=NEW_VERSION+ )+++class Migration(migrations.Migration):+ dependencies = [+ ("warehouse_sources", "0174_repin_monday_api_version_2026_07"),+ ]++ 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_llama_cloud_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 a5e595cc5ef1..95dc51ceef78 100644--- a/products/warehouse_sources/backend/migrations/max_migration.txt+++ b/products/warehouse_sources/backend/migrations/max_migration.txt@@ -1 +1 @@-0174_repin_monday_api_version_2026_07+0175_repin_llama_cloud_api_versiondiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/llama_cloud/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/llama_cloud/source.pyindex f170e744a486..6e21dc69aa4f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/llama_cloud/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/llama_cloud/source.py@@ -13,6 +13,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.basUNVERSIONED_API_VERSION,FieldType,ResumableSource,+ VersionDeprecation,)from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (CanonicalDescriptions,@@ -46,8 +47,11 @@ class LlamaCloudSource(ResumableSource[LlamaCloudSourceConfig, LlamaCloudResumeC# LlamaCloud versions its API in the endpoint path (see LLAMA_CLOUD_API_VERSION_V2): this source# already reads the v2-generation endpoints, so the legacy unversioned label and "v2" drive# identical requests. New sources default to "v2"; existing pins keep syncing byte-for-byte.+ # LlamaCloud now files its v1 API under "Deprecated (v1)" with no published sunset date, so the+ # legacy label is deprecated and its pins are repinned to "v2" by data migration (a pure relabel).supported_versions = (UNVERSIONED_API_VERSION, LLAMA_CLOUD_API_VERSION_V2)default_version = LLAMA_CLOUD_API_VERSION_V2+ deprecated_versions = (VersionDeprecation(version=UNVERSIONED_API_VERSION, sunset_at=None),)@propertydef source_type(self) -> ExternalDataSourceType:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/llama_cloud/tests/test_llama_cloud_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/llama_cloud/tests/test_llama_cloud_source.pyindex 9dcdb6e0c5d6..6bff7b09e458 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/llama_cloud/tests/test_llama_cloud_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/llama_cloud/tests/test_llama_cloud_source.py@@ -122,8 +122,9 @@ class TestLlamaCloudSourceVersions:assert version in self.source.supported_versionsassert self.source.resolve_api_version(version) == version- @parameterized.expand([("v1",), ("v2",)])- def test_no_version_is_deprecated(self, version: str) -> None:- # This is a plain update, not a sunset: neither label is deprecated, so the in-product- # deprecation banner must stay dark for existing v1 pins.- assert self.source.get_version_deprecation(version) is None+ def test_only_legacy_v1_is_deprecated_without_sunset(self) -> None:+ # The vendor published no sunset date, so v1 pins get the advisory banner but keep syncing.+ deprecation = self.source.get_version_deprecation("v1")+ assert deprecation is not None+ assert deprecation.sunset_at is None+ assert self.source.get_version_deprecation("v2") is None