V6.1 UI refinements, add Maintenance jobs to Settings
Quality Gate / gate (push) Failing after 2m57s

This commit is contained in:
Jim Lancaster
2026-08-31 11:31:25 -05:00
parent daa1642933
commit 9990583345
28 changed files with 1056 additions and 174 deletions
+51
View File
@@ -204,3 +204,54 @@ async def test_process_next_leaves_a_caller_owned_bundle_open(monkeypatch):
assert await process_next_queued_job(services=bundle) is False
assert closed is False
@pytest.mark.asyncio
async def test_run_worker_loop_processes_queued_maintenance_runs(monkeypatch):
stop_event = asyncio.Event()
maintenance_calls = 0
class _Sources:
async def aclose(self):
return
class _Maintenance:
async def process_next_queued_run(self):
nonlocal maintenance_calls
maintenance_calls += 1
if maintenance_calls == 1:
return True
stop_event.set()
return False
class _Jobs:
settings = Settings(openrouter_api_key="test-key", worker_stale_job_seconds=120.0)
async def requeue_stale_processing_jobs(self, *, stale_before, session=None):
_ = (stale_before, session)
return 0
class _Bundle:
def __init__(self):
self.jobs = _Jobs()
self.sources = cast("SourceService", _Sources())
self.maintenance = _Maintenance()
async def aclose(self):
await self.sources.aclose()
monkeypatch.setattr(
"transcription.worker.ServiceBundle.from_session_factory",
classmethod(lambda _cls, _factory=None, **_kwargs: cast(ServiceBundle, _Bundle())),
)
async def _no_jobs(*, session=None, session_factory=None, services=None):
_ = (session, session_factory, services)
return False
monkeypatch.setattr("transcription.worker.process_next_queued_job", _no_jobs)
fake_session_factory = cast(async_sessionmaker[AsyncSession], object())
await run_worker_loop(stop_event=stop_event, poll_interval_seconds=0, session_factory=fake_session_factory)
assert maintenance_calls >= 2