Fix devcontainer build, event-loop scope, and UTC timestamps
CI / check (push) Canceled after 0s

Found by running the stack for the first time:

- compose build context pointed outside the repo. Relative paths in
  .devcontainer/compose.override.yaml resolve against the project
  directory (the repo root), not the file's own directory, so "context: .."
  escaped the repository and the image could not build at all.
- The devcontainers/python base image ships a yarn apt source whose
  signing key has rotated, failing apt-get update and the whole build.
  Drop that source list; we don't use yarn.
- pytest-asyncio ran fixtures on a session-scoped loop while tests ran on
  per-function loops, so asyncmy raised "Future attached to a different
  loop" on every database-backed test. aiosqlite masked this; MySQL does
  not. Fixture loop scope now matches the test loop scope.
- MySQL DATETIME stores no offset, so timestamps serialized bare and left
  clients guessing. Connections are pinned to UTC, so DeviceRead now
  attaches that offset explicitly, with a test covering it.

Verified end to end against real MySQL 8.4 and Keycloak 26.7: cold start
from destroyed volumes, uv sync --frozen, migrations, 41 tests, ruff,
mypy --strict, and the live authorization matrix driven by real tokens.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
gnickensandClaude Opus 5 committed 2026-09-10 13:02:13 -04:00
1 parent 0526d34e42
commit c7838acbbf
5 files changed
+37 -5

No files matched your search

+8
View File
@@ -101,6 +101,14 @@ class TestCrud:
assert patched.json()["description"] == "original"
assert patched.json()["name"] == created["name"]
async def test_timestamps_carry_an_explicit_utc_offset(
self, client: AsyncClient, as_user: AsUser
) -> None:
"""MySQL DATETIME has no offset; the API must not emit a bare timestamp."""
as_user("operator")
created = (await client.post(PREFIX, json=_payload())).json()
assert created["created_at"].endswith(("Z", "+00:00"))
async def test_missing_device_is_404(self, client: AsyncClient, as_user: AsUser) -> None:
as_user("viewer")
response = await client.get(f"{PREFIX}/999999")