feat(ui): extend TriggerConfig types to match all backend trigger variants#1108
feat(ui): extend TriggerConfig types to match all backend trigger variants#1108geoffjay wants to merge 2 commits intoissue-1095from
Conversation
|
This change is part of the following stack:
Change managed by git-spice. |
geoffjay
left a comment
There was a problem hiding this comment.
Review: feat(ui): extend TriggerConfig types to match all backend trigger variants
Stack position: issue-1096 (#1108) stacked on issue-1095 (#1107). Parent #1107 is being reviewed simultaneously and has no blocking issues.
Overview
This PR does two things: renames source_config → trigger_config across all consumers, and expands the TriggerConfig type from 2 variants (github_issues, github_pull_requests) to 13 comprehensive variants matching the backend's TriggerConfig enum. Adds getTriggerLabel, getTriggerCategory, and getDefaultTriggerConfig helpers. Keeps TaskSourceConfig as a deprecated alias for backward compatibility.
What looks good
- Exhaustive helpers:
getTriggerLabelandgetTriggerCategoryuseRecord<TriggerType, ...>maps — if a new variant is added to the union and the record is not updated, TypeScript will error at compile time.getDefaultTriggerConfiguses a switch with nodefaultcase for the same reason. All three patterns enforce exhaustiveness correctly. - Deprecated alias:
export type TaskSourceConfig = TriggerConfigpreserves backward compat without keeping dead code around. WorkflowDetail.sourceDetailexpansion: The new switch properly handles all 13 variants. Thedefaultcase falls back togetTriggerLabelwhich ensures future variants show something sensible rather than crashing.- Test updates: All 3 changed test files correctly update fixture data from
source_configtotrigger_config. Test descriptions are updated to match.
Non-blocking note
The section comment in orchestrator.ts says "covers all 14 backend trigger variants", but counting the union members: github_issues, github_pull_requests, cron, delay, webhook, manual, linear_issues, agent_lifecycle, agent_idle, dispatch_result, composite, queue, ask_response = 13 variants. The getTriggerLabel map also has 13 entries. The getDefaultTriggerConfig switch has 13 cases. Worth correcting the comment before merge to avoid confusion in later PRs.
Verdict
Solid type expansion. The rename is handled consistently across all consumers, helpers are exhaustively typed, and backward compat is maintained. LGTM pending the comment correction.
- Replace TaskSourceConfig with full TriggerConfig discriminated union - Add all 14 trigger types: github_issues, github_pull_requests, cron, delay, webhook, manual, linear_issues, agent_lifecycle, agent_idle, dispatch_result, composite, queue, ask_response - Rename Workflow.source_config -> trigger_config (matches backend JSON) - Rename CreateWorkflowRequest.source_config -> trigger_config - Add getTriggerLabel, getTriggerCategory, getDefaultTriggerConfig helpers - Keep TaskSourceConfig as deprecated alias for backward compat - Update WorkflowForm, WorkflowTable, WorkflowDetail consumers - Update all test fixtures to use trigger_config
Replace TaskSourceConfig with full TriggerConfig covering all 14 backend trigger variants, rename Workflow.source_config to trigger_config, add helpers (getTriggerLabel, getTriggerCategory, getDefaultTriggerConfig), and update all consumers and test fixtures.
Closes #1096