User story
As a maintainer, I want to remove the Kafka trigger feature from Lightning so that we reduce codebase complexity, dependency surface area, and maintenance burden for a feature that remains in beta with limited adoption.
Details
The Kafka trigger feature was introduced in July 2024 (PR #2270) as an experimental trigger type alongside Webhook and Cron. It remains marked as BETA and is gated behind the KAFKA_TRIGGERS_ENABLED feature flag (default: false). Removing it means deleting all Kafka-specific code, database artifacts, dependencies, configuration, and UI components.
Pre-work: production audit (must be done before implementation begins)
The scope of the migration depends on whether any production data uses Kafka. Run the following queries against production to determine the blast radius:
-- Count workflows with Kafka triggers
SELECT COUNT(DISTINCT w.id)
FROM triggers t JOIN workflows w ON w.id = t.workflow_id
WHERE t.type = 'kafka';
-- List affected projects, workflows, and trigger status
SELECT p.name AS project_name, w.name AS workflow_name, t.id AS trigger_id, t.enabled
FROM triggers t
JOIN workflows w ON w.id = t.workflow_id
JOIN projects p ON p.id = w.project_id
WHERE t.type = 'kafka'
ORDER BY p.name, w.name;
-- Count Kafka dataclips
SELECT COUNT(*) FROM dataclips WHERE type = 'kafka';
-- Count Kafka dedup tracking records
SELECT COUNT(*) FROM trigger_kafka_message_records;
-- Count work orders from Kafka triggers
SELECT COUNT(*) FROM work_orders wo
JOIN triggers t ON t.id = wo.trigger_id WHERE t.type = 'kafka';
-- Snapshots containing Kafka trigger data
SELECT COUNT(*) FROM snapshots s WHERE s.triggers::text LIKE '%kafka%';
-- Users who own projects with Kafka triggers (for outreach)
SELECT DISTINCT u.email, p.name AS project_name
FROM triggers t
JOIN workflows w ON w.id = t.workflow_id
JOIN projects p ON p.id = w.project_id
JOIN project_users pu ON pu.project_id = p.id
JOIN users u ON u.id = pu.user_id
WHERE t.type = 'kafka';
Based on the results, decide:
- If no Kafka triggers/dataclips exist: Straightforward removal. Migration just drops the column and table.
- If Kafka triggers exist but are disabled/unused: Delete them in the migration. Coordinate with affected users if any.
- If active Kafka triggers exist: Coordinate with affected users before deploying. They need to migrate to Webhook or Cron triggers first.
- Kafka dataclips: If none exist, no action needed. If they exist, they can be deleted in the migration (they're input records, not run results). If the volume is large, consider a batched async cleanup.
- Historical snapshots: Snapshots embed trigger data immutably. Old snapshots with
type: "kafka" will remain in the database. The code must not crash when encountering them - ensure deserialization gracefully handles unknown trigger types rather than raising on an invalid enum value.
Breaking changes:
- Any workflows using Kafka triggers will stop functioning
- The
kafka trigger type will no longer be accepted by the provisioning API (will fail validation naturally)
- The
trigger_kafka_message_records table will be dropped
- The
kafka_configuration column on triggers will be dropped
- 8
KAFKA_* environment variables will no longer be recognized
Implementation notes
Dependencies to remove from mix.exs:
{:broadway_kafka, "~> 0.4.2"} (also removes transitive deps: brod, kafka_protocol)
Database migration required:
- Drop the
trigger_kafka_message_records table
- Remove the
kafka_configuration column from triggers
- Delete any triggers with
type = 'kafka' (scope determined by production audit above)
- Delete any dataclips with
type = 'kafka' (scope determined by production audit above)
- Remove
:kafka from the dataclip type enum in the schema (existing 'kafka' strings in the DB column won't cause issues once the Ecto enum no longer references them, but the migration should clean them up)
- Ensure snapshot deserialization handles unknown trigger types gracefully (old snapshots may contain
type: "kafka")
Backend modules to delete entirely:
lib/lightning/kafka_triggers.ex
lib/lightning/kafka_triggers/ (entire directory: supervisor, pipeline, event_listener, message_handling, message_recovery, duplicate_tracking_cleanup_worker, trigger_kafka_message_record, pipeline_supervisor)
lib/lightning/workflows/triggers/kafka_configuration.ex
lib/lightning_web/live/job_live/kafka_setup_component.ex
Backend files requiring modification:
lib/lightning/application.ex - Remove KafkaTriggers.Supervisor from supervision tree
lib/lightning/workflows/trigger.ex - Remove :kafka from type enum, remove kafka_configuration embed and validation
lib/lightning/workflows/snapshot.ex - Remove :kafka from trigger type enum, remove kafka_configuration field
lib/lightning/workflows/triggers/events.ex - Remove KafkaTriggerUpdated, KafkaTriggerNotificationSent events and related functions
lib/lightning/workflows/params_comparator.ex - Remove kafka_configuration from tracked fields
lib/lightning/workflows.ex - Remove publish_kafka_trigger_events/1, notify_of_affected_kafka_triggers/1
lib/lightning/invocation/dataclip.ex - Remove :kafka from source types and validation
lib/lightning/invocation/query.ex - Remove kafka from SQL CASE expressions
lib/lightning/runs.ex - Remove kafka from SQL CASE expressions
lib/lightning/projects/provisioner.ex - Remove KafkaConfiguration alias, kafka_config_changeset/2, embed cast
lib/lightning/projects/sandboxes.ex - Remove kafka_configuration copying
lib/lightning/projects/merge_projects.ex - Remove kafka_configuration from merge fields (2 locations)
lib/lightning/config.ex - Remove 8 kafka_* accessor functions
lib/lightning/config/bootstrap.ex - Remove Kafka env var parsing (lines ~674-715)
lib/lightning/accounts/user_notifier.ex - Remove deliver_kafka_trigger_failure_notification/3
lib/lightning/export_utils.ex - Remove Kafka trigger field serialization
lib/lightning/setup_utils.ex - Remove TriggerKafkaMessageRecord from truncation list
lib/lightning/collaboration/workflow_serializer.ex - Remove Kafka config serialization/normalization
lib/lightning_web/live/workflow_live/components.ex - Remove "Kafka Consumer" option, kafka_trigger_title/1, beta badge
lib/lightning_web/live/workflow_live/edit.ex - Remove kafka trigger title rendering
lib/lightning_web/live/components/icon.ex - Remove :kafka icon/color mappings
lib/lightning_web/channels/workflow_channel.ex - Remove kafka_triggers_enabled from config
lib/lightning_web/controllers/api/provisioning_json.ex - Remove kafka_configuration from JSON output
lib/lightning_web/controllers/api/workflows_controller.ex - Update module doc
lib/lightning_web/controllers/dataclip_controller.ex - Remove :kafka from type comment
Frontend files requiring modification:
assets/js/collaborative-editor/types/trigger.ts - Remove kafkaConfigSchema, kafkaTriggerSchema, Kafka defaults
assets/js/collaborative-editor/types/sessionContext.ts - Remove kafka_triggers_enabled from AppConfigSchema
assets/js/collaborative-editor/components/inspector/TriggerForm.tsx - Remove entire Kafka config form section
assets/js/collaborative-editor/components/inspector/TriggerInspector.tsx - Remove 'Kafka Trigger' title case
assets/js/collaborative-editor/stores/createWorkflowStore.ts - Remove nested kafka_configuration error handling
assets/js/collaborative-editor/hooks/useUnsavedChanges.ts - Remove kafka_configuration handling
assets/js/collaborative-editor/adapters/YAMLStateToYDoc.ts - Remove Kafka trigger transformation
assets/js/workflow-diagram/nodes/Trigger.tsx - Remove kafka case from getTriggerMeta()
assets/js/workflow-diagram/components/trigger-icons.tsx - Remove kafkaIcon SVG
assets/js/workflow-diagram/components/MiniMapNode.tsx - Remove 'kafka' from type union
assets/js/workflow-diagram/types.ts - Remove Lightning.KafkaTrigger interface
assets/js/workflow-diagram/util/from-workflow.tsx - Remove kafka has_auth_method handling
assets/js/yaml/types.ts - Remove StateKafkaTrigger, SpecKafkaTrigger
assets/js/yaml/util.ts - Remove Kafka-specific position exclusion and TODO
assets/js/manual-run-panel/types.ts - Remove 'kafka' from DataclipTypes and DataclipTypeNames
Test files to delete entirely:
test/lightning/kafka_triggers_test.exs
test/lightning/kafka_triggers/ (entire directory)
test/lightning/workflows/triggers/kafka_configuration_test.exs
Test files requiring modification (remove Kafka-specific tests/references):
test/lightning/workflows_test.exs
test/lightning/workflows/trigger_test.exs
test/lightning/workflows/triggers/events_test.exs
test/lightning/runs_test.exs
test/lightning/work_orders_test.exs
test/lightning/invocation_test.exs
test/lightning/invocation/dataclip_test.exs
test/lightning/invocation/query_test.exs
test/lightning/projects_test.exs
test/lightning/projects/provisioner_test.exs
test/lightning/projects/merge_projects_test.exs
test/lightning/sandboxes_test.exs
test/lightning/collaboration/session_test.exs
test/lightning/collaboration/workflow_serializer_test.exs
test/lightning/config/bootstrap_test.exs
test/lightning/accounts/user_notifier_test.exs
test/lightning/workflow_versions_test.exs
test/lightning_web/controllers/api/provisioning_controller_test.exs
test/lightning_web/live/workflow_live/trigger_test.exs
test/lightning_web/channels/workflow_channel_test.exs
test/support/factories.ex - Remove triggers_kafka_configuration_factory and trigger_kafka_message_record_factory
test/support/merge_projects_helpers.ex
Frontend test files requiring modification:
assets/test/workflow-diagram/nodes/Trigger.test.tsx
assets/test/workflow-diagram/util/from-workflow.test.tsx
assets/test/collaborative-editor/adapters/YAMLStateToYDoc.test.ts
assets/test/collaborative-editor/types/sessionContext.test.ts
assets/test/collaborative-editor/components/inspector/TriggerInspector.test.tsx
assets/test/collaborative-editor/components/inspector/EdgeInspector.test.tsx
assets/test/collaborative-editor/components/inspector/WorkflowSettings.test.tsx
assets/test/collaborative-editor/components/Header.test.tsx
assets/test/collaborative-editor/components/ManualRunPanel.keyboard.test.tsx
assets/test/collaborative-editor/hooks/useJobDeleteValidation.test.tsx
assets/test/collaborative-editor/hooks/useSessionContext.test.tsx
assets/test/collaborative-editor/__helpers__/sessionContextFactory.ts
Infrastructure to delete:
kafka_testing/ (entire directory: 4 docker-compose files + KAFKA_ARCHITECTURE.md)
Documentation to update:
DEPLOYMENT.md - Remove Kafka deployment section (lines ~238-334)
.env.example - Remove 8 KAFKA_* environment variables
Environment variables to remove:
KAFKA_TRIGGERS_ENABLED
KAFKA_NUMBER_OF_MESSAGES_PER_SECOND
KAFKA_NUMBER_OF_PROCESSORS
KAFKA_NUMBER_OF_CONSUMERS
KAFKA_DUPLICATE_TRACKING_RETENTION_SECONDS
KAFKA_NOTIFICATION_EMBARGO_SECONDS
KAFKA_ALTERNATE_STORAGE_ENABLED
KAFKA_ALTERNATE_STORAGE_FILE_PATH
Release notes
Kafka triggers have been removed from Lightning. Any workflows using Kafka triggers will need to be reconfigured to use an alternative trigger type (Webhook or Cron). The KAFKA_TRIGGERS_ENABLED environment variable and all other KAFKA_* configuration variables are no longer recognized. The kafka trigger type is no longer accepted by the provisioning API.
User acceptance criteria
User story
As a maintainer, I want to remove the Kafka trigger feature from Lightning so that we reduce codebase complexity, dependency surface area, and maintenance burden for a feature that remains in beta with limited adoption.
Details
The Kafka trigger feature was introduced in July 2024 (PR #2270) as an experimental trigger type alongside Webhook and Cron. It remains marked as BETA and is gated behind the
KAFKA_TRIGGERS_ENABLEDfeature flag (default:false). Removing it means deleting all Kafka-specific code, database artifacts, dependencies, configuration, and UI components.Pre-work: production audit (must be done before implementation begins)
The scope of the migration depends on whether any production data uses Kafka. Run the following queries against production to determine the blast radius:
Based on the results, decide:
type: "kafka"will remain in the database. The code must not crash when encountering them - ensure deserialization gracefully handles unknown trigger types rather than raising on an invalid enum value.Breaking changes:
kafkatrigger type will no longer be accepted by the provisioning API (will fail validation naturally)trigger_kafka_message_recordstable will be droppedkafka_configurationcolumn ontriggerswill be droppedKAFKA_*environment variables will no longer be recognizedImplementation notes
Dependencies to remove from
mix.exs:{:broadway_kafka, "~> 0.4.2"}(also removes transitive deps:brod,kafka_protocol)Database migration required:
trigger_kafka_message_recordstablekafka_configurationcolumn fromtriggerstype = 'kafka'(scope determined by production audit above)type = 'kafka'(scope determined by production audit above):kafkafrom the dataclip type enum in the schema (existing'kafka'strings in the DB column won't cause issues once the Ecto enum no longer references them, but the migration should clean them up)type: "kafka")Backend modules to delete entirely:
lib/lightning/kafka_triggers.exlib/lightning/kafka_triggers/(entire directory: supervisor, pipeline, event_listener, message_handling, message_recovery, duplicate_tracking_cleanup_worker, trigger_kafka_message_record, pipeline_supervisor)lib/lightning/workflows/triggers/kafka_configuration.exlib/lightning_web/live/job_live/kafka_setup_component.exBackend files requiring modification:
lib/lightning/application.ex- RemoveKafkaTriggers.Supervisorfrom supervision treelib/lightning/workflows/trigger.ex- Remove:kafkafrom type enum, removekafka_configurationembed and validationlib/lightning/workflows/snapshot.ex- Remove:kafkafrom trigger type enum, removekafka_configurationfieldlib/lightning/workflows/triggers/events.ex- RemoveKafkaTriggerUpdated,KafkaTriggerNotificationSentevents and related functionslib/lightning/workflows/params_comparator.ex- Removekafka_configurationfrom tracked fieldslib/lightning/workflows.ex- Removepublish_kafka_trigger_events/1,notify_of_affected_kafka_triggers/1lib/lightning/invocation/dataclip.ex- Remove:kafkafrom source types and validationlib/lightning/invocation/query.ex- Removekafkafrom SQL CASE expressionslib/lightning/runs.ex- Removekafkafrom SQL CASE expressionslib/lightning/projects/provisioner.ex- RemoveKafkaConfigurationalias,kafka_config_changeset/2, embed castlib/lightning/projects/sandboxes.ex- Removekafka_configurationcopyinglib/lightning/projects/merge_projects.ex- Removekafka_configurationfrom merge fields (2 locations)lib/lightning/config.ex- Remove 8kafka_*accessor functionslib/lightning/config/bootstrap.ex- Remove Kafka env var parsing (lines ~674-715)lib/lightning/accounts/user_notifier.ex- Removedeliver_kafka_trigger_failure_notification/3lib/lightning/export_utils.ex- Remove Kafka trigger field serializationlib/lightning/setup_utils.ex- RemoveTriggerKafkaMessageRecordfrom truncation listlib/lightning/collaboration/workflow_serializer.ex- Remove Kafka config serialization/normalizationlib/lightning_web/live/workflow_live/components.ex- Remove "Kafka Consumer" option,kafka_trigger_title/1, beta badgelib/lightning_web/live/workflow_live/edit.ex- Remove kafka trigger title renderinglib/lightning_web/live/components/icon.ex- Remove:kafkaicon/color mappingslib/lightning_web/channels/workflow_channel.ex- Removekafka_triggers_enabledfrom configlib/lightning_web/controllers/api/provisioning_json.ex- Removekafka_configurationfrom JSON outputlib/lightning_web/controllers/api/workflows_controller.ex- Update module doclib/lightning_web/controllers/dataclip_controller.ex- Remove:kafkafrom type commentFrontend files requiring modification:
assets/js/collaborative-editor/types/trigger.ts- RemovekafkaConfigSchema,kafkaTriggerSchema, Kafka defaultsassets/js/collaborative-editor/types/sessionContext.ts- Removekafka_triggers_enabledfromAppConfigSchemaassets/js/collaborative-editor/components/inspector/TriggerForm.tsx- Remove entire Kafka config form sectionassets/js/collaborative-editor/components/inspector/TriggerInspector.tsx- Remove 'Kafka Trigger' title caseassets/js/collaborative-editor/stores/createWorkflowStore.ts- Remove nested kafka_configuration error handlingassets/js/collaborative-editor/hooks/useUnsavedChanges.ts- Removekafka_configurationhandlingassets/js/collaborative-editor/adapters/YAMLStateToYDoc.ts- Remove Kafka trigger transformationassets/js/workflow-diagram/nodes/Trigger.tsx- Remove kafka case fromgetTriggerMeta()assets/js/workflow-diagram/components/trigger-icons.tsx- RemovekafkaIconSVGassets/js/workflow-diagram/components/MiniMapNode.tsx- Remove 'kafka' from type unionassets/js/workflow-diagram/types.ts- RemoveLightning.KafkaTriggerinterfaceassets/js/workflow-diagram/util/from-workflow.tsx- Remove kafkahas_auth_methodhandlingassets/js/yaml/types.ts- RemoveStateKafkaTrigger,SpecKafkaTriggerassets/js/yaml/util.ts- Remove Kafka-specific position exclusion and TODOassets/js/manual-run-panel/types.ts- Remove 'kafka' fromDataclipTypesandDataclipTypeNamesTest files to delete entirely:
test/lightning/kafka_triggers_test.exstest/lightning/kafka_triggers/(entire directory)test/lightning/workflows/triggers/kafka_configuration_test.exsTest files requiring modification (remove Kafka-specific tests/references):
test/lightning/workflows_test.exstest/lightning/workflows/trigger_test.exstest/lightning/workflows/triggers/events_test.exstest/lightning/runs_test.exstest/lightning/work_orders_test.exstest/lightning/invocation_test.exstest/lightning/invocation/dataclip_test.exstest/lightning/invocation/query_test.exstest/lightning/projects_test.exstest/lightning/projects/provisioner_test.exstest/lightning/projects/merge_projects_test.exstest/lightning/sandboxes_test.exstest/lightning/collaboration/session_test.exstest/lightning/collaboration/workflow_serializer_test.exstest/lightning/config/bootstrap_test.exstest/lightning/accounts/user_notifier_test.exstest/lightning/workflow_versions_test.exstest/lightning_web/controllers/api/provisioning_controller_test.exstest/lightning_web/live/workflow_live/trigger_test.exstest/lightning_web/channels/workflow_channel_test.exstest/support/factories.ex- Removetriggers_kafka_configuration_factoryandtrigger_kafka_message_record_factorytest/support/merge_projects_helpers.exFrontend test files requiring modification:
assets/test/workflow-diagram/nodes/Trigger.test.tsxassets/test/workflow-diagram/util/from-workflow.test.tsxassets/test/collaborative-editor/adapters/YAMLStateToYDoc.test.tsassets/test/collaborative-editor/types/sessionContext.test.tsassets/test/collaborative-editor/components/inspector/TriggerInspector.test.tsxassets/test/collaborative-editor/components/inspector/EdgeInspector.test.tsxassets/test/collaborative-editor/components/inspector/WorkflowSettings.test.tsxassets/test/collaborative-editor/components/Header.test.tsxassets/test/collaborative-editor/components/ManualRunPanel.keyboard.test.tsxassets/test/collaborative-editor/hooks/useJobDeleteValidation.test.tsxassets/test/collaborative-editor/hooks/useSessionContext.test.tsxassets/test/collaborative-editor/__helpers__/sessionContextFactory.tsInfrastructure to delete:
kafka_testing/(entire directory: 4 docker-compose files + KAFKA_ARCHITECTURE.md)Documentation to update:
DEPLOYMENT.md- Remove Kafka deployment section (lines ~238-334).env.example- Remove 8KAFKA_*environment variablesEnvironment variables to remove:
KAFKA_TRIGGERS_ENABLEDKAFKA_NUMBER_OF_MESSAGES_PER_SECONDKAFKA_NUMBER_OF_PROCESSORSKAFKA_NUMBER_OF_CONSUMERSKAFKA_DUPLICATE_TRACKING_RETENTION_SECONDSKAFKA_NOTIFICATION_EMBARGO_SECONDSKAFKA_ALTERNATE_STORAGE_ENABLEDKAFKA_ALTERNATE_STORAGE_FILE_PATHRelease notes
Kafka triggers have been removed from Lightning. Any workflows using Kafka triggers will need to be reconfigured to use an alternative trigger type (Webhook or Cron). The
KAFKA_TRIGGERS_ENABLEDenvironment variable and all otherKAFKA_*configuration variables are no longer recognized. Thekafkatrigger type is no longer accepted by the provisioning API.User acceptance criteria
broadway_kafkadependency (and its transitive deps) is removed frommix.exsandmix.locktrigger_kafka_message_recordsand thekafka_configurationcolumn fromtriggers:kafkatrigger type and:kafkadataclip type are removed from all enumskafkaas a trigger type (fails validation naturally)mix verifypasses cleanlycd assets && npm testpasses cleanlykafka_testing/directory is removedDEPLOYMENT.mdand.env.exampleno longer reference Kafkakafka_configuration