fix: QA issues — composite index, anchors, fallbacks

- Add composite index ix_translation_records_run_source_hash
  for NOT EXISTS dedup subquery performance + Alembic migration
- Remove duplicate #endregion in orchestrator.py (INV_3)
- Replace hardcoded RU fallback 'Статус' with 'Status'
- Add early return guard to loadMoreRecords()
- Show records summary always when recordsTotal > 0
This commit is contained in:
2026-06-04 13:33:17 +03:00
parent 15d47450a3
commit 339f4e0695
4 changed files with 43 additions and 3 deletions

View File

@@ -0,0 +1,38 @@
"""Add composite index (run_id, source_hash) for NOT EXISTS dedup
Adds ix_translation_records_run_source_hash on translation_records(run_id, source_hash)
to accelerate the correlated NOT EXISTS subquery in orchestrator_query.get_run_records
when deduplicate=true.
Revision ID: c7d8e9f0a1b2
Revises: a1b2c3d4e5f6
Create Date: 2026-06-04 13:30:00.000000
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "c7d8e9f0a1b2"
down_revision: str | Sequence[str] | None = "a1b2c3d4e5f6"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
def upgrade() -> None:
"""Create composite index."""
op.create_index(
"ix_translation_records_run_source_hash",
"translation_records",
["run_id", "source_hash"],
postgresql_using="btree",
sqlite=True,
)
def downgrade() -> None:
"""Drop composite index."""
op.drop_index("ix_translation_records_run_source_hash",
table_name="translation_records")