Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
444c177
feat(workflows): store the sandbox sender kind and state
Silthus Nov 9, 2026
57a259c
test(mcp): update unit test snapshots
tests-posthog[bot] Nov 9, 2026
f4f332e
feat(workflows): validate and provision sandbox email steps
Silthus Nov 9, 2026
4a3ebff
fix(workflows): tighten sandbox sender checks from the design review
Silthus Nov 9, 2026
67d14af
test(mcp): update unit test snapshots
tests-posthog[bot] Nov 9, 2026
02b8a61
chore: update OpenAPI generated types
tests-posthog[bot] Nov 9, 2026
91d346f
fix(workflows): refuse a wrong-kind email sender on draft saves too
Silthus Nov 9, 2026
ddc6c6e
fix(workflows): refuse null sandbox email text and check test-run own…
Silthus Nov 9, 2026
340410a
fix(workflows): judge a test run's sandbox step by the saved owner
Silthus Nov 9, 2026
1fca5a2
fix(cdp): skip the draft sender check when inputs are not an object
Silthus Nov 9, 2026
4d585be
fix(workflows): pass the import and scope checks for sandbox sender code
Silthus Nov 9, 2026
3d1e93b
fix(workflows): pass master's new admin and tuple semgrep rules
Silthus Nov 9, 2026
7d3cf5d
feat(workflows): choose the sandbox sender in email steps
Silthus Nov 9, 2026
9090754
Merge workflows-sandbox/p2-validate-provision into workflows-sandbox/…
Silthus Nov 9, 2026
5b6e6eb
fix(workflows): offer the sandbox sender only where it can send
Silthus Nov 9, 2026
3091404
chore(workflows): test sandbox sender environment and test recipient
Silthus Nov 9, 2026
f0a1822
chore(workflows): mark the test invocation call as having no generate…
Silthus Nov 9, 2026
1abdcaf
refactor(workflows): move sandbox test branches out of the test submit
Silthus Nov 9, 2026
df906a9
fix(workflows): record a sandbox test send for the step that was tested
Silthus Nov 9, 2026
a664b84
fix(workflows): open sandbox email drafts that have no recipient yet
Silthus Nov 9, 2026
1022eac
refactor(workflows): read a sandbox step's recipient in one place
Silthus Nov 9, 2026
53a6f80
chore(workflows): regenerate schema and logic types for the sandbox e…
Silthus Nov 9, 2026
65a2525
chore(workflows): regenerate the python integration kind enum for the…
Silthus Nov 9, 2026
ef04bb6
chore: update OpenAPI generated types
tests-posthog[bot] Nov 9, 2026
7b84d48
fix(workflows): warn that the sandbox sender drops tracking and utm s…
Silthus Nov 9, 2026
ca86c3a
fix(workflows): offer the sandbox sender in the email from picker
Silthus Nov 10, 2026
1aeaa58
refactor(workflows): build the sandbox sender picker options in helpers
Silthus Nov 10, 2026
92c6861
fix(workflows): keep an unexported canvas edit when the sender kind s…
Silthus Nov 10, 2026
709ce5d
fix(workflows): send a sandbox test only to the confirmed verified me…
Silthus Nov 10, 2026
c26443d
fix(workflows): keep own-only email settings out of automatic sandbox…
Silthus Nov 10, 2026
117923e
fix(workflows): offer setup on a sandbox step whose sender is not set up
Silthus Nov 10, 2026
096777c
fix(workflows): explain a sandbox test with no verified member to sen…
Silthus Nov 10, 2026
e2b6ae8
chore(workflows): check the email editor stays open across a sender s…
Silthus Nov 10, 2026
8cf800d
fix(workflows): use the sandbox sender when the team turns UTM tags o…
Silthus Nov 10, 2026
ee73a62
fix(workflows): explain why a sandbox step can't send yet
Silthus Nov 10, 2026
c26fb5d
fix(workflows): keep a template email's own UTM tags off the sandbox …
Silthus Nov 10, 2026
bc82a2a
chore(workflows): match kea typegen for the members selector input
Silthus Nov 10, 2026
1558d21
chore(warehouse-sources): stub close_old_connections in two db-free t…
Silthus Nov 10, 2026
71e66c5
Merge branch 'workflows-sandbox/p2-validate-provision' into workflows…
Silthus Nov 10, 2026
99e9966
chore(workflows): split the sandbox recipient reasons out of the sele…
Silthus Nov 10, 2026
746bcd5
Merge remote-tracking branch 'origin/workflows-sandbox/u1-editor-send…
Silthus Nov 10, 2026
e0fca31
Merge remote-tracking branch 'origin/master' into workflows-sandbox/p…
Silthus Nov 10, 2026
c73da24
fix(workflows): show a test result only on the step that was tested
Silthus Nov 10, 2026
fb31506
Merge remote-tracking branch 'origin/workflows-sandbox/p1-sender-kind…
Silthus Nov 10, 2026
34e85ca
fix(workflows): tell a sandbox step when its organization is blocked …
Silthus Nov 10, 2026
0545a1d
Merge remote-tracking branch 'origin/workflows-sandbox/p2-validate-pr…
Silthus Nov 10, 2026
e488e03
fix(workflows): record the signed-in staff member on a sandbox block
Silthus Nov 10, 2026
1517484
Merge remote-tracking branch 'origin/workflows-sandbox/p2-validate-pr…
Silthus Nov 10, 2026
bc2cd19
chore(workflows): post the sandbox block attribution test through the…
Silthus Nov 10, 2026
7d36af8
Merge remote-tracking branch 'origin/workflows-sandbox/p2-validate-pr…
Silthus Nov 10, 2026
4af3e63
chore(workflows): assert where the sandbox sender is set up, not whic…
Silthus Nov 10, 2026
cb7ba76
Merge remote-tracking branch 'origin/master' into workflows-sandbox/p…
Silthus Nov 10, 2026
61c5ec0
Merge remote-tracking branch 'origin/workflows-sandbox/p1-sender-kind…
Silthus Nov 10, 2026
d0b94f4
chore(workflows): drop the comments the sandbox sender models add
Silthus Nov 10, 2026
8132512
Merge remote-tracking branch 'origin/workflows-sandbox/p1-sender-kind…
Silthus Nov 10, 2026
dd2d9b5
chore(workflows): drop the comments the sandbox sender layer adds
Silthus Nov 10, 2026
980e3a4
fix(workflows): keep sandbox steps and test results consistent
Silthus Nov 10, 2026
fc11868
Merge remote-tracking branch 'origin/workflows-sandbox/p2-validate-pr…
Silthus Nov 10, 2026
8cb5732
chore(workflows): type the test result selector for kea typegen
Silthus Nov 10, 2026
395c5f8
Merge master into workflows-sandbox/p1-sender-kind-state
Silthus Nov 11, 2026
90cddf7
Merge workflows-sandbox/p1-sender-kind-state into workflows-sandbox/p…
Silthus Nov 11, 2026
cee27c3
chore(workflows): merge p2-validate-provision into u1-editor-sender-c…
Silthus Nov 11, 2026
8f0ad2b
fix(workflows): keep the email body when the sender switches mid-edit
Silthus Nov 11, 2026
0e84119
feat(workflows): hold sandbox email steps until the worker runs them
Silthus Nov 11, 2026
e34ce64
chore(workflows): assert the parent's stored email in live-change tests
Silthus Nov 11, 2026
1c7edf5
chore(workflows): test sandbox steps and the tenant poll from the out…
Silthus Nov 11, 2026
4b88d0d
chore(workflows): drop explanatory comments from the sender choice ch…
Silthus Nov 11, 2026
9cab2cd
Merge master into workflows-sandbox/p2-validate-provision
Silthus Nov 11, 2026
953fe2b
chore(workflows): assert forged bytecode never reaches the sandbox email
Silthus Nov 11, 2026
51cd006
Revert "chore(warehouse-sources): stub close_old_connections in two d…
Silthus Nov 11, 2026
bd7bad9
fix(workflows): keep the first creator when sandbox provisioning races
Silthus Nov 11, 2026
b9fe013
Merge master into workflows-sandbox/p2-validate-provision
Silthus Nov 11, 2026
85bd58e
fix(workflows): explain rate-limited and unreachable sandbox test sends
Silthus Nov 11, 2026
b7cf434
chore(workflows): move sandbox sender checks out of long editor funct…
Silthus Nov 11, 2026
2ae8de4
chore(workflows): merge p2-validate-provision's final head into u1-ed…
Silthus Nov 11, 2026
c98f3a0
chore(workflows): merge master into u1-editor-sender-choice
Silthus Nov 11, 2026
e0fff75
fix(workflows): look past the first page of senders and accept null c…
Silthus Nov 11, 2026
ecb710a
chore(workflows): regenerate step logic types for nullable sandbox ca…
Silthus Nov 11, 2026
5c1b705
fix(workflows): align the sandbox sender row with existing container …
Silthus Nov 11, 2026
269625d
feat(workflows): explain suspended and paused sending in the sandbox …
Silthus Nov 11, 2026
7c8815b
chore(workflows): merge master into u1-editor-sender-choice
Silthus Nov 12, 2026
0fbdc60
chore(workflows): merge master into u1-editor-sender-choice
Silthus Nov 12, 2026
a83b55e
fix(workflows): keep a canvas edit made while a sender switch exports
Silthus Nov 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions frontend/src/lib/integrations/integrationsLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
| 'customerio-webhook'
| 'databricks'
| 'email'
| 'email_sandbox'
| 'firebase'
| 'github'
| 'gitlab'
Expand Down Expand Up @@ -268,6 +269,7 @@
| 'customerio-webhook'
| 'databricks'
| 'email'
| 'email_sandbox'
| 'firebase'
| 'github'
| 'gitlab'
Expand Down Expand Up @@ -405,6 +407,7 @@
| 'customerio-webhook'
| 'databricks'
| 'email'
| 'email_sandbox'
| 'firebase'
| 'github'
| 'gitlab'
Expand Down Expand Up @@ -471,6 +474,7 @@
| 'customerio-webhook'
| 'databricks'
| 'email'
| 'email_sandbox'
| 'firebase'
| 'github'
| 'gitlab'
Expand Down Expand Up @@ -531,6 +535,7 @@
| 'customerio-webhook'
| 'databricks'
| 'email'
| 'email_sandbox'
| 'firebase'
| 'github'
| 'gitlab'
Expand Down Expand Up @@ -597,6 +602,7 @@
| 'customerio-webhook'
| 'databricks'
| 'email'
| 'email_sandbox'
| 'firebase'
| 'github'
| 'gitlab'
Expand Down Expand Up @@ -648,6 +654,7 @@
| 'customerio-webhook'
| 'databricks'
| 'email'
| 'email_sandbox'
| 'firebase'
| 'github'
| 'gitlab'
Expand Down Expand Up @@ -746,6 +753,7 @@
| 'customerio-webhook'
| 'databricks'
| 'email'
| 'email_sandbox'
| 'firebase'
| 'github'
| 'gitlab'
Expand Down Expand Up @@ -1259,7 +1267,7 @@
cache.disposables.dispose('poll')
cache.disposables.dispose('focusRefetch')
},
handleOauthCallback: async ({ kind, searchParams }) => {

Check warning on line 1270 in frontend/src/lib/integrations/integrationsLogic.ts

View workflow job for this annotation

GitHub Actions / Frontend formatting

lint:complexity

`handleOauthCallback` has cyclomatic complexity 27 (warn >10)
if (kind === 'twitter-ads') {
// The server binds the temporary token to the initiating user and project instead of a state cookie.
let replaceUrl = urls.settings('project-integrations')
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/lib/integrations/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
helpscout: IconHelpScout,
'linkedin-ads': IconLinkedIn,
email: IconMailjet,
email_sandbox: IconMailjet,
linear: IconLinear,
github: IconGitHub,
gitlab: IconGitLab,
Expand Down Expand Up @@ -142,7 +143,7 @@
// surface, so invert them in dark mode (`dark:invert`) wherever the integration icon is rendered.
export const DARK_MODE_INVERT_ICON_KINDS = new Set<IntegrationKind>(['apns', 'apple-ads', 'github'])

export const getIntegrationNameFromKind = (kind: string): string => {

Check warning on line 146 in frontend/src/lib/integrations/utils.ts

View workflow job for this annotation

GitHub Actions / Frontend formatting

lint:complexity

`getIntegrationNameFromKind` has cyclomatic complexity 28 (warn >10)
switch (kind) {
case 'google-pubsub':
return 'Google Cloud Pub/Sub'
Expand Down Expand Up @@ -178,6 +179,8 @@
return 'Pinterest Ads'
case 'email':
return 'email'
case 'email_sandbox':
return 'sandbox email'
case 'github':
return 'GitHub'
case 'helpscout':
Expand Down
1 change: 1 addition & 0 deletions frontend/src/queries/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import clsx from 'clsx'
import { BindLogic, useActions, useValues } from 'kea'
import { BindLogic, useActions, useAsyncActions, useValues } from 'kea'
import { ChildFunctionProps, Form } from 'kea-forms'
import { ReactNode, useEffect, useState } from 'react'
import { ReactNode, useContext, useEffect, useState } from 'react'
import { createPortal } from 'react-dom'
import EmailEditor, { EditorRef } from 'react-email-editor'

Expand Down Expand Up @@ -48,6 +48,14 @@
import { withInertLinks } from './emailPreviewHtml'
import { EmailSenderSummary } from './EmailSenderSummary'
import { EMAIL_TYPE_SUPPORTED_FIELDS, EmailTemplaterLogicProps, emailTemplaterLogic } from './emailTemplaterLogic'
import { SandboxSenderChoiceContext } from './SandboxSenderChoiceContext'
import {
SANDBOX_SENDER_VALUE,
sandboxSenderGroups,
sandboxSenderHint,
sandboxSenderInputOptions,
selectedSenderValue,
} from './sandboxSenderOptions'
import { EmailFieldErrors, EmailTemplateFrom, MAX_WORKFLOW_EMAIL_SENDERS } from './types'

export type EmailEditorMode = 'full' | 'preview'
Expand Down Expand Up @@ -246,7 +254,7 @@
)
}

export function NativeEmailIntegrationChoice({

Check warning on line 257 in frontend/src/scenes/hog-functions/email-templater/EmailTemplater.tsx

View workflow job for this annotation

GitHub Actions / Frontend formatting

lint:complexity

`NativeEmailIntegrationChoice` has cyclomatic complexity 17 (warn >10)
label,
onChange,
value,
Expand All @@ -259,6 +267,9 @@
const { integrationsLoading, integrations } = useValues(integrationsLogic)
const { logicProps } = useValues(emailTemplaterLogic)
const senderRotationEnabled = useFeatureFlag('WORKFLOWS_EMAIL_SENDER_ROTATION')
const sandbox = useContext(SandboxSenderChoiceContext)
const sandboxHint = sandboxSenderHint(sandbox)
const { flushPendingDesignEdit } = useAsyncActions(emailTemplaterLogic)
const integrationsOfKind = integrations?.filter((x) => x.kind === 'email')
const selectedIntegrationIds = value?.integrationIds?.length
? value.integrationIds
Expand All @@ -270,15 +281,32 @@
// visible again on reopen without any separate reveal state.
const overridesVisible = value?.email !== undefined || value?.name !== undefined

const switchSenderKind = (switchSender: () => void): void => {
void flushPendingDesignEdit().then(switchSender)
}

const onChangeIntegration = (integrationId: number): void => {
if (integrationId === -1) {
window.open(urls.workflows('channels'), '_blank')
return
}
onChange({ ...value, integrationId, integrationIds: undefined })
if (integrationId === SANDBOX_SENDER_VALUE) {
switchSenderKind(() => sandbox?.onSelect())
return
}
const next = { ...value, integrationId, integrationIds: undefined }
if (sandbox?.selected) {
switchSenderKind(() => onChange(next))
return
}
onChange(next)
}

const onChangeIntegrations = (integrationIds: number[]): void => {
if (integrationIds.includes(SANDBOX_SENDER_VALUE)) {
switchSenderKind(() => sandbox?.onSelect())
return
}
if (integrationIds.length > MAX_WORKFLOW_EMAIL_SENDERS) {
return
}
Expand All @@ -289,7 +317,7 @@
})
}

if (!integrationsLoading && integrationsOfKind?.length === 0) {
if (!sandbox && !integrationsLoading && integrationsOfKind?.length === 0) {
return (
<div className="flex gap-2 justify-between items-center">
{label}
Expand All @@ -314,18 +342,21 @@
<div className="flex flex-col">
<div className="flex gap-2 items-center">
{label}
{senderRotationEnabled ? (
{senderRotationEnabled && !sandbox?.selected ? (
<div className="flex flex-col flex-1">
<LemonInputSelect<number>
className="m-1 flex-1"
mode="multiple"
placeholder="Choose email senders"
loading={integrationsLoading}
options={(integrationsOfKind || []).map((integration) => ({
key: String(integration.id),
label: integration.display_name,
value: integration.id,
}))}
options={[
...(integrationsOfKind || []).map((integration) => ({
key: String(integration.id),
label: integration.display_name,
value: integration.id,
})),
...sandboxSenderInputOptions(sandbox),
]}
value={selectedIntegrationIds}
size="small"
fullWidth
Expand Down Expand Up @@ -357,6 +388,7 @@
value: integration.id,
})),
},
...sandboxSenderGroups(sandbox),
{
options: [
{
Expand All @@ -367,14 +399,14 @@
],
},
]}
value={value?.integrationId}
value={selectedSenderValue(sandbox, value?.integrationId)}
size="small"
fullWidth
onChange={onChangeIntegration}
data-attr="workflow-email-sender-select"
/>
)}
{!overridesVisible && (
{!overridesVisible && !sandbox?.selected && (
<LemonButton
size="xsmall"
type="secondary"
Expand All @@ -388,6 +420,7 @@
</LemonButton>
)}
</div>
{sandboxHint && <span className="px-2 pb-1 text-xs text-muted">{sandboxHint}</span>}
{overridesVisible && (
<>
<div className="flex gap-2 items-center border-t">
Expand Down Expand Up @@ -552,7 +585,7 @@
)
}

function NativeEmailTemplaterForm({

Check warning on line 588 in frontend/src/scenes/hog-functions/email-templater/EmailTemplater.tsx

View workflow job for this annotation

GitHub Actions / Frontend formatting

lint:complexity

`NativeEmailTemplaterForm` has cyclomatic complexity 15 (warn >10)
mode,
fieldsHidden,
}: {
Expand Down Expand Up @@ -918,6 +951,7 @@
case 'native_email_template':
case 'native_email_transactional_template':
case 'native_email':
case 'native_email_sandbox':
return <NativeEmailTemplaterForm mode={mode} fieldsHidden={fieldsHidden} />
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { createContext } from 'react'

export interface SandboxSenderChoice {
selected: boolean
fromLine: string | null
onSelect: () => void
}

export const SandboxSenderChoiceContext = createContext<SandboxSenderChoice | null>(null)
Loading
Loading