"""Add superseded_at to musehub_background_jobs musehub#108 (MWP9): dedup for self-coalescing job types (fetch.mpack.prebuild) now treats an already-'running' row as covering a new trigger, on the assumption that the running job will read fresh data before finishing. That assumption breaks when the running job's data read already started before the new trigger's write landed -- confirmed live: a bulk commit-signature repair batch landed 20 fixes, but a concurrently-running prebuild job's read only captured 1 of them, serving a stale cached mpack to the next clone until a later, unrelated trigger happened to catch up. superseded_at lets enqueue_job flag a running row when a new trigger arrives for it, and lets the job's own handler (process_fetch_mpack_prebuild_job) check that flag after building and redo the build once more before marking done, instead of finishing with stale coverage. Additive and nullable -- existing/historical rows get NULL (never superseded). Revision ID: 0078 Revises: 0077 """ from __future__ import annotations from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = '0078' down_revision: Union[str, None] = '0077' branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: op.add_column( 'musehub_background_jobs', sa.Column('superseded_at', sa.DateTime(timezone=True), nullable=True), ) def downgrade() -> None: op.drop_column('musehub_background_jobs', 'superseded_at')