left4me/l4d2web/l4d2web/services
mwiegand 18113637e9
refactor(datetime): introduce UtcDateTime, remove naive-strip workarounds
Adds a UtcDateTime TypeDecorator (models.py) that enforces aware-UTC on
write and stamps tzinfo=UTC on read. Replaces 26 DateTime column
declarations. Removes 5 production sites that defensively stripped tzinfo
to match SQLite's lossy round-trip. auth.py now coerces legacy session
cookies upward (stamp UTC on parsed naive marker) instead of stripping
live aware markers downward.

The change is Python-side only: UtcDateTime.impl = DateTime, so DDL and
emitted SQL are unchanged. No Alembic migration needed.

Adds 2 unit tests in test_models.py pinning the decorator's contract
independently of the column declarations.

The three deliberately-naive test_timeago.py fixtures (lines 67, 73, 113)
remain naive on purpose -- they exercise _ensure_utc's normalize-up path
at the public filter boundary, which stays as belt-and-braces defense.

See docs/superpowers/specs/2026-05-16-tz-aware-datetime-design.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 11:59:29 +02:00
..
__init__.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
host_commands.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
job_worker.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
l4d2_facade.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
live_state_poller.py refactor(datetime): introduce UtcDateTime, remove naive-strip workarounds 2026-05-16 11:59:29 +02:00
overlay_builders.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
overlay_creation.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
overlay_files.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
rate_limit.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
rcon.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
security.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
server_identity.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
spec_yaml.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
status.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
steam_users.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
steam_workshop.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00
timeago.py feat(timeago): add format_time_html returning a <time> element 2026-05-16 11:09:23 +02:00
workshop_paths.py refactor(repo): uv workspace + hatchling + layout restructure 2026-05-15 22:04:29 +02:00