#5463 "Acknowledgements on record: an event and who did it", step 1 of milestone 499 "Alerts you can trust". The live walk in #5461 found that acknowledging changed only the alert's current state: once it resolved, nothing said who had acknowledged it or when. - alert_events.actor_id (migration 0040): the person behind a transition. - Acknowledging writes a firing → acknowledged event by the acknowledger. - A rule edit, disable or enable that resets an alert carries its actor (web and MCP alike). - The history page notes "acknowledged by X" and "rule disabled by X"; MCP get_alert_history returns `by`. - One usernames() helper in alerts.service, used by the active list, the history page and the MCP tools. - docs/core/alerting.md: the state diagram no longer shows an acknowledged alert re-firing, and says what an event records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
781 B
Python
25 lines
781 B
Python
"""Who made an alert transition happen (#5463): an acknowledgement, or a rule
|
|
edit, disable or enable that reset the alert, records the person on its event.
|
|
|
|
Revision ID: 0040_alert_event_actor
|
|
Revises: 0039_password_resets
|
|
Create Date: 2026-10-09
|
|
"""
|
|
from typing import Sequence, Union
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision: str = "0040_alert_event_actor"
|
|
down_revision: Union[str, None] = "0039_password_resets"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column("alert_events", sa.Column(
|
|
"actor_id", sa.String(36), sa.ForeignKey("users.id", ondelete="SET NULL"), nullable=True))
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("alert_events", "actor_id")
|