Docs: document MOT/insurance renewals, due-soon state, new settings

- README: feature list now covers renewal tracking, the due-soon service
  state, and the full event-type set.
- AGENTS: add the three hint settings, compute_renewal_due, favicon.svg,
  and test_renewals.py to the layouts.
This commit is contained in:
2026-09-10 10:24:25 +01:00
parent aced0a1a3b
commit 12494bf30c
2 changed files with 20 additions and 9 deletions
+12 -5
View File
@@ -5,8 +5,10 @@ Guidance for working in this repo.
## What this is
`bike-admin` is a small single-user web app for logging bike service/repair
"events" (type, date, mileage, cost, notes) and seeing a per-bike **service-due**
hint derived from the newest mileage and the most recent `service` event.
"events" (type, date, mileage, cost, notes) and seeing per-bike hints: a
**service-due** status derived from the newest mileage and the most recent
`service` event, plus **MOT / insurance renewal** statuses derived from the most
recent `mot` / `insurance` events.
Stack: FastAPI (ASGI) + stdlib `sqlite3` (WAL) + Jinja2 + HTMX. Server-rendered
pages with HTMX partial swaps on the bike page. No build step. Dependencies via
@@ -38,19 +40,24 @@ All settings come from env vars (or a `.env` file) via `pydantic-settings`,
behind a TLS reverse proxy over HTTPS).
- `BIKE_ADMIN_BIND_HOST` / `BIND_PORT` — bind address/port.
- `BIKE_ADMIN_DATA_DIR` — directory for the SQLite file (`bike_admin.db`).
- Hints: `BIKE_ADMIN_SERVICE_DUE_SOON_MILES` (service "book soon" lead time,
default 200), `BIKE_ADMIN_RENEWAL_DUE_SOON_DAYS` (MOT/insurance "due soon"
lead time, default 60), `BIKE_ADMIN_RENEWAL_MONTHS` (MOT/insurance validity,
default 12).
## Architecture / layout
- `app/config.py` – `Settings` (pydantic-settings) + `get_settings()` (cached).
- `app/db.py` – SQLite schema + typed DAO helpers + `get_conn()` context manager.
- `app/security.py`– Argon2 password hashing, DB session tokens, CSRF, login throttle.
- `app/services.py`– Business logic: `compute_service_due`, `summarize_bike`, `all_summaries`.
- `app/services.py`– Business logic: `compute_service_due`, `compute_renewal_due`,
`summarize_bike`, `all_summaries`.
- `app/main.py` – App factory, lifespan (schema init + user seed), security-header
middleware, all routes, HTMX partial rendering.
- `app/templates/` – Jinja2 templates (login, dashboard, bike detail, event partial).
- `app/static/` – `main.css` and vendored `htmx.min.js`.
- `app/static/` – `main.css`, `favicon.svg`, and vendored `htmx.min.js`.
- `tests/` – `conftest.py` (Client helper + temp-data-dir env) and per-area
tests.
tests (`test_auth`, `test_due`, `test_renewals`, `test_events`, `test_security`).
## Conventions & gotchas