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.

fix(customer-analytics): use temporal property sync outcomes (#90495)

Arthur Moreira de Deus98ec6c3772b0
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 4a3404de39c2..5cf13f88adea 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -536,7 +536,6 @@ export const FEATURE_FLAGS = {
VISION_ENTRYPOINT_EXPERIMENTS: 'vision-entrypoint-experiments', // owner: #team-replay, cross-sell entry points from experiments
VISION_GOAL_BASED_CREATION_FLOW: 'vision-goal-based-creation-flow', // owner: #team-replay multivariate=control,test — gate on === 'test'; a truthy check turns on for control too
VISUAL_REVIEW: 'visual-review', // owner: #team-devex
- WAREHOUSE_ACCOUNT_PROPERTIES_S3_SYNC: 'warehouse-account-properties-s3-sync', // owner: @arthurdedeus #team-customer-analytics, gates staged account-property sync and its run history
WAREHOUSE_PERSON_PROPERTIES: 'warehouse-person-properties', // owner: @tomowers #team-warehouse-sources, gates warehouse -> person properties (person-target custom property sources)
WEB_ANALYTICS_ACHIEVEMENTS: 'web-analytics-achievements', // owner: @jordanm-posthog #team-web-analytics
WEB_ANALYTICS_AGENT_ANALYTICS: 'web-analytics-agent-analytics', // owner: @jordanm-posthog #team-web-analytics
diff --git a/posthog/temporal/data_modeling/activities/succeed_materialization.py b/posthog/temporal/data_modeling/activities/succeed_materialization.py
index bcc1a6c61cc7..a8d8563b44fa 100644
--- a/posthog/temporal/data_modeling/activities/succeed_materialization.py
+++ b/posthog/temporal/data_modeling/activities/succeed_materialization.py
@@ -3,7 +3,6 @@ import dataclasses
from django.db import transaction
-from celery import current_app
from structlog import get_logger
from structlog.contextvars import bind_contextvars
from temporalio import activity
@@ -123,10 +122,6 @@ def _succeed_node_and_data_modeling_job(
job.error = None
job.save()
- if node is not None and node.saved_query_id is not None:
- saved_query_id = str(node.saved_query_id)
- team_id = inputs.team_id
- transaction.on_commit(lambda: _enqueue_custom_property_sync(team_id, saved_query_id))
return SucceedNodeAndJobOutcome(
node=node,
job=job,
@@ -135,17 +130,6 @@ def _succeed_node_and_data_modeling_job(
)
-def _enqueue_custom_property_sync(team_id: int, saved_query_id: str) -> None:
- try:
- current_app.send_task(
- "customer_analytics.process_custom_property_sync",
- kwargs={"team_id": team_id, "saved_query_id": saved_query_id},
- )
- except Exception as e:
- LOGGER.exception("custom_property_sync_enqueue_failed", team_id=team_id, saved_query_id=saved_query_id)
- capture_exception(e)
-
-
@activity.defn
async def succeed_materialization_activity(inputs: SucceedMaterializationInputs) -> SucceedMaterializationResult:
bind_contextvars(team_id=inputs.team_id)
diff --git a/products/customer_analytics/backend/COMPROMISES.md b/products/customer_analytics/backend/COMPROMISES.md
index cbc62fba46a4..f3fe85d7df5c 100644
--- a/products/customer_analytics/backend/COMPROMISES.md
+++ b/products/customer_analytics/backend/COMPROMISES.md
@@ -26,9 +26,10 @@ Shortcuts taken to ship the first version. Revisit when they bite.
/ `key_column` exist in the view's schema. A bad column surfaces as a per-source sync error (and
advances the auto-disable streak) on the next run, not as a 400 on save. Validate against the saved
query's `columns` at write time if the delayed feedback bites.
-- **Initial sync is best-effort.** Saving an enabled source enqueues a sync on commit so values
- populate without waiting for the next materialization. If the broker is down the save still
- succeeds and the enqueue is dropped (logged to error tracking) — the next materialization recovers.
+- **Initial sync is best-effort.** Saving an enabled account source queues a direct value sync on
+ commit so values populate without waiting for the next materialization. It does not write source
+ health. Temporal owns the scheduled sync outcome and run history. If the broker is down the save
+ still succeeds and the next materialization recovers.
- **Create-path sync is synchronous, best-effort, and workflow-only.** When the external create
endpoint is called by a workflow "Create account" step (the `X-PostHog-Hog-Flow-Id` header),
it syncs warehouse-backed custom properties for the new account inline — scoped to its external
diff --git a/products/customer_analytics/backend/constants.py b/products/customer_analytics/backend/constants.py
index 6256e7b7a054..9702f79cf278 100644
--- a/products/customer_analytics/backend/constants.py
+++ b/products/customer_analytics/backend/constants.py
@@ -14,7 +14,6 @@ CUSTOMER_ANALYTICS_TRACK_RULES_FLAG = "customer-analytics-track-rules"
# properties feature: creating person-target custom property sources (API + UI), staging rows during
# syncs, and the post-sync upsert workflow.
WAREHOUSE_PERSON_PROPERTIES_FLAG = "warehouse-person-properties"
-WAREHOUSE_ACCOUNT_PROPERTIES_S3_SYNC_FLAG = "warehouse-account-properties-s3-sync"
# Mirrors frontend `BILLING_INSIGHT_SHORT_IDS` in accountBillingLogic.ts. These saved insights read
# warehouse-synced billing data to report an account's PostHog consumption (events ingested, rows
diff --git a/products/customer_analytics/backend/facade/api.py b/products/customer_analytics/backend/facade/api.py
index f433b8e0657b..d7e6d8b79b68 100644
--- a/products/customer_analytics/backend/facade/api.py
+++ b/products/customer_analytics/backend/facade/api.py
@@ -1770,24 +1770,25 @@ def _validate_column_descriptions(column_descriptions: Any, mapped_columns: set[
return cleaned
-def _enqueue_custom_property_sync(team_id: int, saved_query_id: str) -> None:
- """Dispatch the sync task by name. Enqueue failure must not fail the originating write, so it's swallowed."""
+def _send_initial_account_property_sync(team_id: int, saved_query_id: str) -> None:
try:
current_app.send_task(
"customer_analytics.process_custom_property_sync",
kwargs={"team_id": team_id, "saved_query_id": saved_query_id},
)
- except Exception as e:
- capture_exception(e)
+ except Exception as error:
+ capture_exception(error)
-def _enqueue_sync_if_enabled(source: CustomPropertySource) -> None:
- """Run an initial sync after the source is saved so its values populate immediately rather than
- waiting for the next materialization. Skips disabled sources and ones whose view was deleted."""
- if not source.is_enabled or source.saved_query_id is None:
+def _enqueue_initial_account_property_sync(source: CustomPropertySource) -> None:
+ if (
+ not source.is_enabled
+ or source.saved_query_id is None
+ or source.definition.target_type != TargetType.ACCOUNT.value
+ ):
return
team_id, saved_query_id = source.team_id, str(source.saved_query_id)
- transaction.on_commit(lambda: _enqueue_custom_property_sync(team_id, saved_query_id))
+ transaction.on_commit(lambda: _send_initial_account_property_sync(team_id, saved_query_id))
# Targets fed by the warehouse staging/sync pipeline (person + group), as opposed to the account
@@ -2194,7 +2195,7 @@ def create_custom_property_source(
if "unique" not in str(exc).lower() and "duplicate" not in str(exc).lower():
raise
raise CustomPropertySourceValidationError("This custom property already has a source.")
- _enqueue_sync_if_enabled(source)
+ _enqueue_initial_account_property_sync(source)
_start_person_backfill_if_enabled(source)
return _to_custom_property_source_view(source, user_access_control)
@@ -2229,7 +2230,7 @@ def update_custom_property_source(
source.save()
# Only re-sync on a change that affects what gets written — not on every (possibly no-op) PATCH.
if reenabling or columns_changed:
- _enqueue_sync_if_enabled(source)
+ _enqueue_initial_account_property_sync(source)
_start_person_backfill_if_enabled(source)
return _to_custom_property_source_view(source, user_access_control)
diff --git a/products/customer_analytics/backend/logic/account_property_projection.py b/products/customer_analytics/backend/logic/account_property_projection.py
index a79f4730221f..5c8d8410dc12 100644
--- a/products/customer_analytics/backend/logic/account_property_projection.py
+++ b/products/customer_analytics/backend/logic/account_property_projection.py
@@ -1,9 +1,3 @@
-import posthoganalytics
-
-from posthog.exceptions_capture import capture_exception
-from posthog.models import Team
-
-from products.customer_analytics.backend.constants import WAREHOUSE_ACCOUNT_PROPERTIES_S3_SYNC_FLAG
from products.customer_analytics.backend.models import CustomPropertySource, TargetType
from products.warehouse_sources.backend.facade.hooks import (
BINDING_KIND_SAVED_QUERY,
@@ -12,26 +6,6 @@ from products.warehouse_sources.backend.facade.hooks import (
)
-def account_property_staging_enabled(team_id: int) -> bool:
- try:
- organization_id = str(Team.objects.only("organization_id").get(id=team_id).organization_id)
- except Team.DoesNotExist:
- return False
- try:
- return bool(
- posthoganalytics.feature_enabled(
- WAREHOUSE_ACCOUNT_PROPERTIES_S3_SYNC_FLAG,
- organization_id,
- groups={"organization": organization_id},
- only_evaluate_locally=False,
- send_feature_flag_events=False,
- )
- )
- except Exception as error:
- capture_exception(error)
- return False
-
-
def account_property_projection(
team_id: int, binding: WarehouseBinding
) -> list[AccountPropertySourceProjection] | None:
@@ -47,7 +21,7 @@ def account_property_projection(
source_column__isnull=False,
)
)
- if not sources or not account_property_staging_enabled(team_id):
+ if not sources:
return None
return [
AccountPropertySourceProjection(
diff --git a/products/customer_analytics/backend/logic/account_property_projection_test.py b/products/customer_analytics/backend/logic/account_property_projection_test.py
index c40410b02340..39b389810076 100644
--- a/products/customer_analytics/backend/logic/account_property_projection_test.py
+++ b/products/customer_analytics/backend/logic/account_property_projection_test.py
@@ -1,5 +1,4 @@
from posthog.test.base import BaseTest
-from unittest.mock import patch
from products.customer_analytics.backend.logic.account_property_projection import account_property_projection
from products.customer_analytics.backend.models import CustomPropertySource, TargetType
@@ -12,12 +11,6 @@ class AccountPropertyProjectionTest(TeamScopedTestMixin, BaseTest):
def setUp(self) -> None:
super().setUp()
self.saved_query = create_saved_query(team_id=self.team.id)
- flag_patch = patch(
- "products.customer_analytics.backend.logic.account_property_projection.account_property_staging_enabled",
- return_value=True,
- )
- flag_patch.start()
- self.addCleanup(flag_patch.stop)
def _source(self, name: str, key_column: str, source_column: str, *, is_enabled: bool = True) -> None:
definition = create_custom_property_definition(
diff --git a/products/customer_analytics/backend/logic/custom_property_sync.py b/products/customer_analytics/backend/logic/custom_property_sync.py
index b1995692d92e..73fac1029eaf 100644
--- a/products/customer_analytics/backend/logic/custom_property_sync.py
+++ b/products/customer_analytics/backend/logic/custom_property_sync.py
@@ -1,20 +1,14 @@
"""Bulk sync of materialized-view columns into account custom property values.
Reads a configured view via HogQL, matches each row to an account by external_id, and writes the
-selected column as that account's custom property value (through set_custom_property_value).
-`run_custom_property_sync` is the entrypoint the Celery task calls: it runs the sync and persists
-the outcome (success/failure, auto-disable) onto the sources.
-A sync can be scoped to a single account via ``external_id`` — used by the external create path to
-populate a new account synchronously.
+selected column as that account's custom property value. The account create path uses a sync scoped
+to one account.
"""
import dataclasses
from typing import Any
from uuid import UUID
-from django.db import transaction
-from django.utils import timezone
-
import structlog
from posthog.hogql import ast
@@ -37,10 +31,6 @@ logger = structlog.get_logger(__name__)
_WRITE_CONFLICT_RETRIES = 3
_SYNC_KEYS_PER_QUERY = 1000
-# Mirrors data_modeling's CONSECUTIVE_TIMEOUTS_TO_PAUSE: auto-disable a source that keeps failing.
-MAX_CONSECUTIVE_SYNC_FAILURES = 5
-_MAX_ERROR_LENGTH = 500
-
@dataclasses.dataclass
class SyncResult:
@@ -182,75 +172,6 @@ def _read_view(team: Team, view_name: str, columns: list[str], key_column: str,
return rows
-def record_sync_outcome(
- *,
- team_id: int,
- saved_query_id: str | UUID,
- view_found: bool = True,
- run_failed: bool = False,
- run_error: str | None = None,
- source_errors: dict[str, str] | None = None,
-) -> None:
- """Persist a sync run's outcome onto every enabled source for the view.
-
- Clean success resets the failure streak; a missing view disables immediately; a whole-run
- failure or a per-source column error increments the streak and auto-disables at the cap.
- """
- source_errors = source_errors or {}
- sources = CustomPropertySource.objects.for_team(team_id).filter(saved_query_id=saved_query_id, is_enabled=True)
- now = timezone.now()
- with transaction.atomic():
- for source in sources:
- source.last_synced_at = now
- if not view_found:
- source.last_sync_error = "View not found"
- source.is_enabled = False
- source.consecutive_failures = 0
- elif run_failed or str(source.id) in source_errors:
- error = run_error if run_failed else source_errors[str(source.id)]
- source.last_sync_error = (error or "Sync failed")[:_MAX_ERROR_LENGTH]
- source.consecutive_failures += 1
- if source.consecutive_failures >= MAX_CONSECUTIVE_SYNC_FAILURES:
- source.is_enabled = False
- else:
- source.last_sync_error = None
- source.consecutive_failures = 0
- source.save()
-
-
-def run_custom_property_sync(*, team_id: int, saved_query_id: str | UUID) -> SyncResult:
- """Run one sync and persist its outcome. The Celery task's entrypoint.
-
- On a hard failure the outcome is recorded (so the failure streak/auto-disable still advance)
- and the error is captured, then re-raised so the run shows as failed.
- """
- try:
- result = sync_custom_property_values(team_id=team_id, saved_query_id=saved_query_id)
- except Exception as e:
- record_sync_outcome(team_id=team_id, saved_query_id=saved_query_id, run_failed=True, run_error=str(e))
- capture_exception(e)
- raise
-
- record_sync_outcome(
- team_id=team_id,
- saved_query_id=saved_query_id,
- view_found=result.view_found,
- source_errors=result.source_errors,
- )
- logger.info(
- "custom_property_sync.completed",
- team_id=team_id,
- saved_query_id=str(saved_query_id),
- view_found=result.view_found,
- written=result.written,
- unmatched_keys=result.unmatched_keys,
- accounts_total=result.accounts_total,
- rows_fetched=result.rows_fetched,
- source_errors=len(result.source_errors),
- )
- return result
-
-
def sync_custom_properties_for_account(*, team_id: int, external_id: str) -> None:
"""Best-effort synchronous population of warehouse-backed custom properties for one account.
diff --git a/products/customer_analytics/backend/logic/custom_property_sync_test.py b/products/customer_analytics/backend/logic/custom_property_sync_test.py
index 1da3ff513cc4..ddf42cc90d78 100644
--- a/products/customer_analytics/backend/logic/custom_property_sync_test.py
+++ b/products/customer_analytics/backend/logic/custom_property_sync_test.py
@@ -1,16 +1,10 @@
-import pytest
from posthog.test.base import BaseTest, ClickhouseTestMixin
from unittest.mock import Mock, patch
from django.apps import apps
-from parameterized import parameterized
-
from products.customer_analytics.backend.logic.custom_property_sync import (
- MAX_CONSECUTIVE_SYNC_FAILURES,
_read_view,
- record_sync_outcome,
- run_custom_property_sync,
sync_custom_properties_for_account,
sync_custom_property_values,
)
@@ -138,28 +132,6 @@ class CustomPropertySyncTest(TeamScopedTestMixin, BaseTest):
assert result.written == 0
execute.assert_not_called() # empty key set -> zero batches -> no ClickHouse query
- def test_run_sync_records_success_outcome(self):
- source = self._source(self.mrr_def, "mrr")
- with patch(_EXECUTE, return_value=_Response([(100.0, "acme")])):
- run_custom_property_sync(team_id=self.team.id, saved_query_id=self.view.id)
-
- source.refresh_from_db()
- assert source.last_synced_at is not None
- assert source.last_sync_error is None
- assert source.consecutive_failures == 0
-
- @patch("products.customer_analytics.backend.logic.custom_property_sync.capture_exception")
- def test_run_sync_records_failure_outcome_and_reraises(self, mock_capture):
- source = self._source(self.mrr_def, "mrr")
- sync_path = "products.customer_analytics.backend.logic.custom_property_sync.sync_custom_property_values"
- with patch(sync_path, side_effect=RuntimeError("boom")), pytest.raises(RuntimeError):
- run_custom_property_sync(team_id=self.team.id, saved_query_id=self.view.id)
-
- source.refresh_from_db()
- assert source.consecutive_failures == 1
- assert source.last_sync_error == "boom"
- mock_capture.assert_called_once()
-
def test_read_view_batches_key_filter_and_merges_rows(self):
batch_size = "products.customer_analytics.backend.logic.custom_property_sync._SYNC_KEYS_PER_QUERY"
responses = [_Response([(100.0, "acme")]), _Response([(200.0, "globex")])]
@@ -219,7 +191,7 @@ class SyncCustomPropertiesForAccountTest(TeamScopedTestMixin, BaseTest):
source_model.objects.for_team.side_effect = Exception("db down")
sync_custom_properties_for_account(team_id=self.team.id, external_id="acme")
- def test_swallows_errors_and_records_no_sync_outcome(self):
+ def test_swallows_errors_without_changing_source_health(self):
with patch(_EXECUTE, side_effect=Exception("clickhouse down")):
sync_custom_properties_for_account(team_id=self.team.id, external_id="acme")
@@ -232,7 +204,7 @@ class SyncCustomPropertiesForAccountTest(TeamScopedTestMixin, BaseTest):
@patch("posthoganalytics.feature_enabled", new=Mock(return_value=True))
class ReadViewAccessControlTest(ClickhouseTestMixin, TeamScopedTestMixin, BaseTest):
def test_userless_sync_reads_view_despite_warehouse_access_control(self):
- # The Celery sync runs with no user, so HogQL warehouse-view access control (flag on)
+ # The system sync runs with no user, so HogQL warehouse-view access control (flag on)
# fails closed and denies the view unless the sync bypasses it.
view = DataWarehouseSavedQuery.objects.create(
team=self.team,
@@ -265,81 +237,3 @@ class ReadViewLimitTest(ClickhouseTestMixin, TeamScopedTestMixin, BaseTest):
rows = _read_view(self.team, view.name, ["org_id", "score"], "org_id", external_ids)
assert len(rows) == 120
-
-
-class RecordSyncOutcomeTest(TeamScopedTestMixin, BaseTest):
- def setUp(self):
- super().setUp()
- self.view = DataWarehouseSavedQuery.objects.create(team=self.team, name="billing_view", columns={})
- self.definition = CustomPropertyDefinition.objects.create(team=self.team, name="MRR")
- self.source = CustomPropertySource.objects.create(
- team=self.team, definition=self.definition, saved_query=self.view, source_column="mrr", key_column="org_id"
- )
-
- def _record(self, **kwargs):
- record_sync_outcome(team_id=self.team.id, saved_query_id=self.view.id, **kwargs)
- self.source.refresh_from_db()
-
- @parameterized.expand(
- [
- ("clean_success", {}, True, 0, None),
- ("view_not_found", {"view_found": False}, False, 0, "View not found"),
- ("run_failed", {"run_failed": True, "run_error": "boom"}, True, 1, "boom"),
- ]
- )
- def test_single_run_outcome(self, _name, kwargs, expected_enabled, expected_failures, expected_error):
- self._record(**kwargs)
-
- assert self.source.is_enabled is expected_enabled
- assert self.source.consecutive_failures == expected_failures
- assert self.source.last_sync_error == expected_error
- assert self.source.last_synced_at is not None
-
- def test_per_source_column_error_increments_only_that_source(self):
- other_def = CustomPropertyDefinition.objects.create(team=self.team, name="Plan")
- other = CustomPropertySource.objects.create(
- team=self.team, definition=other_def, saved_query=self.view, source_column="plan", key_column="org_id"
- )
-
- self._record(source_errors={str(self.source.id): "View billing_view has no column(s): mrr"})
- other.refresh_from_db()
-
- assert self.source.consecutive_failures == 1
- assert self.source.last_sync_error == "View billing_view has no column(s): mrr"
- assert other.consecutive_failures == 0
- assert other.last_sync_error is None
-
- def test_success_resets_failure_streak_and_clears_error(self):
- CustomPropertySource.objects.filter(id=self.source.id).update(consecutive_failures=3, last_sync_error="old")
-
- self._record()
-
- assert self.source.consecutive_failures == 0
- assert self.source.last_sync_error is None
-
- def test_view_not_found_disables_and_resets_failure_streak(self):
- CustomPropertySource.objects.filter(id=self.source.id).update(consecutive_failures=3)
-
- self._record(view_found=False)
-
- assert self.source.is_enabled is False
- assert self.source.consecutive_failures == 0
-
- @parameterized.expand(
- [("below_cap", MAX_CONSECUTIVE_SYNC_FAILURES - 2, True), ("at_cap", MAX_CONSECUTIVE_SYNC_FAILURES - 1, False)]
- )
- def test_auto_disables_at_failure_cap(self, _name, starting_failures, expected_enabled):
- CustomPropertySource.objects.filter(id=self.source.id).update(consecutive_failures=starting_failures)
-
- self._record(run_failed=True, run_error="boom")
-
- assert self.source.consecutive_failures == starting_failures + 1
- assert self.source.is_enabled is expected_enabled
-
- def test_disabled_sources_are_not_touched(self):
- CustomPropertySource.objects.filter(id=self.source.id).update(consecutive_failures=2, is_enabled=False)
-
- self._record()
-
- assert self.source.consecutive_failures == 2
- assert self.source.last_synced_at is None
diff --git a/products/customer_analytics/backend/tasks/tasks.py b/products/customer_analytics/backend/tasks/tasks.py
index a76a3862ef25..30e5beae529e 100644
--- a/products/customer_analytics/backend/tasks/tasks.py
+++ b/products/customer_analytics/backend/tasks/tasks.py
@@ -1,5 +1,6 @@
from celery import shared_task
+from posthog.exceptions_capture import capture_exception
from posthog.models.scoping import with_team_scope
from products.customer_analytics.backend.facade.email_matching import (
@@ -7,12 +8,16 @@ from products.customer_analytics.backend.facade.email_matching import (
recalculate_email_thread_links,
)
from products.customer_analytics.backend.logic.announcements import send_pending_deliveries
-from products.customer_analytics.backend.logic.custom_property_sync import run_custom_property_sync
+from products.customer_analytics.backend.logic.custom_property_sync import sync_custom_property_values
@shared_task(name="customer_analytics.process_custom_property_sync", ignore_result=True)
def process_custom_property_sync(team_id: int, saved_query_id: str) -> None:
- run_custom_property_sync(team_id=team_id, saved_query_id=saved_query_id)
+ try:
+ sync_custom_property_values(team_id=team_id, saved_query_id=saved_query_id)
+ except Exception as error:
+ capture_exception(error)
+ raise
@shared_task(
diff --git a/products/customer_analytics/backend/test/test_facade.py b/products/customer_analytics/backend/test/test_facade.py
index c4497b45a067..420c79752db1 100644
--- a/products/customer_analytics/backend/test/test_facade.py
+++ b/products/customer_analytics/backend/test/test_facade.py
@@ -762,7 +762,7 @@ class TestCustomPropertySourceFacade(TeamScopedTestMixin, BaseTest):
assert not CustomPropertySource.objects.for_team(self.team.id).filter(id=source.id).exists()
@parameterized.expand([("enabled", True, True), ("disabled", False, False)])
- def test_create_enqueues_initial_sync_only_when_enabled(self, _name, is_enabled, expect_enqueued):
+ def test_create_enqueues_initial_account_property_sync(self, _name, is_enabled, expect_enqueued):
with patch.object(facade, "current_app") as mock_app, self.captureOnCommitCallbacks(execute=True):
self._create(is_enabled=is_enabled)
@@ -774,7 +774,7 @@ class TestCustomPropertySourceFacade(TeamScopedTestMixin, BaseTest):
else:
mock_app.send_task.assert_not_called()
- def test_reenabling_a_source_enqueues_a_sync(self):
+ def test_reenabling_a_source_enqueues_an_initial_account_property_sync(self):
source = self._create(is_enabled=False)
with patch.object(facade, "current_app") as mock_app, self.captureOnCommitCallbacks(execute=True):
@@ -792,7 +792,7 @@ class TestCustomPropertySourceFacade(TeamScopedTestMixin, BaseTest):
("column_change", {"source_column": "org_id"}, True),
]
)
- def test_update_enqueues_only_on_meaningful_change(self, _name, fields, expect_enqueued):
+ def test_update_enqueues_initial_sync_only_after_a_meaningful_change(self, _name, fields, expect_enqueued):
source = self._create()
with patch.object(facade, "current_app") as mock_app, self.captureOnCommitCallbacks(execute=True):
diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx
index b4d03804ed17..321d3a9cb8c0 100644
--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx
+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx
@@ -13,12 +13,11 @@ import {
import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'
import { TZLabel } from 'lib/components/TZLabel'
-import { FEATURE_FLAGS, TeamMembershipLevel } from 'lib/constants'
+import { TeamMembershipLevel } from 'lib/constants'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
import { LemonTag, LemonTagType } from 'lib/lemon-ui/LemonTag'
import { Link } from 'lib/lemon-ui/Link'
import { Popover } from 'lib/lemon-ui/Popover'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { urls } from 'scenes/urls'
import type {
@@ -39,7 +38,6 @@ const TAG_TYPE_BY_SYNC_LEVEL: Record<SourceSyncStatusLevel, LemonTagType> = {
}
export function CustomPropertiesConfig(): JSX.Element {
- const { featureFlags } = useValues(featureFlagLogic)
const {
filteredDefinitions,
definitionsLoading,
@@ -65,8 +63,6 @@ export function CustomPropertiesConfig(): JSX.Element {
scope: RestrictionScope.Project,
minimumAccessLevel: TeamMembershipLevel.Admin,
})
- const accountSyncHistoryEnabled = !!featureFlags[FEATURE_FLAGS.WAREHOUSE_ACCOUNT_PROPERTIES_S3_SYNC]
-
const confirmDelete = (definition: CustomPropertyDefinitionApi): void => {
LemonDialog.open({
title: `Delete ${definition.name}?`,
@@ -149,15 +145,13 @@ export function CustomPropertiesConfig(): JSX.Element {
),
},
{
- title: accountSyncHistoryEnabled ? (
+ title: (
<span className="flex items-center gap-1">
Sync
<Tooltip title="Expand a warehouse-backed account property to see staging, retries, and account updates.">
<IconInfo className="text-secondary" />
</Tooltip>
</span>
- ) : (
- 'Sync'
),
render: (_, definition) => {
if (definition.is_canonical) {
@@ -250,9 +244,7 @@ export function CustomPropertiesConfig(): JSX.Element {
pagination={{ pageSize: 20, hideOnSinglePage: true }}
expandable={{
rowExpandable: (definition) =>
- accountSyncHistoryEnabled &&
- definition.target_type === 'account' &&
- !!definition.source?.saved_query,
+ definition.target_type === 'account' && !!definition.source?.saved_query,
onRowExpand: (definition) => definition.source && loadRuns({ sourceId: definition.source.id }),
noIndent: true,
expandedRowRender: (definition) =>