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.

chore(data-modeling): deprecate stale temporal patches (#113170)

Jovan Sakovic094ba9bd9048
diff --git a/posthog/temporal/data_modeling/workflows/execute_dag.py b/posthog/temporal/data_modeling/workflows/execute_dag.py
index d290a881fb7d..a7cba28bb7a8 100644
--- a/posthog/temporal/data_modeling/workflows/execute_dag.py
+++ b/posthog/temporal/data_modeling/workflows/execute_dag.py
@@ -41,8 +41,8 @@ from products.data_quality.backend.facade.enums import SuiteRunTrigger
MAX_CONCURRENT_CHILDREN = 10
+# Deprecated: kept only so replay accepts histories that still carry the marker.
TRINO_DEPENDENCIES_PATCH = "trino-model-dependencies-2026-09"
-
NODE_AUDIT_PATCH = "data-quality-node-audit-2026-08"
@@ -293,7 +293,7 @@ class ExecuteDAGWorkflow(PostHogWorkflow):
suspended_node_set: set[str] = set(dag_structure.suspended_nodes.get(serving_engine, []))
downstreams = _get_downstream_lookup(edge_lookup)
skipped_jobs: list[SkippedDataModelingNode] = []
- track_trino_dependencies = temporalio.workflow.patched(TRINO_DEPENDENCIES_PATCH)
+ temporalio.workflow.deprecate_patch(TRINO_DEPENDENCIES_PATCH)
unavailable_trino_nodes: set[str] = set(dag_structure.suspended_nodes.get("managed_warehouse", []))
skipped_trino_jobs: list[SkippedDataModelingNode] = []
# execute child workflows with bounded concurrency using a sliding window;
@@ -378,10 +378,8 @@ class ExecuteDAGWorkflow(PostHogWorkflow):
async def _run_child(node_id: str) -> NodeResult:
async with semaphore:
- blocked_trino_upstreams = (
- sorted(upstream for upstream in unavailable_trino_nodes if node_id in downstreams[upstream])
- if track_trino_dependencies
- else []
+ blocked_trino_upstreams = sorted(
+ upstream for upstream in unavailable_trino_nodes if node_id in downstreams[upstream]
)
child_inputs = MaterializeViewWorkflowInputs(
team_id=inputs.team_id,
@@ -476,9 +474,7 @@ class ExecuteDAGWorkflow(PostHogWorkflow):
node_results.append(nr)
if nr.trino_materialized is True:
unavailable_trino_nodes.discard(nr.node_id)
- if track_trino_dependencies and (
- nr.trino_materialized is False or (not managed_warehouse_only and nr.trino_materialized is None)
- ):
+ if nr.trino_materialized is False or (not managed_warehouse_only and nr.trino_materialized is None):
unavailable_trino_nodes.add(nr.node_id)
if not nr.success:
failed_node_set.add(nr.node_id)
@@ -581,17 +577,12 @@ class ExecuteDAGWorkflow(PostHogWorkflow):
of which need the database. Asking first keeps a team with no checks, or an org that never
opted in, from paying for a child workflow and a suite row on every materialization.
"""
- # Filtering can empty the list and skip the commands below, so an old history that recorded
- # them has to keep taking the old path. A rolling deploy reaches this: an old worker can
- # record those commands against a new child's quality_audited result.
- if temporalio.workflow.patched(NODE_AUDIT_PATCH):
- checkable_node_ids = [
- result.node_id
- for result in node_results
- if result.success and not result.skipped and not result.quality_audited
- ]
- else:
- checkable_node_ids = [result.node_id for result in node_results if result.success and not result.skipped]
+ temporalio.workflow.deprecate_patch(NODE_AUDIT_PATCH)
+ checkable_node_ids = [
+ result.node_id
+ for result in node_results
+ if result.success and not result.skipped and not result.quality_audited
+ ]
if not checkable_node_ids:
return
diff --git a/posthog/temporal/data_modeling/workflows/materialize_view.py b/posthog/temporal/data_modeling/workflows/materialize_view.py
index e903fd316098..1deffe8a2b36 100644
--- a/posthog/temporal/data_modeling/workflows/materialize_view.py
+++ b/posthog/temporal/data_modeling/workflows/materialize_view.py
@@ -31,7 +31,6 @@ from posthog.temporal.data_modeling.activities import (
SucceedMaterializationInputs,
SucceedMaterializationResult,
check_managed_warehouse_shadow_eligibility_activity,
- check_managed_warehouse_shadow_enabled_activity,
clear_cdp_staging_activity,
create_data_modeling_job_activity,
fail_materialization_activity,
@@ -61,10 +60,7 @@ from posthog.temporal.data_modeling.metrics import (
from posthog.temporal.data_modeling.workflows.enrich_view_semantics import EnrichViewSemanticsWorkflow
from posthog.temporal.utils import CDPProducerWorkflowInputs
-from products.customer_analytics.backend.facade.temporal_contracts import (
- DispatchAccountPropertySyncInput,
- StageAccountPropertySyncInput,
-)
+from products.customer_analytics.backend.facade.temporal_contracts import StageAccountPropertySyncInput
from products.data_modeling.backend.facade.models import DataModelingJobEngine
from products.data_quality.backend.facade.contracts import (
CHECK_SUITE_WORKFLOW_NAME,
@@ -80,18 +76,11 @@ from products.warehouse_sources.backend.facade.hooks import (
PersonPropertySyncActivityInputs,
)
-# Covers every command the data quality feature adds here: the stage/audit/publish trio and the
-# warn-mode suite child.
+# Deprecated: kept only so replay accepts histories that still carry the marker.
QUALITY_AUDIT_PATCH = "data-quality-audit-2026-08"
QUALITY_BLOCK_SUITE_RUN_ID_PATCH = "data-quality-block-suite-run-id-2026-09"
-ACCOUNT_PROPERTY_S3_SYNC_PATCH = "account-property-s3-sync-2026-08"
ACCOUNT_PROPERTY_STAGING_WORKFLOW_PATCH = "account-property-staging-workflow-2026-08"
-
-# Covers the CDP producer child and the staging-cleanup activity. Both are new commands, so a
-# history recorded before this deploy has to keep taking the branch that issues neither.
CDP_VIEW_TRIGGER_PATCH = "cdp-data-warehouse-view-trigger-2026-08"
-
-# Histories recorded before this marker must keep passing only the team ID to the activity.
DUCKGRES_SHADOW_TRANSLATION_GATE_PATCH = "duckgres-shadow-translation-gate-2026-09"
TRINO_SHADOW_EXECUTION_PATCH = "trino-shadow-execution-2026-09"
@@ -207,30 +196,23 @@ class MaterializeViewWorkflow(PostHogWorkflow):
managed_warehouse_job_id = None
managed_warehouse_only = inputs.managed_warehouse_only
- if temporalio.workflow.patched(DUCKGRES_SHADOW_TRANSLATION_GATE_PATCH):
- managed_warehouse_enabled = await temporalio.workflow.execute_activity(
- check_managed_warehouse_shadow_eligibility_activity,
- ManagedWarehouseShadowEligibilityInputs(
- team_id=inputs.team_id,
- dag_id=inputs.dag_id,
- node_id=inputs.node_id,
- ),
- start_to_close_timeout=dt.timedelta(minutes=5),
- retry_policy=temporalio.common.RetryPolicy(
- maximum_attempts=3,
- ),
- )
- else:
- managed_warehouse_enabled = await temporalio.workflow.execute_activity(
- check_managed_warehouse_shadow_enabled_activity,
- inputs.team_id,
- start_to_close_timeout=dt.timedelta(minutes=5),
- retry_policy=temporalio.common.RetryPolicy(
- maximum_attempts=3,
- ),
- )
+ temporalio.workflow.deprecate_patch(DUCKGRES_SHADOW_TRANSLATION_GATE_PATCH)
+ managed_warehouse_enabled = await temporalio.workflow.execute_activity(
+ check_managed_warehouse_shadow_eligibility_activity,
+ ManagedWarehouseShadowEligibilityInputs(
+ team_id=inputs.team_id,
+ dag_id=inputs.dag_id,
+ node_id=inputs.node_id,
+ ),
+ start_to_close_timeout=dt.timedelta(minutes=5),
+ retry_policy=temporalio.common.RetryPolicy(
+ maximum_attempts=3,
+ ),
+ )
- use_trino = managed_warehouse_enabled and temporalio.workflow.patched(TRINO_SHADOW_EXECUTION_PATCH)
+ if managed_warehouse_enabled:
+ temporalio.workflow.deprecate_patch(TRINO_SHADOW_EXECUTION_PATCH)
+ use_trino = managed_warehouse_enabled
trino_materialized: bool | None = False if use_trino else None
managed_warehouse_shadow_handle = None
if (managed_warehouse_enabled or managed_warehouse_only) and not (use_trino and inputs.skip_trino):
@@ -315,15 +297,8 @@ class MaterializeViewWorkflow(PostHogWorkflow):
# materialize_view_activity guarantees file_uris is non-empty even for
# zero-row results — it falls back to _write_empty_parquet_for_zero_rows
# so prepare_s3_files_for_querying has something to list.
- # Reading the mode as skip when the marker is absent keeps every command this
- # feature adds out of a history that predates it. A rolling deploy can hand an old
- # workflow worker a result from new activity code, and the SDK drops the fields the
- # old dataclass lacks, so the mode alone cannot say who wrote the history.
- quality_audit = (
- self._audit_mode(materialize_result, inputs)
- if temporalio.workflow.patched(QUALITY_AUDIT_PATCH)
- else QUALITY_AUDIT_SKIP
- )
+ temporalio.workflow.deprecate_patch(QUALITY_AUDIT_PATCH)
+ quality_audit = self._audit_mode(materialize_result, inputs)
staged_verdict: _StagedAuditVerdict | None = None
prepare_inputs = PrepareQueryableTableInputs(
team_id=inputs.team_id,
@@ -345,6 +320,7 @@ class MaterializeViewWorkflow(PostHogWorkflow):
inputs, job_id, materialize_result, stage_result.staged_folder_path
)
if staged_verdict is not None and staged_verdict.blocking_failures:
+ temporalio.workflow.deprecate_patch(QUALITY_BLOCK_SUITE_RUN_ID_PATCH)
await temporalio.workflow.execute_activity(
quality_block_materialization_activity,
QualityBlockMaterializationInputs(
@@ -353,18 +329,14 @@ class MaterializeViewWorkflow(PostHogWorkflow):
dag_id=inputs.dag_id,
job_id=job_id,
blocking_failures=staged_verdict.blocking_failures,
- suite_run_id=(
- staged_verdict.suite_run_id
- if temporalio.workflow.patched(QUALITY_BLOCK_SUITE_RUN_ID_PATCH)
- else None
- ),
+ suite_run_id=staged_verdict.suite_run_id,
),
start_to_close_timeout=dt.timedelta(minutes=5),
retry_policy=temporalio.common.RetryPolicy(maximum_attempts=3),
)
get_node_finished_metric("quality_blocked").add(1)
- if temporalio.workflow.patched(CDP_VIEW_TRIGGER_PATCH):
- await self._discard_staged_cdp_rows(inputs, job_id, materialize_result)
+ temporalio.workflow.deprecate_patch(CDP_VIEW_TRIGGER_PATCH)
+ await self._discard_staged_cdp_rows(inputs, job_id, materialize_result)
end_time = temporalio.workflow.now()
blocked_duration_seconds = (end_time - start_time).total_seconds()
if managed_warehouse_shadow_handle is not None:
@@ -429,8 +401,8 @@ class MaterializeViewWorkflow(PostHogWorkflow):
# None for in-flight runs on the pre-deploy activity version — treat that as "not needed".
await self._maybe_enrich_view_semantics(inputs, succeed_result)
- if temporalio.workflow.patched(CDP_VIEW_TRIGGER_PATCH):
- await self._maybe_produce_cdp_rows(inputs, job_id, materialize_result)
+ temporalio.workflow.deprecate_patch(CDP_VIEW_TRIGGER_PATCH)
+ await self._maybe_produce_cdp_rows(inputs, job_id, materialize_result)
quality_audited = staged_verdict is not None
if quality_audit == QUALITY_AUDIT_WARN:
@@ -440,13 +412,8 @@ class MaterializeViewWorkflow(PostHogWorkflow):
# that reads it. Fire-and-forget on the metadata queue, like enrichment above.
await self._maybe_sync_person_properties(inputs, materialize_result, job_id)
- # New executions start the isolated staging child. A history that recorded the old
- # inline dispatch under ACCOUNT_PROPERTY_S3_SYNC_PATCH must keep emitting that
- # command on replay, so keep the old path in the else branch.
- if temporalio.workflow.patched(ACCOUNT_PROPERTY_STAGING_WORKFLOW_PATCH):
- await self._maybe_stage_account_properties(inputs, materialize_result, job_id)
- elif temporalio.workflow.patched(ACCOUNT_PROPERTY_S3_SYNC_PATCH):
- await self._replay_account_property_dispatch(inputs, materialize_result, job_id)
+ temporalio.workflow.deprecate_patch(ACCOUNT_PROPERTY_STAGING_WORKFLOW_PATCH)
+ await self._maybe_stage_account_properties(inputs, materialize_result, job_id)
# after the main workflow succeeds, collect shadow stats for comparison
if managed_warehouse_shadow_handle is not None:
@@ -505,7 +472,8 @@ class MaterializeViewWorkflow(PostHogWorkflow):
)
# A failure after the activity returned (publish, succeed) leaves that run's staged
# rows behind. The activity cleans up after its own failures itself.
- if materialize_result is not None and temporalio.workflow.patched(CDP_VIEW_TRIGGER_PATCH):
+ if materialize_result is not None:
+ temporalio.workflow.deprecate_patch(CDP_VIEW_TRIGGER_PATCH)
await self._discard_staged_cdp_rows(inputs, job_id, materialize_result)
try:
await temporalio.workflow.execute_activity(
@@ -706,26 +674,6 @@ class MaterializeViewWorkflow(PostHogWorkflow):
extra={"job_id": job_id, "error": str(e)},
)
- async def _replay_account_property_dispatch(
- self,
- inputs: MaterializeViewWorkflowInputs,
- materialize_result: MaterializeViewResult,
- job_id: str,
- ) -> None:
- if not materialize_result.account_property_sync_enabled:
- return
- await temporalio.workflow.execute_activity(
- "dispatch-warehouse-account-property-sync",
- DispatchAccountPropertySyncInput(
- team_id=inputs.team_id,
- saved_query_id=materialize_result.saved_query_id,
- job_id=job_id,
- ),
- task_queue=settings.DATA_WAREHOUSE_METADATA_TASK_QUEUE,
- start_to_close_timeout=dt.timedelta(minutes=5),
- retry_policy=temporalio.common.RetryPolicy(maximum_attempts=5),
- )
-
async def _maybe_stage_account_properties(
self,
inputs: MaterializeViewWorkflowInputs,
diff --git a/posthog/temporal/tests/data_modeling/test_execute_dag_data_quality.py b/posthog/temporal/tests/data_modeling/test_execute_dag_data_quality.py
index ea29f69b83e5..042cf89108d7 100644
--- a/posthog/temporal/tests/data_modeling/test_execute_dag_data_quality.py
+++ b/posthog/temporal/tests/data_modeling/test_execute_dag_data_quality.py
@@ -2,7 +2,6 @@ import uuid
import datetime as dt
import pytest
-from unittest.mock import patch
import temporalio.worker
import temporalio.workflow
@@ -140,18 +139,6 @@ class TestPostMaterializationChecks:
assert result.successful_nodes == 1
assert result.failed_nodes == 0
- async def test_a_history_without_the_patch_marker_still_sweeps_every_node(self, ateam) -> None:
- # An old DAG worker records the gate activity and suite child against a new child's
- # quality_audited result. Filtering on replay would omit commands that history already has.
- audited = str(uuid.uuid4())
- _mock_workflow_should_self_audit.add(audited)
-
- with patch.object(temporalio.workflow, "patched", return_value=False):
- await self._run_dag(ateam.pk, [audited])
-
- assert len(_suite_runs_started) == 1
- assert _suite_runs_started[0]["node_ids"] == [audited]
-
async def test_a_node_that_audited_itself_is_not_swept_again(self, ateam) -> None:
audited, unaudited = str(uuid.uuid4()), str(uuid.uuid4())
_mock_workflow_should_self_audit.add(audited)
diff --git a/posthog/temporal/tests/data_modeling/test_execute_dag_workflow.py b/posthog/temporal/tests/data_modeling/test_execute_dag_workflow.py
index 3faa763c7091..e7a793c80acb 100644
--- a/posthog/temporal/tests/data_modeling/test_execute_dag_workflow.py
+++ b/posthog/temporal/tests/data_modeling/test_execute_dag_workflow.py
@@ -920,9 +920,8 @@ class TestTrinoDependencyOutcomes:
@pytest.mark.parametrize(
"upstream_success,downstream_enabled", [(True, True), (False, True), (None, True), (None, False)]
)
- @pytest.mark.parametrize("patched", [True, False])
async def test_downstream_trino_waits_for_upstream_success(
- self, upstream_success: bool | None, downstream_enabled: bool, patched: bool
+ self, upstream_success: bool | None, downstream_enabled: bool
) -> None:
plan = DAGPlan(nodes=["a", "b", "c"], executable_nodes=["a", "b", "c"], edges=[("a", "b"), ("b", "c")])
child_inputs: list[MaterializeViewWorkflowInputs] = []
@@ -956,7 +955,7 @@ class TestTrinoDependencyOutcomes:
temporal_workflow, "execute_activity", new=AsyncMock(side_effect=execute_activity)
) as activities,
patch.object(temporal_workflow, "start_child_workflow", new=AsyncMock(side_effect=start_child)),
- patch.object(temporal_workflow, "patched", return_value=patched),
+ patch.object(temporal_workflow, "deprecate_patch"),
patch.object(temporal_workflow, "now", return_value=dt.datetime(2026, 1, 1, tzinfo=dt.UTC)),
patch.object(temporal_workflow, "info", return_value=info),
patch.object(temporal_workflow, "metric_meter", return_value=MagicMock()),
@@ -966,7 +965,7 @@ class TestTrinoDependencyOutcomes:
assert result.successful_nodes == 3
assert [i.node_id for i in child_inputs] == ["a", "b", "c"]
- blocked = patched and upstream_success is not True
+ blocked = upstream_success is not True
assert [i.skip_trino for i in child_inputs] == [False, blocked, blocked]
skips = [
c.args[1]
diff --git a/posthog/temporal/tests/data_modeling/test_materialize_view_workflow.py b/posthog/temporal/tests/data_modeling/test_materialize_view_workflow.py
index 81198f6dd699..e12394a3a82d 100644
--- a/posthog/temporal/tests/data_modeling/test_materialize_view_workflow.py
+++ b/posthog/temporal/tests/data_modeling/test_materialize_view_workflow.py
@@ -1,7 +1,6 @@
import asyncio
import datetime as dt
import dataclasses
-from collections.abc import Callable
from contextlib import ExitStack
import pytest
@@ -22,10 +21,6 @@ from posthog.temporal.data_modeling.activities import (
)
from posthog.temporal.data_modeling.activities.enrich_view_semantics import EnrichViewSemanticsInputs
from posthog.temporal.data_modeling.workflows.materialize_view import (
- ACCOUNT_PROPERTY_S3_SYNC_PATCH,
- ACCOUNT_PROPERTY_STAGING_WORKFLOW_PATCH,
- QUALITY_BLOCK_SUITE_RUN_ID_PATCH,
- TRINO_SHADOW_EXECUTION_PATCH,
MaterializeViewWorkflow,
MaterializeViewWorkflowInputs,
_StagedAuditVerdict,
@@ -63,7 +58,6 @@ class TestQualityGateBranching:
activity_results: list,
child_result: dict | Exception,
*,
- patched: bool | Callable[[str], bool] = True,
shadow_handle: AsyncMock | None = None,
start_child: AsyncMock | None = None,
inputs: MaterializeViewWorkflowInputs | None = None,
@@ -82,12 +76,7 @@ class TestQualityGateBranching:
stack.enter_context(
patch.object(temporalio.workflow, "start_child_workflow", new=start_child or AsyncMock())
)
- patched_mock = (
- patch.object(temporalio.workflow, "patched", side_effect=patched)
- if callable(patched)
- else patch.object(temporalio.workflow, "patched", return_value=patched)
- )
- stack.enter_context(patched_mock)
+ stack.enter_context(patch.object(temporalio.workflow, "deprecate_patch"))
stack.enter_context(patch.object(temporalio.workflow, "info", return_value=info))
stack.enter_context(patch.object(temporalio.workflow, "now", return_value=dt.datetime(2026, 8, 1)))
stack.enter_context(patch.object(temporalio.workflow, "logger"))
@@ -200,24 +189,6 @@ class TestQualityGateBranching:
== "check_managed_warehouse_shadow_eligibility_activity"
)
- async def test_legacy_history_passes_no_suite_run_id_to_the_quality_block_activity(self):
- activity_results = [
- False,
- "job-1",
- _materialize_result("gate"),
- StageQueryableFilesResult(staged_folder_path="staged_1"),
- None,
- ]
-
- _, execute_activity = await self._run(
- activity_results,
- {"suite_run_id": "suite-1", "checks_failed_blocking": 2},
- patched=lambda change_id: change_id != QUALITY_BLOCK_SUITE_RUN_ID_PATCH,
- )
-
- block_inputs = execute_activity.await_args_list[-1].args[1]
- assert block_inputs.suite_run_id is None
-
async def test_account_staging_starts_an_isolated_child_workflow(self):
materialize_result = dataclasses.replace(
_materialize_result("skip"),
@@ -244,67 +215,6 @@ class TestQualityGateBranching:
assert staging_call.args[1].delta_version == 5
assert staging_call.kwargs["parent_close_policy"] == temporalio.workflow.ParentClosePolicy.ABANDON
- async def test_a_legacy_history_replays_the_inline_dispatch_command(self):
- # A history recorded under ACCOUNT_PROPERTY_S3_SYNC_PATCH holds the old dispatch activity
- # command and no delta_version. Replaying it with only that marker present must re-emit the
- # dispatch command, not the staging child, or the execution fails as nondeterministic.
- materialize_result = dataclasses.replace(
- _materialize_result("skip"),
- account_property_sync_enabled=True,
- )
- activity_results = [
- False,
- "job-1",
- materialize_result,
- PrepareQueryableTableResult(storage_delta_mib=None, total_storage_mib=None),
- None,
- None,
- ]
- start_child = AsyncMock()
-
- _, execute_activity = await self._run(
- activity_results,
- {},
- patched=lambda change_id: change_id == ACCOUNT_PROPERTY_S3_SYNC_PATCH,
- start_child=start_child,
- )
-
- assert any(
- call.args[0] == "dispatch-warehouse-account-property-sync" for call in execute_activity.await_args_list
- )
- assert not [
- call for call in start_child.await_args_list if call.args[0] == "stage-warehouse-account-properties"
- ]
-
- async def test_the_isolated_staging_child_wins_when_both_markers_are_present(self):
- materialize_result = dataclasses.replace(
- _materialize_result("skip"),
- account_property_sync_enabled=True,
- delta_version=5,
- )
- activity_results = [
- False,
- "job-1",
- materialize_result,
- PrepareQueryableTableResult(storage_delta_mib=None, total_storage_mib=None),
- None,
- ]
- start_child = AsyncMock()
-
- _, execute_activity = await self._run(
- activity_results,
- {},
- patched=lambda change_id: (
- change_id in (ACCOUNT_PROPERTY_STAGING_WORKFLOW_PATCH, ACCOUNT_PROPERTY_S3_SYNC_PATCH)
- ),
- start_child=start_child,
- )
-
- assert any(call.args[0] == "stage-warehouse-account-properties" for call in start_child.await_args_list)
- assert not any(
- call.args[0] == "dispatch-warehouse-account-property-sync" for call in execute_activity.await_args_list
- )
-
async def test_a_passing_audit_publishes_and_succeeds(self):
activity_results = [
False,
@@ -322,34 +232,6 @@ class TestQualityGateBranching:
assert "publish_queryable_table_activity" in started
assert "succeed_materialization_activity" in started
- @pytest.mark.parametrize("mode", ["gate", "warn"])
- async def test_a_history_without_the_patch_marker_adds_no_command(self, mode):
- # A rolling deploy pairs an old workflow worker with a new activity worker, and the SDK
- # drops the fields the old dataclass lacks. So a mode can reach a history that recorded
- # only the prepare command, and replaying it here has to emit exactly that.
- activity_results = [
- False,
- "job-1",
- _materialize_result(mode),
- PrepareQueryableTableResult(storage_delta_mib=None, total_storage_mib=None), # prepare
- None, # succeed
- ]
- start_child = AsyncMock()
-
- result, execute_activity = await self._run(
- activity_results, {"checks_failed_blocking": 2}, patched=False, start_child=start_child
- )
-
- started = [call.args[0].__name__ for call in execute_activity.await_args_list]
- assert "prepare_queryable_table_activity" in started
- assert "stage_queryable_files_activity" not in started
- assert "quality_block_materialization_activity" not in started
- start_child.assert_not_awaited()
- assert result.quality_blocking_failures is None
- assert result.quality_audited is False
- assert execute_activity.await_args_list[0].args[1] == 7
- assert execute_activity.await_args_list[0].args[0].__name__ == "check_managed_warehouse_shadow_enabled_activity"
-
async def test_an_audit_that_reached_no_verdict_leaves_the_node_to_the_sweep(self):
# Returning zero here would publish and also claim the node was audited, so the DAG's
# fallback sweep would skip the one node whose checks never ran.
@@ -393,8 +275,7 @@ class TestQualityGateBranching:
assert result.quality_audited is expected_audited
assert result.quality_blocking_failures is None
- @pytest.mark.parametrize("trino_patch", [False, True])
- async def test_a_blocked_publish_still_settles_the_managed_warehouse_shadow(self, trino_patch: bool):
+ async def test_a_blocked_publish_still_settles_the_managed_warehouse_shadow(self):
# The blocked branch returns early. Leaving the shadow activity unawaited holds the parent
# DAG's concurrency slot and orphans the shadow job.
shadow_handle = AsyncMock()
@@ -412,19 +293,12 @@ class TestQualityGateBranching:
patch.object(MaterializeViewWorkflow, "_collect_shadow_comparison", new=AsyncMock()) as collect,
patch.object(temporalio.workflow, "start_activity", return_value=shadow_handle) as start_shadow,
):
- result, execute_activity = await self._run(
- activity_results,
- {"checks_failed_blocking": 1},
- patched=lambda name: trino_patch if name == TRINO_SHADOW_EXECUTION_PATCH else True,
- )
+ result, execute_activity = await self._run(activity_results, {"checks_failed_blocking": 1})
assert result.quality_blocking_failures == 1
assert execute_activity.await_args_list[1].args[1].engine == DataModelingJobEngine.MANAGED_WAREHOUSE
collect.assert_awaited_once()
- assert start_shadow.call_args.args[1].use_trino is trino_patch
- assert start_shadow.call_args.kwargs["start_to_close_timeout"] == dt.timedelta(
- minutes=365 if trino_patch else 20
- )
+ assert start_shadow.call_args.args[1].use_trino is True
def _cancelled_child_error() -> ChildWorkflowError: