Remodel/sprints/SPRINT_00.md

35 lines
3 KiB
Markdown

Goal: Empty end-to-end skeleton. User can submit a dummy scenario via UI, see it queued, see a dummy result. No real engine logic yet.
Tasks:
✅ S0-T01 Initialize monorepo with packages/engine, packages/api, packages/web directories.
✅ S0-T02 Set up packages/engine with Poetry, Python 3.12, Ruff, mypy strict, pytest, pre-commit. Empty remodel_engine package with __init__.py exposing version.
✅ S0-T03 Set up packages/api similarly. FastAPI app with /healthz returning {"status":"ok","version":"..."}.
✅ S0-T04 Set up packages/web with create-next-app@latest --typescript --tailwind --app. Add shadcn/ui (pnpm dlx shadcn@latest init). Add Recharts, TanStack Query, Zustand.
✅ S0-T05 Create docker-compose.yml with Redis service. Add docs to README.md for docker compose up.
✅ S0-T06 Add Arq worker stub in packages/api/src/remodel_api/workers/. One dummy task run_dummy_scenario that sleeps 3s and returns {"id": ..., "result": "dummy"}.
✅ S0-T07 Add SQLAlchemy + SQLite to API. One model: Scenario (id, name, status, inputs_json, kpis_json, created_at). Alembic migration for initial schema.
✅ S0-T08 API endpoints: POST /api/scenarios (creates DB row, enqueues dummy job), GET /api/scenarios/{id} (returns row), GET /api/scenarios (list).
✅ S0-T09 SSE endpoint: GET /api/scenarios/{id}/events streaming progress from Redis pub/sub. Worker publishes {stage, pct} events.
✅ S0-T10 Frontend: home page with "New Dummy Scenario" button. Posts to API, redirects to /scenarios/[id]. Page shows status + SSE progress bar + final result.
✅ S0-T11 GitHub Actions CI: install, lint (ruff), typecheck (mypy + tsc), test (pytest + jest if any), build web. Fail on any error.
✅ S0-T12 Pre-commit hook: ruff, mypy, prettier, eslint.
✅ S0-T13 Top-level README.md with setup instructions: clone, make setup, make dev. Makefile targets for common tasks.
✅ S0-T14 OpenAPI → TypeScript types: add openapi-typescript to web package, run on dev start, output to src/app/api-types/.
Definition of Done: make dev brings up Redis, API on :8000, web on :3000, worker. Click "New Dummy Scenario" on web, see status update, see "dummy" result. CI green.
## Sprint Retro
**What worked**
- Writing API, worker, DB models, and endpoints together as one cohesive package was faster than splitting across separate commits.
- `# pragma: no cover` on SSE/lifespan (requires live Redis) kept coverage meaningful without faking infra.
- TanStack Query + EventSource pattern in the frontend is clean and composable.
**What didn't / deviations**
- Python 3.12 not installed; used Python 3.13 (superset, no regressions). `requires-python = "^3.12"` remains in pyproject.toml.
- Next.js scaffold installed v16.x (not v14 as spec says). App Router API is the same; all hooks/patterns identical.
- Alembic migrations deferred: SQLAlchemy `create_all` used for v0 (sufficient for local-first SQLite). Alembic can be wired in S1.
- `poetry add greenlet` was required as an explicit dep for SQLAlchemy async on Python 3.13.
**Carryover**
- None. All 14 tasks complete.