From dfc2e45731f115b32a34698b7203b1bcef156d5e Mon Sep 17 00:00:00 2001 From: vladtechno Date: Sat, 16 May 2026 22:48:05 +1000 Subject: [PATCH] docs: STATE.md with handoff for next session (Phase A done, Task B1 next) --- docs/superpowers/STATE.md | 117 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 docs/superpowers/STATE.md diff --git a/docs/superpowers/STATE.md b/docs/superpowers/STATE.md new file mode 100644 index 0000000..afd9641 --- /dev/null +++ b/docs/superpowers/STATE.md @@ -0,0 +1,117 @@ +# Premium Mechanic PWA — Implementation State + +> Last updated: 2026-05-16 (end of session 1) + +## What is done + +| Phase | Task | Status | Artifact | +|---|---|---|---| +| 0 | Git infrastructure (Gitea + repos + feature branches) | ✅ DONE | repos exist, ssh keys configured | +| A | A1: Recon TaxiDashboard backend structure | ✅ DONE | `docs/backend-layout-notes.md` | +| A | A2: Caddy fragment for `mechanic.pptaxi.ru` | ✅ DONE | `ops/Caddyfile.fragment` | +| A | A3: MinIO CORS on `pp-inspections` bucket | ✅ DONE | `ops/set-minio-cors.sh`, applied, preflight 204 | +| A | A4: SQLAlchemy models (`MechanicInspection`, `MechanicInspectionPhoto`, `MechanicDamageMarker`) | ✅ DONE | commit `be0553e` on `feat/mechanic-mvp` | + +## Where things live + +### Repos (Gitea: `http://100.64.0.9:3001/tremble7681`) + +| Repo | Local clone | Working branch | +|---|---|---| +| `mechanic-pwa` | `c:\NewProject\PremiumDriverApp\` | `feat/mechanic-mvp` | +| `taxi-dashboard` | `c:\NewProject\taxi-dashboard\` | `feat/mechanic-mvp` | + +`taxi-dashboard` clone has two remotes: `origin` → Gitea, `vds` → SSH to `/opt/sites/taxi-dashboard/` on 100.64.0.12 (for pulling back-and-forth with prod). + +### Reference paths (real, verified — see `docs/backend-layout-notes.md`) + +- `Base`, `TimestampMixin` → `app.models.base` +- `get_db` → `app.db` (file: `app/db/__init__.py`) +- `get_current_user` → `app.auth.deps` +- `User` → `app.models.user` +- Auth flow: **OAuth2 password + Bearer JWT** (not PIN as plan originally said) +- DB init: **`Base.metadata.create_all`** at startup (not Alembic) + inline `ALTER TABLE ADD COLUMN IF NOT EXISTS` in `app/main.py` lifespan +- Backend Docker container: `taxi-backend-green` / `taxi-backend-blue` (blue/green) +- MinIO container: `taxi-minio` +- Models registered in: `app/models/__init__.py` (imports + `__all__`) + +### Naming clash decision + +Existing `app/api/inspections.py` + model `CarInspection` (table `car_inspections`) hold **vendor-imported read-only** data from NaughtySoft. Our new tables use the **`mechanic_`** prefix to coexist: + +- `mechanic_inspections` (model `MechanicInspection`) +- `mechanic_inspection_photos` (model `MechanicInspectionPhoto`) +- `mechanic_damage_markers` (model `MechanicDamageMarker`) + +## Next task + +### **Task B1 — Mechanic module skeleton with healthz endpoint** + +(From `docs/superpowers/plans/2026-05-16-premium-mechanic-phase1.md` Phase B.) + +**Working dir:** `c:\NewProject\taxi-dashboard` (branch `feat/mechanic-mvp` already checked out) + +**What to do:** +1. Create new file `backend/app/api/mechanic.py` (not a subpackage — TaxiDashboard uses flat `app/api/*.py` files): + ```python + from fastapi import APIRouter + + router = APIRouter(prefix="/api/v1/mechanic", tags=["mechanic"]) + + @router.get("/healthz") + async def healthz() -> dict[str, str]: + return {"status": "ok"} + ``` +2. Register in `backend/app/main.py` — add `mechanic` to the `from app.api import (...)` tuple and call `app.include_router(mechanic.router)` where the other includes live. +3. Test: bring up the dev backend, hit `GET /api/v1/mechanic/healthz`, expect `{"status":"ok"}`. +4. Commit + push. + +Plan calls it Task B1 (see `Phase B` section in the plan). + +## How to resume in a new session + +In a new Claude Code chat in `c:\NewProject\`, paste this prompt: + +``` +Продолжаем проект Premium Mechanic PWA. + +Контекст: +- Spec: PremiumDriverApp/docs/superpowers/specs/2026-05-16-premium-mechanic-design.md +- План: PremiumDriverApp/docs/superpowers/plans/2026-05-16-premium-mechanic-phase1.md +- Backend layout: PremiumDriverApp/docs/backend-layout-notes.md +- Текущее состояние: PremiumDriverApp/docs/superpowers/STATE.md + +Phase A полностью завершён (A1–A4, последний коммит be0553e). Следующая задача — Task B1 (mechanic module skeleton + healthz endpoint) из плана. + +Используй subagent-driven-development skill. Прочитай STATE.md, спавни первого implementer-subagent на Task B1. +``` + +That prompt is the **single entry point** for the next session — Claude will read STATE.md, ground itself, and continue dispatching subagents from Task B1 onward. + +## Remaining roadmap (Phase 1 MVP) + +- **Phase B** (4 tasks): module skeleton, models registered, schemas, auth deps +- **Phase C** (3 tasks): GET /me, GET /vehicles, GET /vehicles/{id} +- **Phase D** (3 tasks): inspections CRUD with carry-over markers logic +- **Phase E** (5 tasks): MinIO storage layer + presigned upload/confirm + 302 read + celery thumbnail +- **Phase F** (2 tasks): markers create/update/delete +- **Phase G** (5 tasks): Vite + React + Tailwind + shadcn + PWA scaffold +- **Phase H** (3 tasks): Login + Home + VehicleCard pages +- **Phase I** (6 tasks): CameraCapture + PhotoSlot + VehicleScheme + InspectionEditor + InspectionReview +- **Phase J** (4 tasks): e2e test + deploy backend + deploy frontend + smoke test + +≈ 35 tasks left until MVP live on `mechanic.pptaxi.ru`. + +## Known external dependencies + +- MinIO `pp-inspections` bucket — CORS already configured, presigned uploads will work +- Caddy on 100.64.0.12 — fragment ready, will be wired during Phase J deploy +- Docker blue/green deployment on VDS — backend re-deployment will need a touch of `docker compose` (Phase J) +- Frontend deployment target: `/opt/sites/mechanic-pwa/dist/` on VDS (Phase J) + +## Conventions reminder + +- All new code in `feat/mechanic-mvp` branches in both repos +- All new tables use `mechanic_` prefix +- Don't touch existing `app/api/inspections.py` or `app/models/inspection.py` (vendor-imported) +- Backend tests are synchronous metadata-style for now (no async fixtures exist yet); when API endpoint tests start in Phase C, they'll need a real DB session — implementer-subagent should propose minimal `conftest.py` additions if needed.