Skip to content

fix(logs): import emit_signal from signals facade#60955

Merged
webjunkie merged 1 commit into
masterfrom
fix/logs-signals-facade-import
Jun 1, 2026
Merged

fix(logs): import emit_signal from signals facade#60955
webjunkie merged 1 commit into
masterfrom
fix/logs-signals-facade-import

Conversation

@webjunkie
Copy link
Copy Markdown
Contributor

Problem

Every Temporal worker crash-loops at import time on prod-eu and prod-us with:

ModuleNotFoundError: No module named 'products.signals.backend.api'

The signals facade refactor (#60848) moved products/signals/backend/api.py to products/signals/backend/facade/api.py and updated every caller it knew about. It branched before #60637 added products/logs/backend/alert_signal_emitter.py, so that one caller was missed and still imported the old products.signals.backend.api path.

The old module no longer exists on master. posthog/temporal/common/worker.py imports products.logs.backend.temporal unconditionally at module level, and that package pulls in the alert signal emitter — so any worker started via start_temporal_worker (session replay, video export, batch exports, data modeling, tasks, …) fails to import and crash-loops. Not session-replay specific.

Changes

One-line import fix in alert_signal_emitter.py, pointing at the new facade path — matching what #60848 did for every other caller, and routing through the signals product's public facade as the isolation boundary expects.

-from products.signals.backend.api import emit_signal
+from products.signals.backend.facade.api import emit_signal

How did you test this code?

Agent-authored. No manual testing. Automated checks run:

  • Imported the failing worker chain under Django (django.setup()import products.logs.backend.temporalfrom products.logs.backend.alert_signal_emitter import emit_signal) — resolves cleanly, emit_signal.__module__ is now products.signals.backend.facade.api.
  • lint-staged on commit: ruff fix/format + ty check passed.
  • Confirmed via git grep this was the only stale importer of the old path on master (the remaining hit is a frontend doc comment).

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

🤖 Agent context

Authored by Claude Code (Opus 4.8) at the user's direction, triggered by a worker crash-loop alert. The agent read the alert traceback, traced the import chain, and used git history to identify that #60848 (the facade move) predated the #60637 caller — a stale-merge miss rather than a logic bug. Verified the fix by reproducing the worker import chain under Django rather than relying on static reasoning, since the failure was import-time. Chose the facade path over re-adding the old module to stay consistent with the isolation boundary.

The signals facade refactor (#60848) moved api.py to facade/api.py and
updated every known caller, but it predated the alert signal emitter
added in #60637, so that caller still imported the old
products.signals.backend.api path.

The old module no longer exists on master, so any process that loads the
logs temporal activities (e.g. the session-replay temporal worker) fails
at import time with ModuleNotFoundError and crash-loops. Point the import
at the new facade path.
Copilot AI review requested due to automatic review settings June 1, 2026 15:58
@webjunkie webjunkie merged commit 4568b30 into master Jun 1, 2026
61 of 62 checks passed
@webjunkie webjunkie deleted the fix/logs-signals-facade-import branch June 1, 2026 15:58
@assign-reviewers-posthog assign-reviewers-posthog Bot requested a review from a team June 1, 2026 15:58
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 1, 2026

Reviews (1): Last reviewed commit: "fix(logs): import emit_signal from signa..." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@deployment-status-posthog
Copy link
Copy Markdown

deployment-status-posthog Bot commented Jun 1, 2026

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-06-01 16:35 UTC Run
prod-us ✅ Deployed 2026-06-01 16:48 UTC Run
prod-eu ✅ Deployed 2026-06-01 16:51 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants