Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Size Change: +2.06 kB (0%) Total Size: 134 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Migration SQL ChangesHey 👋, we've detected some migrations on this PR. Here's the SQL output for each migration, make sure they make sense:
|
🔍 Migration Risk AnalysisWe've analyzed your migrations for potential risks. Summary: 0 Safe | 2 Needs Review | 0 Blocked
|
1a73893 to
225e0e1
Compare
225e0e1 to
b136f8e
Compare
1a7be31 to
7bd9168
Compare
80b0e44 to
796c4f3
Compare
Merge activity
|
Covers the new draft alert workflow introduced in PostHog/posthog#57271: - Creating alerts via click-to-create flow - Draft state concept - Filter, threshold, and notification configuration - Pre-enable checks (blocked/warning states) - Alert management (disable, snooze, reset, delete)

Problem
Creating a logs alert required navigating to a separate
/logs/alerts/newpage, filling out a form, and then being redirected to the detail page. This two-step flow was awkward and the "New alert" page added unnecessary routing complexity. Additionally, alerts had no concept of a "draft" state — every alert was immediately active or disabled, with no way to distinguish an alert that had never been enabled from one that had been explicitly disabled.Changes
Draft alert concept
first_enabled_atfield toLogsAlertConfigurationmodel and API.nullmeans the alert has never been enabled (draft); a timestamp means it has been enabled at least once.first_enabled_at == nullandenabled == falseare shown with a "Draft" badge instead of "Disabled".nameandfiltersare now optional on create (defaulting to"Untitled alert"and{}respectively).threshold_countdefaults to100.Click-to-create flow
LogsAlertNewscene, route (/logs/alerts/new), and all associated logic/files.createAlertAndOpen, which POSTs a minimal{ enabled: false }draft and immediately navigates to the detail page for that new alert.isDraftselector) and renders an "Enable alert" primary button instead of "Save", with the toggle-enabled button hidden.Pre-enable checks refactored
withEnableNotificationGuardreplaced byrunPreEnableChecks+dispatchPreEnableCheck, which return a typed result (ok | blocked | warning) and are independently unit-testable.enableAlertaction on the detail scene handles the save-then-enable chain: if the form is dirty, it saves first and then enables onsubmitAlertFormSuccess.Other fixes
renameAlertnow also updates the form value so the name field stays in sync without a full reload.destinationsChangedaction replaces theloadExistingHogFunctionsSuccesslistener to avoid reloading the alert (and wiping unsaved form changes) on every hog-function fetch."Untitled alert"on both create and update.first_enabled_atis backfilled tocreated_atfor all existing alerts via a data migration.How did you test this code?
runPreEnableCheckscovering all result branches (ok, blocked, warning, both).logsAlertingLogic.createAlertAndOpencovering success and error paths.logsAlertDetailSceneLogiccovering themarkPendingEnable→submitAlertFormSuccess→applyEnabledChangechain.first_enabled_atstamping, re-enable idempotency, enabling with empty filters (400), and blank-name fallback.Publish to changelog?
No