:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(session-replay): make surfacing-scoring workflow input optional (#64316)
Arno Hillend13c86ddde09
diff --git a/posthog/temporal/session_replay/surfacing_scoring_sweep/workflow.py b/posthog/temporal/session_replay/surfacing_scoring_sweep/workflow.pyindex 2bf636043061..873c457015cc 100644--- a/posthog/temporal/session_replay/surfacing_scoring_sweep/workflow.py+++ b/posthog/temporal/session_replay/surfacing_scoring_sweep/workflow.py@@ -52,6 +52,8 @@ class ScoreSessionsBatchWorkflow(PostHogWorkflow):"""One tick of the scoring pipeline."""inputs_cls = ScoreSessionsBatchInputs+ # Input dataclass is empty, so allow starting with no inputs.+ inputs_optional = True@workflow.runasync def run(self, inputs: ScoreSessionsBatchInputs) -> ScoreSessionsBatchResult:diff --git a/posthog/temporal/tests/session_replay/surfacing_scoring_sweep/test_workflow.py b/posthog/temporal/tests/session_replay/surfacing_scoring_sweep/test_workflow.pyindex bc2f8247795b..235007cfdde4 100644--- a/posthog/temporal/tests/session_replay/surfacing_scoring_sweep/test_workflow.py+++ b/posthog/temporal/tests/session_replay/surfacing_scoring_sweep/test_workflow.py@@ -48,6 +48,13 @@ class TestSummarize:assert summary == ScoreSessionsBatchResult(total_scored=10, chunks_dispatched=3, chunks_failed=1)+class TestParseInputs:+ # inputs_optional lets the workflow start with no inputs; "{}" still parses.+ @pytest.mark.parametrize("inputs", [[], ["{}"]])+ def test_parse_inputs_returns_default(self, inputs: list[str]) -> None:+ assert ScoreSessionsBatchWorkflow.parse_inputs(inputs) == ScoreSessionsBatchInputs()++@pytest.mark.asyncioasync def test_workflow_noop_when_plan_has_no_chunks() -> None:@activity.defn(name="list_chunks_activity")