Skip to content

Add alert type GraphQL query#2811

Merged
GregorShear merged 2 commits intomasterfrom
greg/alert-type-query
Apr 2, 2026
Merged

Add alert type GraphQL query#2811
GregorShear merged 2 commits intomasterfrom
greg/alert-type-query

Conversation

@GregorShear
Copy link
Copy Markdown
Contributor

@GregorShear GregorShear commented Mar 26, 2026

Summary

  • Add a new alertTypes GraphQL query that returns all possible alert types with user-facing metadata (title, description)
  • Update subscription mutations to add system alerts to all subscriptions (i.e. system alerts are non-optional)
query {
  alertTypes {
    alertType,
    description,
    displayName,
    isDefault,
    isSystem
  }
}

NOTE: Pagination will not be implemented for this endpoint because of the simplicity of the data returned.

Issues

The issues directly below are completely resolved by this PR:
#2794

@GregorShear GregorShear force-pushed the greg/alert-type-query branch from 2db4cc2 to cf01c9f Compare March 26, 2026 15:02
@kiahna-tucker kiahna-tucker changed the title Add alert type query with name and description Add alert type GraphQL query Mar 30, 2026
@GregorShear GregorShear force-pushed the greg/alert-type-query branch 4 times, most recently from ab1265c to f4a0094 Compare April 1, 2026 17:28
@GregorShear GregorShear marked this pull request as ready for review April 1, 2026 17:31
@GregorShear GregorShear force-pushed the greg/alert-type-query branch from f4a0094 to 5cf384d Compare April 1, 2026 19:07
@GregorShear GregorShear force-pushed the greg/alert-type-query branch from 5cf384d to 4ead7e9 Compare April 1, 2026 19:53
@GregorShear GregorShear requested a review from jshearer April 1, 2026 19:55
Copy link
Copy Markdown
Contributor

@jshearer jshearer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • What are we doing about ShardFailed? Currently, we have been treating it as a beta feature that customers can opt into by asking us. This PR marks it as both default and system, meaning that not only is it on by default, you actually can't turn it off. That seems surprising. Did you talk about this w/ Dave?
  • There are now two different sources of truth for the default alerts: this AlertType::is_default() and the database column defaults. And in fact since ShardFailed is marked as default in the PR, those are divergent now. Today, the DB column default is what gets used when provisioning new tenants. I note that despite introducing a concept called is_default, this PR doesn't actually change the behavior of the system to use it anywhere.
  • How are we thinking about the migration here now that we're introducing is_system/is_default? Once we merge this, there will be a lot of existing tenants with, for example, missing alert subscriptions that are marked as is_system. Will they be able to... add them in the UI, but just not remove them? Or what happens if someone modifies this in the DB, which does happen.
  • There's an implicit relationship between system and default alerts: every system alert is also necessarily a default alert, but not every default alert is necessarily a system alert. It might be worth modeling this, or at least commenting on it? WDYT?
  • I don't love how the description string can be/is different from the doc-comment for these alerts. I wonder if there's any way you/Claude can find to "reflect" the doc comment here? If not no big deal, but IMO it would be worth at least trying.

Put another way, I don't think this is coherent with the existing architecture, and I'm asking you to re-think how it should work so we don't introduce competing concepts and tech debt.

@GregorShear
Copy link
Copy Markdown
Contributor Author

GregorShear commented Apr 2, 2026

  • easy to remove shardFailed from the list of defaults
  • let's remove that default list from the table column and count on the default behavior living in the gql resolver
  • also easy to run a migration and add system alerts to all subscriptions (if Dave wants this)
  • i had the same thought about the system -> default relationship. the model isn't perfect, but let's save that refactor for another day.
  • fair point about doc comments- i'll just remove those. the user-facing description can be the single source of truth.
    @jshearer

@GregorShear GregorShear force-pushed the greg/alert-type-query branch from 3edd117 to 3c0bacd Compare April 2, 2026 16:44
Remove alert type doc strings in favor of user-facing descriptions
Reset shardFailed to default=false
@GregorShear GregorShear force-pushed the greg/alert-type-query branch from 3c0bacd to b1367ef Compare April 2, 2026 16:53
Copy link
Copy Markdown
Contributor

@jshearer jshearer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, this is looking better. The last thing I was concerned about is that removing the default on public.alert_subscriptions will actually break certain POST /rest/v1/alert_subscriptions calls that rely on the default value for include_alert_types. But you say you checked and the UI is purely using gql to create alert subscriptions, so with that I think this is good to go 👍

@GregorShear GregorShear merged commit 6d06f38 into master Apr 2, 2026
11 checks passed
@GregorShear GregorShear deleted the greg/alert-type-query branch April 2, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants