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 ## What this is
`bike-admin` is a small single-user web app for logging bike service/repair `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** "events" (type, date, mileage, cost, notes) and seeing per-bike hints: a
hint derived from the newest mileage and the most recent `service` event. **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 Stack: FastAPI (ASGI) + stdlib `sqlite3` (WAL) + Jinja2 + HTMX. Server-rendered
pages with HTMX partial swaps on the bike page. No build step. Dependencies via 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). behind a TLS reverse proxy over HTTPS).
- `BIKE_ADMIN_BIND_HOST` / `BIND_PORT` — bind address/port. - `BIKE_ADMIN_BIND_HOST` / `BIND_PORT` — bind address/port.
- `BIKE_ADMIN_DATA_DIR` — directory for the SQLite file (`bike_admin.db`). - `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 ## Architecture / layout
- `app/config.py` – `Settings` (pydantic-settings) + `get_settings()` (cached). - `app/config.py` – `Settings` (pydantic-settings) + `get_settings()` (cached).
- `app/db.py` – SQLite schema + typed DAO helpers + `get_conn()` context manager. - `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/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 - `app/main.py` – App factory, lifespan (schema init + user seed), security-header
middleware, all routes, HTMX partial rendering. middleware, all routes, HTMX partial rendering.
- `app/templates/` – Jinja2 templates (login, dashboard, bike detail, event partial). - `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/` – `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 ## Conventions & gotchas
+8 -4
View File
@@ -2,16 +2,20 @@
A small, secure, single-user web app for logging bike service and repair A small, secure, single-user web app for logging bike service and repair
"events" (type, date, mileage, cost, notes) and getting a clear **service-due** "events" (type, date, mileage, cost, notes) and getting a clear **service-due**
hint per bike. hint per bike, plus **MOT / insurance renewal** tracking.
Built with FastAPI + SQLite + Jinja2 + HTMX. No build step. Server-rendered pages. Built with FastAPI + SQLite + Jinja2 + HTMX. No build step. Server-rendered pages.
## Features ## Features
- Log events for a bike: type (service, tyre, chain, brake, repair, other), date, - Log events for a bike: type (service, fuel, tyre, chain, brake, repair, mot,
optional mileage + cost, free-text notes. insurance, other), date, optional mileage + cost, free-text notes.
- Per-bike **service status** derived from your newest mileage and the most recent - Per-bike **service status** derived from your newest mileage and the most recent
*service* event: `ok` (still under the interval) or `overdue` (past it — book now). *service* event: `ok` (still under the interval), `due-soon` (within the lead
time — book it soon), or `overdue` (past it — book a service now).
- **MOT / insurance renewals**: the most recent `mot` / `insurance` event is
tracked and flagged `ok` / `due-soon` / `overdue` by date (default: valid for 12
months, "due soon" within the final 60).
- Set a **service interval** in miles per bike (e.g. 5000). - Set a **service interval** in miles per bike (e.g. 5000).
- Dashboard "action needed" strip surfaces any overdue bike. - Dashboard "action needed" strip surfaces any overdue bike.
- Cost and event totals, newest-first history. - Cost and event totals, newest-first history.