Fix the CI gates: Python 3.13, concurrency groups, hook violations
Docs / docs (push) Successful in 49s
Playwright Tests / test-playwright (1, 2) (push) Failing after 1m11s
Playwright Tests / test-playwright (2, 2) (push) Failing after 23s
pre-commit / pre-commit (push) Successful in 3m2s
Test Backend / test-backend (push) Successful in 2m22s
Compose Smoke Test / test-compose (push) Failing after 22s
Playwright Tests / merge-reports (push) Canceled after 1s

The gates have never gone green on the new runners. Three separate reasons:

- backend/Dockerfile shipped Python 3.10 while the code imports typing.Self
  and datetime.UTC, so the container exited on import and the suite could not
  even load its conftest. The image moves to 3.13 and the packages declare
  >=3.12, which is the floor the tests actually pass on; ruff's target follows
  and rewrites timezone.utc and asyncio.TimeoutError accordingly. Relocking
  drops the 3.10 branch, which bumps FastAPI and so regenerates the SDK.
- frontend/README.md had no trailing newline and two dashboard widgets used
  arbitrary text-[…] sizes. Both are em-relative on purpose, so they move to
  the inline style the neighbouring ramp already uses.
- Every commit left its own run queued: without a concurrency group a runner
  that was offline for a while works through a backlog nobody reads. A stack
  that fails to come up now prints its logs before the teardown removes it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-24 14:55:59 +02:00
