V4.10
Quality Gate / gate (push) Failing after 11s

This commit is contained in:
Jim Lancaster
2026-08-22 10:19:30 -05:00
parent bf2f3ac09c
commit cf49c3c127
35 changed files with 1029 additions and 161 deletions
+42
View File
@@ -18,6 +18,7 @@ from transcription.db import create_all
from transcription.db import dispose_database_runtime
from transcription.db import initialize_database_runtime
from transcription.db import normalize_legacy_status_spellings
from transcription.db import reconcile_legacy_job_source_columns
from transcription.db import session_scope
from transcription.db.models import Document
from transcription.db.models import DocumentType
@@ -211,6 +212,47 @@ async def test_normalize_legacy_status_spellings_repairs_job_source_status_rows(
await dispose_database_runtime()
@pytest.mark.asyncio
async def test_reconcile_legacy_job_source_columns_drops_executed_at(tmp_path):
settings = Settings(
openrouter_api_key="test-key",
database=SqliteSettings(path=str(tmp_path / "legacy-column.db")),
environment="test",
)
runtime = initialize_database_runtime(settings=settings)
try:
await create_all(engine=runtime.engine)
async with runtime.engine.begin() as connection:
await connection.execute(text("PRAGMA foreign_keys=OFF"))
await connection.execute(text('alter table "job_source" rename to "job_source_current"'))
await connection.execute(
text(
'create table "job_source" ('
'id char(32) not null primary key, '
'job_id char(32) not null, '
'source_id char(32) not null, '
'status varchar(11) not null, '
'executed_at datetime not null, '
'constraint "uq_job_source_job_source" unique ("job_id", "source_id"), '
'foreign key("job_id") references "job" ("id"), '
'foreign key("source_id") references "source" ("id")'
")"
)
)
await connection.execute(text('drop table "job_source_current"'))
await connection.execute(text("PRAGMA foreign_keys=ON"))
dropped = await reconcile_legacy_job_source_columns(engine=runtime.engine)
assert dropped == 1
async with runtime.engine.connect() as connection:
columns = await connection.run_sync(lambda c: [col["name"] for col in inspect(c).get_columns("job_source")])
assert "executed_at" not in columns
finally:
await dispose_database_runtime()
def test_metadata_has_no_unresolvable_table_cycle():
"""create_all must be able to order every table, including on PostgreSQL."""
with warnings.catch_warnings():