Thanks for looking. This is a small codebase with a few hard rules; read this once and you will not get surprised in review.
python -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements-dev.txt
python -m pytest # must be green before you startFront-ends: cd web && npm ci (ops dashboard), cd wattwise && npm ci (driver app). Node 22.
| Check | Command |
|---|---|
| Unit + full-day replay tests | python -m pytest |
| The headline number still holds | python scripts/prove.py (gate: CO₂ saving ≥ 15 %, 0 solver fallbacks) |
| End-to-end flow | uvicorn noonshift.api:app --port 8000 & then python scripts/smoke.py |
| API contract is committed | git diff --exit-code -- docs/openapi.json docs/ws-frames.json — the API regenerates both on start; run the server once and commit the diff if you changed a model |
| Front-ends lint and build | npm run lint && npm run build in web/ and wattwise/ |
Run what you touched locally before pushing. prove.py and the day replay take ~1 minute each.
- The scheduler contract is frozen.
solve(cars, site, signal, tariff, now),impact(...),price(...)keep their signatures and their dict shapes. Add keyword-only arguments with defaults, or new functions. Never change what an existing caller receives. - Every regression gets a test that fails on the old code. If the day replay found it,
tests/test_day.pygets a case; if the LP found it,tests/test_scheduler.pydoes. - Never pause a car. IEC 61851 minimum is 6 A ≈ 1.4 kW (
MIN_KW). Allocations round up, never to zero. Some EVs never resume after a pause. - Software lowers power, never raises it above hardware. The charger's own max current is the ceiling; nothing in this repo may set a limit above
p_max_kw. - scipy stays 1.14.x. 1.15's HiGHS bindings took 66 s per solve on Windows.
tests/test_perf.pytrips if the pin is lifted. - Numbers cite sources. A figure in a doc points at a reference that was actually opened, or at a script in this repo that produces it. Impact numbers are estimates, never certificates. Say "we found no product doing X", never "none exists".
- Signal and sessions must be from the same grid. California sessions ↔ CAISO signals. A signal of
kind: "average"is labelled as such everywhere it is shown. - Additive API changes only while the front-ends are being built. New optional fields, new endpoints — not renamed or removed ones.
Match the file you are in. Python: comments explain why, constants carry their unit and the reason for the value (see the top of noonshift/scheduler.py). No new dependencies for what ten lines can do. If you cut a corner deliberately, mark it # ponytail: <ceiling>, <upgrade path> so it can be found later.
- One topic per PR. Title in the imperative:
feat: per-car power cap from vehicle form. - Say what you measured. If you touched the scheduler, paste the
prove.pytable before and after. - If you changed a WebSocket frame or a REST model, say so in the PR body — both front-ends consume them.
- Fill in the template; delete sections that do not apply.
noonshift/scheduler.py |
the LP; module-level constants with their reasons at the top |
noonshift/api.py |
FastAPI app, control loop (step, resolve), fail-safe ladder (pick_mode), demo endpoints |
noonshift/sim.py |
simulated day: 1-minute clock, connectors, battery taper |
noonshift/ocpp_gateway.py |
OCPP 1.6J CSMS side and a fake charge point for tests |
noonshift/models.py |
pydantic REST bodies and WS frames — the contract with the front-ends |
scripts/ |
prove.py, fetch_data.py, smoke.py |
.docs/ |
architecture, roadmap, business, metrics, pitch |
Questions: open an issue. Security: see SECURITY.md.