diff --git a/crud.py b/crud.py index 8029f26..80af91f 100644 --- a/crud.py +++ b/crud.py @@ -148,7 +148,9 @@ async def count_period_failures(contract_id: str, period_index: int) -> int: counter on the contract so the number survives a restart and stays auditable — the rows that produced it are right there. """ - row = await db.fetchone( + # No model: fetchone's TModel is unbound for a bare aggregate, so the + # row comes back as a plain mapping and needs its own annotation. + row: dict | None = await db.fetchone( "SELECT COUNT(*) AS n FROM payroll.payouts " "WHERE contract_id = :cid AND period_index = :idx AND status = :status", {