Files
FabledGrimoire/alembic/versions/0133_rule_delivery_plugin.py
T
bvandeusenandClaude Opus 5.5 e0621713d4
CI & Build / TypeScript typecheck (push) Canceled after 0s
CI & Build / Plugin hooks (push) Canceled after 0s
CI & Build / Python lint (push) Canceled after 0s
CI & Build / Python tests (push) Canceled after 0s
CI & Build / integration (push) Canceled after 0s
CI & Build / Build & push image (push) Canceled after 0s
fix(7733): a rule's open rate counts only deliveries whose plugin reports opens
Each rule line a hook delivers now records the plugin version that asked for
it (the X-Grimoire-Plugin header every hook request sends). The open rate
used to order rules, and the delivery history the weighing pass reads,
count only deliveries that carry one.

A plugin before 2026.11.22.2312 never reported an open of a rule a hook had
just named, so every delivery made to such a session read as unopened. The
server shipped delivery recording from dev on 2026-11-22. The plugin ships
from main, and a running session keeps the plugin it started with, so those
sessions kept arriving. They are why opens read about 1 in 600. Existing
rows have no version and drop out of the rate; nothing is deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 15:52:42 -05:00

27 lines
729 B
Python

"""rule deliveries record the plugin version that asked for the line
Revision ID: 0133
Revises: 0132
Create Date: 2026-11-23
Only a plugin that sends its version reports every open, so the open-rate
readers count only deliveries that carry one. Existing rows stay null: they
were made while sessions ran a plugin that did not report opens of the rules
a hook had named, so their missing opens are not evidence.
"""
import sqlalchemy as sa
from alembic import op
revision = "0133"
down_revision = "0132"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column("rule_deliveries", sa.Column("plugin", sa.Text(), nullable=True))
def downgrade() -> None:
op.drop_column("rule_deliveries", "plugin")