Make service accounts assignable to incidents (assigned_to_service_account_id) #36
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #35 (shipped in v0.39.0), which records who performed an assignment but left service accounts unassignable.
Today
incidents.assigned_tois ausers(id)FK, so only a human can be the assignee. Migration 015 (#25) deliberately did not addassigned_to_service_account_id, and 018 (#35) did not either.What it touches
incidents.assigned_to_service_account_id(nullable FK toservice_accounts,ON DELETE SET NULL, exclusive withassigned_tovia a CHECK, same shape asacknowledged_by_service_account_idin 015).handleIncidentAssign(internal/api/incidents.go): request body currently{"user_id": N}; needs a way to name a service account (e.g.service_account_id, exactly one of the two).assignedevents need an assignee column for a service account too (incident_events.user_idcannot hold it).incidentSelectFrom/scanIncidentandmodels.Incident: add the service-account assignee id/name (omitempty, additive JSON).GET /api/incidents?assigned_to=filter: decide whether it also accepts service accounts.internal/api/notifier.go, theAssignedToUseruse): a service account has no ntfy topic, so decide what a page for such an incident does.incident.jsand the queue's→ namelabel.terdut-tui: mirror the new JSON ininternal/api/client.goandtypes.go.Open question
Whether this is wanted at all: a service account can act on incidents, but nobody gets paged for one it owns. If the use case is only "operator marks an incident as taken by automation", an assignee-less marker may fit better than a full assignee.