From 88f54d9a7699944b7d56f978e724b1c0b54dde98 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Thu, 19 Nov 2026 19:42:41 +0100 Subject: feat(sender): add bulk resend and delivery history Allow admins to resend all failed Webmentions globally or requeue every delivery for a source using the shared confirmation workflow. Record outgoing status history, expand sent source details, and provide human-readable guidance for current and historical delivery failures. --- .../c8fa49e1a203_sent_webmention_status_history.py | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 webmentions_ssg/migrations/versions/c8fa49e1a203_sent_webmention_status_history.py (limited to 'webmentions_ssg/migrations/versions') diff --git a/webmentions_ssg/migrations/versions/c8fa49e1a203_sent_webmention_status_history.py b/webmentions_ssg/migrations/versions/c8fa49e1a203_sent_webmention_status_history.py new file mode 100644 index 0000000..454367d --- /dev/null +++ b/webmentions_ssg/migrations/versions/c8fa49e1a203_sent_webmention_status_history.py @@ -0,0 +1,71 @@ +# SPDX-FileCopyrightText: 2026 Dennis Fink +# +# SPDX-License-Identifier: BSD-3-Clause + +"""Record outgoing Webmention delivery history. + +Revision ID: c8fa49e1a203 +Revises: 2b4c6e8a0d12 +""" + +import sqlalchemy as sa +from alembic import op + +revision = "c8fa49e1a203" +down_revision = "2b4c6e8a0d12" +branch_labels = None +depends_on = None + + +def upgrade(): + op.create_table( + "sent_webmention_status_events", + sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True), + sa.Column("webmention_uuid", sa.Uuid(), nullable=False), + sa.Column( + "status", + sa.Enum( + "sent", + "no_endpoint", + "failed", + name="sent_webmention_status", + native_enum=False, + ), + nullable=True, + ), + sa.Column("action", sa.String(length=80), nullable=False), + sa.Column("revision", sa.Integer(), nullable=False), + sa.Column("attempt_count", sa.Integer(), nullable=False), + sa.Column("failure_reason", sa.Text(), nullable=True), + sa.Column("endpoint_response_status", sa.Integer(), nullable=True), + sa.Column("occurred_at", sa.DateTime(timezone=True), nullable=False), + sa.ForeignKeyConstraint( + ["webmention_uuid"], ["sent_webmentions.uuid"], ondelete="CASCADE" + ), + ) + op.create_index( + "ix_sent_webmention_status_events_webmention_id", + "sent_webmention_status_events", + ["webmention_uuid", "id"], + ) + # A pre-upgrade delivery has only its current result available. + op.execute( + sa.text( + """INSERT INTO sent_webmention_status_events + (webmention_uuid, status, action, revision, attempt_count, + failure_reason, endpoint_response_status, occurred_at) + SELECT uuid, status, 'Existing status at upgrade', + desired_revision, attempt_count, failure_reason, + endpoint_response_status, + COALESCE(last_attempted_at, last_sent_at, CURRENT_TIMESTAMP) + FROM sent_webmentions""" + ) + ) + + +def downgrade(): + op.drop_index( + "ix_sent_webmention_status_events_webmention_id", + table_name="sent_webmention_status_events", + ) + op.drop_table("sent_webmention_status_events") -- cgit v1.3.1