fix(alert-channels): accept --config for all 20 channel types#47
Merged
Conversation
The ALERT_CHANNEL_CONFIG_SCHEMAS map (and the YAML CHANNEL_CONFIG_SCHEMAS map) covered only 7 of the 20 channel types, so --config for the other 13 (telegram, google_chat, pushover, mattermost, splunk_oncall, pushbullet, linear, incident_io, rootly, zapier, datadog, jira, gitlab) was rejected with "Unknown channelType" on the CLI path and silently skipped deep validation on the YAML path. Both maps are now derived from the generated OpenAPI Zod schemas (the source of truth), keyed by each variant's channelType literal, so they can never drift from the API again. Adds drift-guard tests asserting the maps cover every entry in CHANNEL_TYPES. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
--configflag onalert-channels create/updaterejected 13 of 20 channel types with "Unknown channelType" becauseALERT_CHANNEL_CONFIG_SCHEMASwas a stale 7-entry hand-maintained map. The CLI's own generated Zod schemas already defined all 20.Fix: Both stale maps (CLI
--configpath + YAMLapplypath) are now derived from the generated OpenAPI Zod schemas, keyed by each variant'schannelTypeliteral. They can never drift again — new channel types appear automatically afterpnpm sync-schema.Also closed a worse bug in the YAML path: unmapped types previously skipped all field-level validation via an escape hatch.
Test plan
npm run typecheckpassesnpm run lintpassesnpm test— 1053 tests passedCHANNEL_TYPESentryMade with Cursor