feat: alerts open bugs, and repeats of the same problem go to that bug

Owners and admins turn on a secret URL per project (Settings →
Integrations), POST /api/webhooks/alerts/{project}/{token}, that Sentry,
Uptime Kuma, Prometheus Alertmanager, Grafana or any tool sending JSON
with a title can call. A new problem opens a bug as TaskStream (label
«alerta», chosen type and priority); while that bug is open, the same
fingerprint goes to it (a comment at most every 30 minutes) and
«resolved» is said on it; once it is closed, a new bug names the old
one. Alerts of a project are handled one at a time, so two at once open
one bug, and a bug not yet projected still counts as open. Unknown
project, alerts off or a bad token all answer 403.

TaskStream may now comment as the system actor, like it already opened
tickets for public proposals. Stored in Mongo (alert_integrations,
alert_traces), not in the event store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-17 12:36:55 +02:00
parent 42a21412d9
commit 034704e46f
34 changed files with 3248 additions and 6 deletions

View File

@@ -45,6 +45,27 @@ type Aging {
thresholdDays: Float
}
"""Alerts → bugs: the secret URL monitoring tools call to open bugs"""
type AlertIntegration {
enabled: Boolean!
priority: IssuePriority!
"""Ticket type it opens; null: the project's first bug type"""
typeId: ID
"""
Path of the URL on this API, secret token included; only owners and admins see it
"""
webhookPath: String
}
input AlertSettingsInput {
priority: IssuePriority
"""Ticket type to open; null: the project's first bug type"""
typeId: ID
}
type AreaOption {
archived: Boolean!
id: String!
@@ -977,6 +998,9 @@ type Mutation {
deleteSprint(sprintId: ID!): CommandResult!
deleteWebhook(webhookId: ID!): Boolean!
"""Turn it off; the bugs it opened stay"""
disableAlertIntegration(projectId: ID!): Boolean!
"""
A new ticket like this one: what it says, not where it stands (the key comes in the result)
"""
@@ -1029,9 +1053,17 @@ type Mutation {
"""My calendar URL stops working"""
revokeCalendarFeed: Boolean!
"""A new secret URL; the old one stops working at once"""
rotateAlertToken(projectId: ID!): AlertIntegration!
"""A new secret for a repository; the old one stops working"""
rotateGitRepositorySecret(projectId: ID!, repositoryId: ID!): GitRepository!
"""
Turn alerts → bugs on, or change the type and priority it opens (the URL stays)
"""
saveAlertIntegration(input: AlertSettingsInput!, projectId: ID!): AlertIntegration!
"""Save the current board filters under a name (members of the project)"""
saveFilter(input: SaveFilterInput!): ID!
@@ -1507,6 +1539,7 @@ type Query {
limit: Int! = 50
projectId: ID!
): [Activity!]!
alertIntegration(projectId: ID!): AlertIntegration!
automations(projectId: ID!): [Automation!]!
"""The project's link for clients, if any (owners and admins)"""