: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
chore(llma): add activity logging for evaluations (#58854)
Carlos Marchala31db5be1f80
diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex ab55dfba52f7..3dbd051ffc3a 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -5572,6 +5572,7 @@ export enum ActivityScope {USER_INTERVIEW = 'UserInterview',TAG = 'Tag',TAGGED_ITEM = 'TaggedItem',+ EVALUATION = 'Evaluation',EXTERNAL_DATA_SOURCE = 'ExternalDataSource',EXTERNAL_DATA_SCHEMA = 'ExternalDataSchema',ENDPOINT = 'Endpoint',diff --git a/posthog/models/activity_logging/activity_log.py b/posthog/models/activity_logging/activity_log.pyindex 50ad13f4af9b..a6ec3ce29d1a 100644--- a/posthog/models/activity_logging/activity_log.py+++ b/posthog/models/activity_logging/activity_log.py@@ -76,6 +76,7 @@ ActivityScope = Literal["AlertSubscription","ExternalDataSource","ExternalDataSchema",+ "Evaluation","LLMTrace","WebAnalyticsFilterPreset","CustomerProfileConfig",@@ -589,6 +590,10 @@ field_exclusions: dict[ActivityScope, list[str]] = {"latest_error","last_synced_at",],+ "Evaluation": [+ # Reverse relations — auto-managed by FK creates, not user intent.+ "reports",+ ],}diff --git a/posthog/models/utils.py b/posthog/models/utils.pyindex de62b23e8626..30024b748757 100644--- a/posthog/models/utils.py+++ b/posthog/models/utils.py@@ -692,4 +692,11 @@ class ActivityDetailEncoder(json.JSONEncoder):"id": obj.id,"name": obj.name,}+ if hasattr(obj, "__class__") and obj.__class__.__name__ == "LLMModelConfiguration":+ return {+ "id": str(obj.id),+ "provider": obj.provider,+ "model": obj.model,+ "provider_key_id": str(obj.provider_key_id) if obj.provider_key_id else None,+ }return json.JSONEncoder.default(self, obj)diff --git a/posthog/temporal/llm_analytics/run_evaluation.py b/posthog/temporal/llm_analytics/run_evaluation.pyindex 6e2b7bc1a91e..bf690a808967 100644--- a/posthog/temporal/llm_analytics/run_evaluation.py+++ b/posthog/temporal/llm_analytics/run_evaluation.py@@ -300,12 +300,10 @@ async def disable_evaluation_activity(evaluation_id: str, team_id: int, status_r"""def _disable():- # We bypass save() by using .update() to avoid triggering bytecode recompilation on every run,- # so we must explicitly write all three fields of the status trio together.reason = status_reason or "trial_limit_reached"- Evaluation.objects.filter(id=evaluation_id, team_id=team_id).update(- enabled=False, status="error", status_reason=reason- )+ evaluation = Evaluation.objects.filter(id=evaluation_id, team_id=team_id).first()+ if evaluation is not None:+ evaluation.set_status("error", reason)await database_sync_to_async(_disable)()diff --git a/posthog/temporal/llm_analytics/test_run_evaluation.py b/posthog/temporal/llm_analytics/test_run_evaluation.pyindex 6b8a16b9c52c..608560e66f5e 100644--- a/posthog/temporal/llm_analytics/test_run_evaluation.py+++ b/posthog/temporal/llm_analytics/test_run_evaluation.py@@ -594,6 +594,8 @@ class TestRunEvaluationWorkflow:@pytest.mark.asyncio@pytest.mark.django_db(transaction=True)async def test_disable_evaluation_activity(self, setup_data):+ from posthog.models.activity_logging.activity_log import ActivityLog+evaluation = setup_data["evaluation"]team = setup_data["team"]@@ -606,6 +608,18 @@ class TestRunEvaluationWorkflow:assert evaluation.status == "error"assert evaluation.status_reason == "trial_limit_reached"+ logs = await sync_to_async(+ lambda: list(ActivityLog.objects.filter(scope="Evaluation", item_id=str(evaluation.id), activity="updated"))+ )()+ assert len(logs) == 1+ detail = logs[0].detail+ assert detail is not None+ fields = {c["field"]: c for c in detail["changes"]}+ assert fields["status"]["before"] == "active"+ assert fields["status"]["after"] == "error"+ assert fields["status_reason"]["after"] == "trial_limit_reached"+ assert logs[0].is_system is True+@pytest.mark.asyncio@pytest.mark.django_db(transaction=True)async def test_successful_execution_does_not_disable_evaluation(self, setup_data):diff --git a/posthog/test/activity_logging/test_evaluation_activity_logging.py b/posthog/test/activity_logging/test_evaluation_activity_logging.pynew file mode 100644index 000000000000..d417c457c657--- /dev/null+++ b/posthog/test/activity_logging/test_evaluation_activity_logging.py@@ -0,0 +1,245 @@+from typing import Any++from rest_framework import status++from posthog.test.activity_log_utils import ActivityLogTestHelper++from products.llm_analytics.backend.models.evaluations import Evaluation+from products.llm_analytics.backend.models.model_configuration import LLMModelConfiguration+from products.llm_analytics.backend.models.provider_keys import LLMProviderKey+++def _create_evaluation_payload(**overrides: Any) -> dict[str, Any]:+ payload: dict[str, Any] = {+ "name": "Test Evaluation",+ "description": "Initial",+ "enabled": True,+ "evaluation_type": "llm_judge",+ "evaluation_config": {"prompt": "Test prompt"},+ "output_type": "boolean",+ "output_config": {},+ "conditions": [+ {"id": "cond-1", "rollout_percentage": 25, "properties": []},+ ],+ }+ payload.update(overrides)+ return payload+++class TestEvaluationActivityLogging(ActivityLogTestHelper):+ def _create_evaluation(self, **overrides: Any) -> dict[str, Any]:+ response = self.client.post(+ f"/api/environments/{self.team.id}/evaluations/",+ _create_evaluation_payload(**overrides),+ format="json",+ )+ self.assertEqual(response.status_code, status.HTTP_201_CREATED)+ return response.json()++ def _update_evaluation(self, evaluation_id: str, updates: dict[str, Any]) -> dict[str, Any]:+ response = self.client.patch(+ f"/api/environments/{self.team.id}/evaluations/{evaluation_id}/",+ updates,+ format="json",+ )+ self.assertEqual(response.status_code, status.HTTP_200_OK)+ return response.json()++ def test_evaluation_model_has_activity_mixin(self):+ from posthog.models.activity_logging.model_activity import ModelActivityMixin++ self.assertTrue(issubclass(Evaluation, ModelActivityMixin))++ def test_evaluation_scope_in_activity_log_types(self):+ from typing import get_args++ from posthog.models.activity_logging.activity_log import ActivityScope++ self.assertIn("Evaluation", get_args(ActivityScope))++ def test_creating_evaluation_logs_created_activity(self):+ evaluation = self._create_evaluation()++ logs = self.get_activity_logs_for_item("Evaluation", evaluation["id"])+ self.assertEqual(len(logs), 1)++ log_entry = logs[0]+ self.assertEqual(log_entry.activity, "created")+ self.assertEqual(log_entry.scope, "Evaluation")+ self.assertEqual(log_entry.item_id, evaluation["id"])+ self.assertEqual(log_entry.detail.get("name"), "Test Evaluation")++ def test_updating_rollout_percentage_logs_conditions_change(self):+ evaluation = self._create_evaluation()+ self.clear_activity_logs()++ self._update_evaluation(+ evaluation["id"],+ {+ "conditions": [+ {"id": "cond-1", "rollout_percentage": 100, "properties": []},+ ]+ },+ )++ logs = self.get_activity_logs_for_item("Evaluation", evaluation["id"])+ self.assertEqual(len(logs), 1)+ changes = logs[0].detail.get("changes", [])++ conditions_change = next((c for c in changes if c.get("field") == "conditions"), None)+ self.assertIsNotNone(conditions_change, f"Expected conditions change in {changes}")+ assert conditions_change is not None+ self.assertEqual(conditions_change["before"][0]["rollout_percentage"], 25)+ self.assertEqual(conditions_change["after"][0]["rollout_percentage"], 100)++ def test_bytecode_is_stripped_from_conditions_diff(self):+ # Re-saving without semantic changes should produce no `conditions` diff,+ # even though `save()` recompiles bytecode each time.+ evaluation = self._create_evaluation()+ self.clear_activity_logs()++ self._update_evaluation(+ evaluation["id"],+ # Same rollout/properties as the original — bytecode will recompile, but+ # nothing the user can perceive has changed.+ {+ "conditions": [+ {"id": "cond-1", "rollout_percentage": 25, "properties": []},+ ]+ },+ )++ logs = self.get_activity_logs_for_item("Evaluation", evaluation["id"])+ self.assertEqual(len(logs), 0)++ def test_toggling_enabled_logs_status_and_enabled(self):+ evaluation = self._create_evaluation()+ self.clear_activity_logs()++ self._update_evaluation(evaluation["id"], {"enabled": False})++ logs = self.get_activity_logs_for_item("Evaluation", evaluation["id"])+ self.assertEqual(len(logs), 1)+ changes = logs[0].detail.get("changes", [])+ field_names = [c.get("field") for c in changes]++ # `enabled` and `status` move together via Evaluation.save() coercion, and+ # both are valuable in the audit trail: `enabled` reflects user intent,+ # `status` reflects system state (ACTIVE / PAUSED / ERROR).+ self.assertIn("enabled", field_names)+ self.assertIn("status", field_names)++ def test_soft_delete_logs_as_deleted_activity(self):+ evaluation = self._create_evaluation()+ self.clear_activity_logs()++ self._update_evaluation(evaluation["id"], {"deleted": True})++ logs = self.get_activity_logs_for_item("Evaluation", evaluation["id"])+ self.assertEqual(len(logs), 1)+ self.assertEqual(logs[0].activity, "deleted")++ def test_replacing_model_configuration_logs_old_to_new_diff(self):+ # The SET_NULL cascade from deleting the old LLMModelConfiguration would null+ # Evaluation.model_configuration_id before ModelActivityMixin snapshots before_update.+ # The serializer must defer the cascade until after save() so the diff is correct.+ evaluation = self._create_evaluation(+ model_configuration={"provider": "openai", "model": "gpt-5-mini", "provider_key_id": None}+ )+ old_config_id = Evaluation.objects.get(id=evaluation["id"]).model_configuration_id+ self.assertIsNotNone(old_config_id)+ self.clear_activity_logs()++ self._update_evaluation(+ evaluation["id"],+ {"model_configuration": {"provider": "openai", "model": "gpt-5", "provider_key_id": None}},+ )++ new_config_id = Evaluation.objects.get(id=evaluation["id"]).model_configuration_id+ self.assertIsNotNone(new_config_id)+ self.assertNotEqual(new_config_id, old_config_id)++ logs = self.get_activity_logs_for_item("Evaluation", evaluation["id"])+ self.assertEqual(len(logs), 1)+ changes = logs[0].detail.get("changes", [])+ model_config_change = next((c for c in changes if c.get("field") == "model_configuration"), None)+ self.assertIsNotNone(model_config_change, f"Expected model_configuration change in {changes}")+ assert model_config_change is not None+ self.assertEqual(model_config_change["before"]["id"], str(old_config_id))+ self.assertEqual(model_config_change["before"]["model"], "gpt-5-mini")+ self.assertEqual(model_config_change["after"]["id"], str(new_config_id))+ self.assertEqual(model_config_change["after"]["model"], "gpt-5")++ def _create_provider_key(self, **overrides: Any) -> LLMProviderKey:+ defaults: dict[str, Any] = {+ "team": self.team,+ "provider": "openai",+ "name": "Key",+ "state": LLMProviderKey.State.OK,+ "encrypted_config": {"api_key": "sk-test"},+ "created_by": self.user,+ }+ defaults.update(overrides)+ return LLMProviderKey.objects.create(**defaults)++ def _create_evaluation_orm(self, **overrides: Any) -> Evaluation:+ defaults: dict[str, Any] = {+ "team": self.team,+ "name": "Eval",+ "evaluation_type": "llm_judge",+ "output_type": "boolean",+ }+ defaults.update(overrides)+ return Evaluation.objects.create(**defaults)++ def test_assigning_provider_key_clears_error_status_in_activity_log(self):+ # An errored eval cleared via provider-key assignment goes through QuerySet.update(), which+ # bypasses ModelActivityMixin.save(). The viewset must log the status transition explicitly.+ key = self._create_provider_key()+ mc = LLMModelConfiguration.objects.create(team=self.team, provider="openai", model="gpt-5-mini")+ evaluation = self._create_evaluation_orm(+ model_configuration=mc,+ enabled=False,+ status="error",+ status_reason="provider_key_deleted",+ )+ self.clear_activity_logs()++ response = self.client.post(+ f"/api/environments/{self.team.id}/llm_analytics/provider_keys/{key.id}/assign/",+ {"evaluation_ids": [str(evaluation.id)]},+ format="json",+ )+ self.assertEqual(response.status_code, status.HTTP_200_OK)++ logs = self.get_activity_logs_for_item("Evaluation", str(evaluation.id))+ self.assertEqual(len(logs), 1)+ fields = {c["field"]: c for c in logs[0].detail["changes"]}+ self.assertEqual(fields["status"]["before"], "error")+ self.assertEqual(fields["status"]["after"], "paused")+ self.assertEqual(fields["status_reason"]["before"], "provider_key_deleted")+ self.assertIsNone(fields["status_reason"]["after"])+ self.assertNotIn("enabled", fields) # error -> paused both have enabled=False++ def test_deleting_provider_key_logs_active_to_error_transition(self):+ key = self._create_provider_key()+ mc = LLMModelConfiguration.objects.create(+ team=self.team, provider="openai", model="gpt-5-mini", provider_key=key+ )+ evaluation = self._create_evaluation_orm(model_configuration=mc, enabled=True)+ self.assertEqual(evaluation.status, "active")+ self.clear_activity_logs()++ response = self.client.delete(f"/api/environments/{self.team.id}/llm_analytics/provider_keys/{key.id}/")+ self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)++ logs = self.get_activity_logs_for_item("Evaluation", str(evaluation.id))+ self.assertEqual(len(logs), 1)+ fields = {c["field"]: c for c in logs[0].detail["changes"]}+ self.assertEqual(+ fields["enabled"],+ {"type": "Evaluation", "action": "changed", "field": "enabled", "before": True, "after": False},+ )+ self.assertEqual(fields["status"]["before"], "active")+ self.assertEqual(fields["status"]["after"], "error")+ self.assertEqual(fields["status_reason"]["after"], "provider_key_deleted")diff --git a/products/llm_analytics/backend/api/evaluations.py b/products/llm_analytics/backend/api/evaluations.pyindex 36197e95327c..b62baaa2db95 100644--- a/products/llm_analytics/backend/api/evaluations.py+++ b/products/llm_analytics/backend/api/evaluations.py@@ -1,3 +1,4 @@+import copyimport jsonfrom typing import Any@@ -19,6 +20,8 @@ from posthog.api.monitoring import monitorfrom posthog.api.routing import TeamAndOrgViewSetMixinfrom posthog.api.shared import UserBasicSerializerfrom posthog.event_usage import report_user_action+from posthog.models.activity_logging.activity_log import Detail, changes_between, log_activity+from posthog.models.signals import model_activity_signal, mutable_receiverfrom posthog.permissions import AccessControlPermissionfrom posthog.rbac.access_control_api_mixin import AccessControlViewSetMixinfrom posthog.temporal.llm_analytics.message_utils import extract_text_from_messages@@ -281,19 +284,25 @@ class EvaluationSerializer(serializers.ModelSerializer):def update(self, instance, validated_data):model_config_data = validated_data.pop("model_configuration", None)+ old_config = Noneif model_config_data is not None:- # Delete old model configuration if it exists+ # Defer the cascade until after super().update(): SET_NULL would otherwise null+ # Evaluation.model_configuration_id before ModelActivityMixin.save() snapshots+ # before_update from the DB, producing a `null -> new` diff instead of `old -> new`.if instance.model_configuration:old_config = instance.model_configuration- instance.model_configuration = None- old_config.delete()validated_data["model_configuration"] = self._create_or_update_model_configuration(model_config_data, instance.team_id)- return super().update(instance, validated_data)+ result = super().update(instance, validated_data)++ if old_config is not None:+ old_config.delete()++ return resultclass EvaluationFilter(django_filters.FilterSet):@@ -732,3 +741,53 @@ class EvaluationViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, Forbi)return Response({"results": results})+++_COMPILED_KEYS = ("bytecode", "bytecode_error")+++def _strip_compiled_from_conditions(conditions: list[dict[str, Any]] | None) -> list[dict[str, Any]]:+ if not conditions:+ return []+ return [{k: v for k, v in cond.items() if k not in _COMPILED_KEYS} for cond in conditions]+++def _strip_compiled_from_eval_config(config: dict[str, Any] | None) -> dict[str, Any]:+ if not config:+ return {}+ return {k: v for k, v in config.items() if k not in _COMPILED_KEYS}+++@mutable_receiver(model_activity_signal, sender=Evaluation)+def handle_evaluation_change(+ sender, scope, before_update, after_update, activity, user, was_impersonated=False, **kwargs+):+ # `save()` re-derives `conditions[*].bytecode` and `evaluation_config.bytecode` on every write.+ # Strip them on shallow copies so the diff reflects user intent, not the compiler — mutating+ # `after_update` directly would also mutate the live instance DRF serialises for the response.+ before_log = copy.copy(before_update) if before_update is not None else None+ after_log = copy.copy(after_update) if after_update is not None else None+ for snapshot in (before_log, after_log):+ if snapshot is not None:+ snapshot.conditions = _strip_compiled_from_conditions(snapshot.conditions)+ snapshot.evaluation_config = _strip_compiled_from_eval_config(snapshot.evaluation_config)++ if before_update and after_update:+ before_deleted = getattr(before_update, "deleted", None)+ after_deleted = getattr(after_update, "deleted", None)+ if before_deleted is not None and after_deleted is not None and before_deleted != after_deleted:+ activity = "restored" if after_deleted is False else "deleted"++ log_activity(+ organization_id=after_update.team.organization_id,+ team_id=after_update.team_id,+ user=user,+ was_impersonated=was_impersonated,+ item_id=after_update.id,+ scope=scope,+ activity=activity,+ detail=Detail(+ changes=changes_between(scope, previous=before_log, current=after_log),+ name=after_update.name,+ ),+ )diff --git a/products/llm_analytics/backend/api/provider_keys.py b/products/llm_analytics/backend/api/provider_keys.pyindex e8ea4c82eb10..d302998e8434 100644--- a/products/llm_analytics/backend/api/provider_keys.py+++ b/products/llm_analytics/backend/api/provider_keys.py@@ -457,25 +457,19 @@ class LLMProviderKeyViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, vconfigs_updated += 1# A key assignment resolves any `provider_key_deleted` / `model_not_allowed` error on the- # dependent evals — the cause no longer applies once they're attached to a live key. Clear- # the error-reason marker regardless of whether the caller also asked to re-enable.- # `.update()` bypasses the model's invariant coercion in save(), so write the full trio.- Evaluation.objects.filter(- id__in=evaluation_ids,- team_id=self.team_id,- deleted=False,- status="error",- ).update(enabled=False, status="paused", status_reason=None)+ # dependent evals — the cause no longer applies once they're attached to a live key.+ for eval_obj in Evaluation.objects.filter(+ id__in=evaluation_ids, team_id=self.team_id, deleted=False, status="error"+ ):+ eval_obj.set_status("paused")evals_enabled = 0if enable:- # Re-enabling via key assignment: transition paused-or-just-cleared evals to ACTIVE.- evals_enabled = Evaluation.objects.filter(- id__in=evaluation_ids,- team_id=self.team_id,- deleted=False,- enabled=False,- ).update(enabled=True, status="active", status_reason=None)+ for eval_obj in Evaluation.objects.filter(+ id__in=evaluation_ids, team_id=self.team_id, deleted=False, enabled=False+ ):+ eval_obj.set_status("active")+ evals_enabled += 1report_user_action(request.user,@@ -525,12 +519,13 @@ class LLMProviderKeyViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, v# Deleting the key leaves dependent evals unrunnable. Only promote currently-active# evals to the error state — user-paused evals should stay paused (the user's intent# is preserved), and already-errored evals don't need their existing reason overwritten.- Evaluation.objects.filter(+ for eval_obj in Evaluation.objects.filter(model_configuration_id__in=model_config_ids,team_id=self.team_id,deleted=False,status="active",- ).update(enabled=False, status="error", status_reason="provider_key_deleted")+ ):+ eval_obj.set_status("error", "provider_key_deleted")return super().destroy(request, *args, **kwargs)diff --git a/products/llm_analytics/backend/models/evaluations.py b/products/llm_analytics/backend/models/evaluations.pyindex 6f23fab16c5a..77e48e951f66 100644--- a/products/llm_analytics/backend/models/evaluations.py+++ b/products/llm_analytics/backend/models/evaluations.py@@ -5,6 +5,7 @@ from django.dispatch import receiverimport structlog+from posthog.models.activity_logging.model_activity import ModelActivityMixinfrom posthog.models.utils import UUIDTModelfrom .evaluation_configs import EvaluationType, OutputType, validate_evaluation_configs@@ -24,7 +25,7 @@ class EvaluationStatusReason(models.TextChoices):PROVIDER_KEY_DELETED = "provider_key_deleted", "Provider API key was deleted"-class Evaluation(UUIDTModel):+class Evaluation(ModelActivityMixin, UUIDTModel):class Meta:ordering = ["-created_at", "id"]indexes = [diff --git a/products/platform_features/frontend/generated/api.schemas.ts b/products/platform_features/frontend/generated/api.schemas.tsindex 8db35e89e5db..56bd7c48fa4f 100644--- a/products/platform_features/frontend/generated/api.schemas.ts+++ b/products/platform_features/frontend/generated/api.schemas.ts@@ -913,6 +913,7 @@ export type ActivityLogListParams = {* `AlertSubscription` - AlertSubscription* `ExternalDataSource` - ExternalDataSource* `ExternalDataSchema` - ExternalDataSchema+* `Evaluation` - Evaluation* `LLMTrace` - LLMTrace* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset* `CustomerProfileConfig` - CustomerProfileConfig@@ -987,6 +988,7 @@ export const ActivityLogListScope = {AlertSubscription: 'AlertSubscription',ExternalDataSource: 'ExternalDataSource',ExternalDataSchema: 'ExternalDataSchema',+ Evaluation: 'Evaluation',LLMTrace: 'LLMTrace',WebAnalyticsFilterPreset: 'WebAnalyticsFilterPreset',CustomerProfileConfig: 'CustomerProfileConfig',@@ -1048,6 +1050,7 @@ export const ActivityLogListScope = {* `AlertSubscription` - AlertSubscription* `ExternalDataSource` - ExternalDataSource* `ExternalDataSchema` - ExternalDataSchema+ * `Evaluation` - Evaluation* `LLMTrace` - LLMTrace* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset* `CustomerProfileConfig` - CustomerProfileConfig@@ -1110,6 +1113,7 @@ export const ActivityLogListScopesItem = {AlertSubscription: 'AlertSubscription',ExternalDataSource: 'ExternalDataSource',ExternalDataSchema: 'ExternalDataSchema',+ Evaluation: 'Evaluation',LLMTrace: 'LLMTrace',WebAnalyticsFilterPreset: 'WebAnalyticsFilterPreset',CustomerProfileConfig: 'CustomerProfileConfig',diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex bbcc45c140b2..43cdd7c563ad 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -41724,6 +41724,7 @@ export namespace Schemas {* `AlertSubscription` - AlertSubscription* `ExternalDataSource` - ExternalDataSource* `ExternalDataSchema` - ExternalDataSchema+ * `Evaluation` - Evaluation* `LLMTrace` - LLMTrace* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset* `CustomerProfileConfig` - CustomerProfileConfig@@ -41799,6 +41800,7 @@ export namespace Schemas {AlertSubscription: 'AlertSubscription',ExternalDataSource: 'ExternalDataSource',ExternalDataSchema: 'ExternalDataSchema',+ Evaluation: 'Evaluation',LLMTrace: 'LLMTrace',WebAnalyticsFilterPreset: 'WebAnalyticsFilterPreset',CustomerProfileConfig: 'CustomerProfileConfig',@@ -41860,6 +41862,7 @@ export namespace Schemas {* `AlertSubscription` - AlertSubscription* `ExternalDataSource` - ExternalDataSource* `ExternalDataSchema` - ExternalDataSchema+ * `Evaluation` - Evaluation* `LLMTrace` - LLMTrace* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset* `CustomerProfileConfig` - CustomerProfileConfig@@ -41923,6 +41926,7 @@ export namespace Schemas {AlertSubscription: 'AlertSubscription',ExternalDataSource: 'ExternalDataSource',ExternalDataSchema: 'ExternalDataSchema',+ Evaluation: 'Evaluation',LLMTrace: 'LLMTrace',WebAnalyticsFilterPreset: 'WebAnalyticsFilterPreset',CustomerProfileConfig: 'CustomerProfileConfig',diff --git a/services/mcp/src/generated/platform_features/api.ts b/services/mcp/src/generated/platform_features/api.tsindex 80d79bc710eb..c7b165431484 100644--- a/services/mcp/src/generated/platform_features/api.ts+++ b/services/mcp/src/generated/platform_features/api.ts@@ -200,6 +200,7 @@ export const ActivityLogListQueryParams = /* @__PURE__ */ zod.object({'AlertSubscription','ExternalDataSource','ExternalDataSchema',+ 'Evaluation','LLMTrace','WebAnalyticsFilterPreset','CustomerProfileConfig',@@ -211,7 +212,7 @@ export const ActivityLogListQueryParams = /* @__PURE__ */ zod.object({]).optional().describe(- 'Filter by a single activity scope, e.g. "FeatureFlag", "Insight", "Dashboard", "Experiment".\n\n* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket'+ 'Filter by a single activity scope, e.g. "FeatureFlag", "Insight", "Dashboard", "Experiment".\n\n* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `Evaluation` - Evaluation\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket'),scopes: zod.array(@@ -267,6 +268,7 @@ export const ActivityLogListQueryParams = /* @__PURE__ */ zod.object({'AlertSubscription','ExternalDataSource','ExternalDataSchema',+ 'Evaluation','LLMTrace','WebAnalyticsFilterPreset','CustomerProfileConfig',@@ -277,7 +279,7 @@ export const ActivityLogListQueryParams = /* @__PURE__ */ zod.object({'Ticket',]).describe(- '* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket'+ '* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `Evaluation` - Evaluation\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket')).optional()diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/activity-log-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/activity-log-list.jsonindex 45b4d8f5bd42..02e9a73d8391 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/activity-log-list.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/activity-log-list.json@@ -19,7 +19,7 @@"type": "number"},"scope": {- "description": "Filter by a single activity scope, e.g. \"FeatureFlag\", \"Insight\", \"Dashboard\", \"Experiment\".\n\n* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket",+ "description": "Filter by a single activity scope, e.g. \"FeatureFlag\", \"Insight\", \"Dashboard\", \"Experiment\".\n\n* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `Evaluation` - Evaluation\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket","enum": ["Cohort","FeatureFlag",@@ -71,6 +71,7 @@"AlertSubscription","ExternalDataSource","ExternalDataSchema",+ "Evaluation","LLMTrace","WebAnalyticsFilterPreset","CustomerProfileConfig",@@ -85,7 +86,7 @@"scopes": {"description": "Filter by multiple activity scopes, comma-separated. Values must be valid ActivityScope enum values. E.g. \"FeatureFlag,Insight\".","items": {- "description": "* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket",+ "description": "* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `Evaluation` - Evaluation\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket","enum": ["Cohort","FeatureFlag",@@ -137,6 +138,7 @@"AlertSubscription","ExternalDataSource","ExternalDataSchema",+ "Evaluation","LLMTrace","WebAnalyticsFilterPreset","CustomerProfileConfig",