From 12494bf30c00f9392223ad2b077a08e434fb1a81 Mon Sep 17 00:00:00 2001 From: Jake Pullen Date: Thu, 10 Sep 2026 10:24:25 +0100 Subject: [PATCH] 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. --- AGENTS.md | 17 ++++++++++++----- README.md | 12 ++++++++---- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 7956699..c3d583f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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 diff --git a/README.md b/README.md index e4f0909..540074e 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,20 @@ 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** -hint per bike. +hint per bike, plus **MOT / insurance renewal** tracking. Built with FastAPI + SQLite + Jinja2 + HTMX. No build step. Server-rendered pages. ## Features -- Log events for a bike: type (service, tyre, chain, brake, repair, other), date, - optional mileage + cost, free-text notes. +- Log events for a bike: type (service, fuel, tyre, chain, brake, repair, mot, + insurance, other), date, optional mileage + cost, free-text notes. - 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). - Dashboard "action needed" strip surfaces any overdue bike. - Cost and event totals, newest-first history.