Small cleanups from platform-prep code review #31
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Umbrella issue for non-blocking follow-ups surfaced during review of the #26/#27 PR. None of these are correctness bugs; all are "land when convenient" polish.
1. Move
logger = ...below all imports inservice.pysrc/quartermaster/service.py:10declareslogger = logging.getLogger("quartermaster.service")between the stdlib imports (lines 2–5) and the project imports (lines 12–19). Every other module that follows this pattern (notablymonth_service.py) declares the logger after all imports. One-line move for style consistency.2. Comment in
routes_health.pyabout router separation vs middlewareThe spec and plan describe keeping
/healthzon its own router so "future middleware" leaves it alone. That's not quite right: FastAPI middleware registered viaapp.add_middleware(...)runs on every request regardless of router. The router boundary only helps if future auth is applied as a router-scopeddependencies=[...](which is fine — Quartermaster's auth is Traefik-side anyway, so the point is moot in practice).Add a short comment near the router declaration in
src/quartermaster/routes_health.pyclarifying this, so a future maintainer adding app-level middleware doesn't assume/healthzis automatically exempt.3. Richer
template_entry_updatedlog extrasToday
service.update_entrylogs{event, entry_id}. For the Loki signal to be useful during "my Power bill amount looks wrong after editing" investigations, include the names of the fields that changed (not their values — values can contain PII-ish notes, and an audit trail belongs in a table, not in logs). Something like:Update the seed-event test to assert
fieldsis present on the record.Nits not tracked separately
Several smaller items surfaced in review but aren't worth their own bullet — fold into whichever PR lands items above if natural:
levelname == "INFO". Either all should or none should.OperationalError("boom", None, Exception("boom"))intests/test_health.pyis a legitimate but cosmetically odd constructor shape.year_monthcould be added toposting_added/posting_deletedextras for easier month-scoped queries in Loki.--log-configis optional in dev for human-readable output.