co-authored by Claude Opus 5
parent c34585cd72
commit d4a9406c51
34 changed files with 183 additions and 1213 deletions
+2 -2
View File
@@ -488,7 +488,7 @@ class FlowController:
return
try:
await asyncio.wait_for(self._lock.acquire(), wait)
except asyncio.TimeoutError:
except TimeoutError:
raise RebuildBusy(
f"A pipeline rebuild is still running after {wait:.0f}s"
) from None
@@ -736,7 +736,7 @@ class FlowController:
continue
try:
await asyncio.wait_for(node.stop(self.app), NODE_STOP_TIMEOUT)
except asyncio.TimeoutError:
except TimeoutError:
# Abandoned rather than waited on: the next node still gets to
# close, and the rebuild still happens.
logger.warning(
+10 -10
View File
@@ -15,7 +15,7 @@ from __future__ import annotations
import asyncio
import logging
import time
from datetime import datetime, timedelta, timezone
from datetime import UTC, datetime, timedelta
from typing import Any
from sqlalchemy import delete, func, update
@@ -68,7 +68,7 @@ RECORDED = {
def _minute(ts: float) -> datetime:
return datetime.fromtimestamp(ts, timezone.utc).replace(second=0, microsecond=0)
return datetime.fromtimestamp(ts, UTC).replace(second=0, microsecond=0)
def _detail(event: dict[str, Any]) -> str:
@@ -106,7 +106,7 @@ class MetricsCollector:
timeout = max(0.05, self._flush_s - (time.monotonic() - last))
try:
event = await asyncio.wait_for(queue.get(), timeout)
except asyncio.TimeoutError:
except TimeoutError:
pass
else:
try:
@@ -184,7 +184,7 @@ class MetricsCollector:
error = str(event.get("error") or "")
self._pending.append(
EngineEvent(
ts=datetime.fromtimestamp(ts, timezone.utc),
ts=datetime.fromtimestamp(ts, UTC),
type="node_error",
flow=str(event.get("flow") or ""),
node=str(event.get("node") or ""),
@@ -201,7 +201,7 @@ class MetricsCollector:
if kind == "cascade_finished":
if run is not None:
run["finished_at"] = datetime.fromtimestamp(ts, timezone.utc)
run["finished_at"] = datetime.fromtimestamp(ts, UTC)
run["duration_ms"] = round((ts - run["started_ts"]) * 1000, 2)
run["status"] = "error" if run["errors"] else "ok"
return
@@ -210,7 +210,7 @@ class MetricsCollector:
if event.get("health") == "down":
self._pending.append(
EngineEvent(
ts=datetime.fromtimestamp(ts, timezone.utc),
ts=datetime.fromtimestamp(ts, UTC),
type="node_health",
flow=str(event.get("flow") or ""),
node=str(event.get("node") or ""),
@@ -222,7 +222,7 @@ class MetricsCollector:
if kind == "audit":
self._pending.append(
EngineEvent(
ts=datetime.fromtimestamp(ts, timezone.utc),
ts=datetime.fromtimestamp(ts, UTC),
type="audit",
flow=str(event.get("flow") or ""),
detail=str(event.get("action") or ""),
@@ -234,7 +234,7 @@ class MetricsCollector:
if kind in RECORDED:
self._pending.append(
EngineEvent(
ts=datetime.fromtimestamp(ts, timezone.utc),
ts=datetime.fromtimestamp(ts, UTC),
type=kind,
flow=str(event.get("flow") or ""),
node=str(event.get("node") or event.get("task") or ""),
@@ -258,7 +258,7 @@ class MetricsCollector:
"flow": str(event.get("flow") or "")[:NAME_MAX],
"source": str(event.get("cause") or ""),
"started_ts": ts,
"started_at": datetime.fromtimestamp(ts, timezone.utc),
"started_at": datetime.fromtimestamp(ts, UTC),
"finished_at": None,
"status": "running",
"nodes": 0,
@@ -382,7 +382,7 @@ class MetricsCollector:
session.commit()
def _prune(self, session: Session) -> None:
now = datetime.now(timezone.utc)
now = datetime.now(UTC)
cutoff = now - timedelta(days=settings.OBS_RETENTION_DAYS)
session.execute(delete(MetricBucket).where(col(MetricBucket.bucket) < cutoff))
session.execute(delete(EngineEvent).where(col(EngineEvent.ts) < cutoff))
+2 -2
View File
@@ -10,7 +10,7 @@ import asyncio
import inspect
import logging
from collections.abc import Callable, Coroutine, Iterable, Iterator
from typing import TYPE_CHECKING, Any, TypeAlias
from typing import TYPE_CHECKING, Any
from fluksio.flow import logs
from fluksio.flow.messages import MessageSpec, qualify
@@ -26,7 +26,7 @@ logger = logging.getLogger(__name__)
# What a node hands back: the pipeline's state once it is bound, since a
# trigger runs the graph, and its own outputs when it is not.
NodeResult: TypeAlias = "StateBackend | dict[str, Any] | None"
type NodeResult = StateBackend | dict[str, Any] | None
class NodeOutputError(TypeError):
+1 -1
View File
@@ -265,7 +265,7 @@ class DelayNode(Node):
await asyncio.wait_for(stop.wait(), timeout=wait_seconds)
# If we get here, stop was requested
break
except asyncio.TimeoutError:
except TimeoutError:
# Timeout means it's time to fire
pass
+1 -1
View File
@@ -159,7 +159,7 @@ class InjectNode(Node):
"""Wait, but wake immediately if the node is being stopped."""
try:
await asyncio.wait_for(stop.wait(), timeout=seconds)
except asyncio.TimeoutError:
except TimeoutError:
pass
async def _fire(self) -> None:
+7 -7
View File
@@ -35,7 +35,7 @@ import time
import uuid
from collections.abc import Callable
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timedelta, timezone
from datetime import UTC, datetime, timedelta
from typing import Any
from sqlalchemy import update
@@ -380,7 +380,7 @@ class RunService:
cause=cause,
status="queued",
labels=required_labels(flow),
created_at=datetime.now(timezone.utc),
created_at=datetime.now(UTC),
actor=actor,
)
with Session(db_engine) as session:
@@ -428,7 +428,7 @@ class RunService:
.where(col(Run.id) == run_id, col(Run.status) == "queued")
.values(
status="cancelled",
finished_at=datetime.now(timezone.utc),
finished_at=datetime.now(UTC),
status_reason="Cancelled before it started",
)
)
@@ -516,7 +516,7 @@ class RunService:
break
with self._lock:
mine = list(self._active)
now = datetime.now(timezone.utc)
now = datetime.now(UTC)
try:
if mine:
with Session(db_engine) as session:
@@ -561,7 +561,7 @@ class RunService:
The compare-and-swap is what makes a redelivered item harmless — the
second engine to arrive updates nothing and walks away.
"""
now = datetime.now(timezone.utc)
now = datetime.now(UTC)
with Session(db_engine) as session:
result = session.exec(
update(Run)
@@ -648,7 +648,7 @@ class RunService:
run_id=run_id,
node=outcome.node[:255],
status="ok" if outcome.ok else "error",
started_at=datetime.now(timezone.utc),
started_at=datetime.now(UTC),
duration_ms=outcome.duration_ms,
error=outcome.error[:ERROR_CAP],
logs=outcome.logs[:LOG_CAP],
@@ -693,7 +693,7 @@ class RunService:
status_reason=reason,
result=result,
duration_ms=duration_ms,
finished_at=datetime.now(timezone.utc),
finished_at=datetime.now(UTC),
)
)
session.commit()