fix: logging overhaul — Alembic fileConfig disable_existing_loggers=False, propagate=False on loggers, ADR docs, catch-up migration for missing columns, sqlparse dep, build archive naming
This commit is contained in:
@@ -20,6 +20,18 @@ if "DATABASE_URL" in os.environ:
|
||||
|
||||
# Interpret the config file for Python logging.
|
||||
# This line sets up loggers basically.
|
||||
# @ADR [LOG-001] disable_existing_loggers=False
|
||||
# @RATIONALE Python 3.13's logging.config.fileConfig() defaults to
|
||||
# disable_existing_loggers=True, which sets logger.disabled = True on ALL
|
||||
# existing loggers not listed in alembic.ini's [loggers] section. This
|
||||
# includes our 'superset_tools_app' and 'cot' loggers. With disabled=True,
|
||||
# Logger.isEnabledFor() immediately returns False (see Python 3.13 source),
|
||||
# silently dropping every logger.info()/warning()/error() call across the
|
||||
# entire application. The SS-TOOLS logging system manages its own handlers
|
||||
# via configure_logger() — Alembic's INI-based config is irrelevant here.
|
||||
# @REJECTED Adding superset_tools_app to alembic.ini [loggers] was rejected
|
||||
# because it couples app logging config to Alembic's ini format, which is
|
||||
# fragile and non-obvious for future maintainers.
|
||||
if config.config_file_name is not None:
|
||||
fileConfig(config.config_file_name, disable_existing_loggers=False)
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
"""add missing columns policy_id provider_id is_multimodal
|
||||
|
||||
@ADR [LOG-003] Catch-up migration for columns added in inserted revisions.
|
||||
@RATIONALE Migrations 9f8e7d6c5b4a (is_multimodal), a7b1c2d3e4f5 (provider_id),
|
||||
and b1c2d3e4f5a6 (policy_id) were inserted into the chain before the
|
||||
existing head 86c7b1d6a710. Databases already at 86c7b1d6a710 skip them
|
||||
because Alembic sees no gap between current and target revision.
|
||||
This migration adds the same columns with 86c7b1d6a710 as parent, so
|
||||
it runs on both fresh and pre-stamped databases.
|
||||
|
||||
Revision ID: 2df63b7ce038
|
||||
Revises: 86c7b1d6a710
|
||||
Create Date: 2026-05-27 11:17:26.789634
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '2df63b7ce038'
|
||||
down_revision: Union[str, Sequence[str], None] = '86c7b1d6a710'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# Add is_multimodal to llm_providers (from 9f8e7d6c5b4a)
|
||||
op.add_column("llm_providers",
|
||||
sa.Column("is_multimodal", sa.Boolean(), nullable=False, server_default="false")
|
||||
)
|
||||
op.alter_column("llm_providers", "is_multimodal", server_default=None)
|
||||
|
||||
# Add provider_id to validation_policies (from a7b1c2d3e4f5)
|
||||
op.add_column("validation_policies",
|
||||
sa.Column("provider_id", sa.String(), nullable=True)
|
||||
)
|
||||
|
||||
# Add policy_id to llm_validation_results (from b1c2d3e4f5a6)
|
||||
op.add_column("llm_validation_results",
|
||||
sa.Column("policy_id", sa.String(), nullable=True, index=True)
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
op.drop_column("llm_validation_results", "policy_id")
|
||||
op.drop_column("validation_policies", "provider_id")
|
||||
op.drop_column("llm_providers", "is_multimodal")
|
||||
Reference in New Issue
Block a user