Thanks for taking an interest. This is a small, opinionated repository: a Supabase schema, a dependency-free Python telemetry SDK, and a Next.js frontend. Most of the friction a newcomer hits here comes from rules that already exist and are enforced by CI, so this page front-loads them.
Two documents outrank this one on matters of substance:
AGENTS.md— the permanent context of the repository: what it is, how it is laid out, and the hard rules. Read it before writing code. If something there is out of date, fix it in the same PR.docs/API.md— the contract between the database and the frontend: endpoints, types, and the closed vocabularies.
Both are written in Spanish, as are all code comments and commit subjects. Issues and pull requests in English are welcome too — see Language.
dev is the integration branch. Everything targets dev, never main.
main ← dev ← your branch
- Branch off the latest
dev:git fetch origin dev && git switch -c feature/<thing> origin/dev - Branch names in use:
feature/<thing>,fix/<thing>. - Open the pull request against
dev.mainonly ever moves by mergingdev. - Keep commits small. A commit that changes behaviour should be readable on its own.
Conventional commits, with the subject written in Spanish, in the imperative, no trailing period, ≤50 characters. The repository ships a template — turn it on once:
git config commit.template .gitmessageTypes: feat fix docs style refactor test chore perf ci revert.
Scopes actually in use in this repository: front, live, sdk, telemetry, seed,
sql, backend, contrato, vocabulario. A scope is optional; a wrong one is worse
than none.
The body explains why, not what — the diff already says what.
If the commit changes behaviour, put a number in it. This repository exists to measure improvement; a commit that claims one without evidence is the thing it was built to prevent:
feat(planner): reordena la cola por masa descendente
nivel 2: 62 % -> 81 % de bultos colocados (n=50)
Real examples from the history:
fix(live): el aviso de conexion perdida saltaba sin haberse perdido nada
feat(front): pantalla de detalle de una ejecución (#4)
refactor(front): un solo .env, el de la raiz
test(contrato): vocabulario de fallos cuadrado en los tres sitios
Footer: Closes #123, BREAKING CHANGE: ….
You need Node 22, Python 3.11+, and a Supabase project you can write to. (Docker only if you want to run the networked backend tests.)
There is exactly one credentials file: .env at the repository root. Copy the
example and fill it in from Supabase → Project Settings → Data API:
cp .env.example .envSUPABASE_URL=https://xxxxxxxxxxxx.supabase.co
SUPABASE_ANON_KEY=eyJ... # public, read-only under RLS
SUPABASE_SERVICE_KEY=eyJ... # SECRET, Python side onlyWarning
SUPABASE_SERVICE_KEY bypasses row-level security. It must never reach the
browser and never be committed. frontend/next.config.ts publishes only an explicit
whitelist of keys as NEXT_PUBLIC_*, and fails the build if a public variable's name
smells like a secret. Do not widen that whitelist. There is no
frontend/.env.local — a second copy of the same values desynchronises on its own,
and it already did once.
The schema is applied by hand, in order, from the Supabase SQL editor. All three files are idempotent, so pasting one again is safe:
| File | What it adds |
|---|---|
backend/sql/001_schema.sql |
tables, views, RLS |
backend/sql/002_design.sql |
the columns and views the design needs |
backend/sql/003_snapshots.sql |
pallet snapshots (URLs; the PNGs live in Storage) |
./dev.shdev.sh checks the credentials, installs the SDK into .venv if it is missing, runs
npm ci when package-lock.json is newer than node_modules, probes the live schema
for the specific columns the frontend queries, and then starts the dev server on
http://localhost:3000.
./dev.sh --check # verify only, start nothing
./dev.sh --seed # seed sample data firstThat schema probe is the point of the script: the SQL is pasted by hand, so it is normal for the repository to run ahead of the database. Discovering that in front of an audience is the expensive failure.
If the project is empty, the generators under backend/seed/ will fill it — see
Sample data in the README.
Run both before you push. CI runs exactly these, so a red result here is a red PR.
# Frontend
cd frontend && npm ci && npm run lint && npm run build
# Backend
pip install -e './backend[dev]'
ruff check backend
pytest backend -qpytest backend -q touches no network. Export DATABASE_URL pointing at a throwaway
Postgres and it additionally applies the real schema and verifies the contract against
the frontend's queries (backend/tests/test_contrato.py) — which is what CI does:
docker run --rm -d --name pg -e POSTGRES_PASSWORD=postgres -p 5433:5432 postgres:16
export DATABASE_URL=postgresql://postgres:postgres@localhost:5433/postgres
pytest backend -q.github/workflows/ci.yml runs on every push and every pull
request, in two jobs:
- backend — Python 3.11 with a
postgres:16service, thenruff check backendandpytest backend -qwithDATABASE_URLset, so the schema tests really run. - frontend — Node 22,
npm ci,npm run lint,npm run build. It isbuildand nottsc --noEmiton purpose: Next 16 generates thePageProps<'/runs/[id]'>types during the build, so only a build catches a route typed against them.
eslint && node scripts/check-colors.mjs && node scripts/check-contrast.mjs
The two project-specific ones fail more often than eslint does:
check-colors.mjs— no colour literals anywhere outsidefrontend/styles/colors.css. It catches#hex,rgb()/rgba(),hsl()/hsla(),hwb(),lab()/lch(),oklab()/oklch(), and named colours used as a value, in CSS, TS and TSX alike.transparent,currentColorandinheritare allowed — they are not a specific colour. Run it alone withnpm run lint:colors.check-contrast.mjs— WCAG contrast on every colour pair that carries text, in both themes: 4.5:1 for text, 3:1 for meaningful graphical elements. A grey that looks fine on the laptop it was picked on may not be readable on a projector. Run it alone withnpm run lint:contrast.
These are the ones a review will bounce you for. The reasoning behind each is in
AGENTS.md §4 and §7 — this is the checklist.
No Tailwind. The design is exact values in docs/design/; restating them as
utilities adds noise where there is no decision to make. Components use CSS Modules
next to the component.
Colours only as variables, defined in one file. frontend/styles/colors.css holds
every colour for both themes. No other file — CSS, TS, or TSX — carries a literal; they
consume var(--…). A translucent colour is another variable in that same file, derived
from the base with color-mix. Enforced by check-colors.mjs.
No server between the frontend and Supabase. PostgREST, RLS and Realtime are the backend. One more process is one more thing that falls over at 3am.
Never put service_role in the frontend. It bypasses RLS.
No dependencies without a reason. The Python SDK has none on purpose: it speaks
PostgREST with urllib from the standard library. Keep it that way — it is imported by
the simulation repositories, and every package it grows is a package they inherit.
Units are always visible, and converted in one place. The database stores SI
(metres, radians, seconds); the screen shows millimetres and degrees. That conversion
lives only in frontend/lib/ui.ts. 4.1 mm, never 4.1.
Never show a raw failure identifier. stack_collapse reads as «el montón se
derrumbó». The translation is FAILURE_TEXT in frontend/lib/ui.ts.
Don't compute in the client what a view can compute. Totals, medians and dominant causes come out of the SQL views. Two places summing the same thing eventually disagree.
Medians, not means. One episode that collapses at 3 s drags the mean cycle time down and makes a bad run look fast.
Synthetic and oracle data never share a comparison with measured data. runs.oracle
and runs.synthetic are drawn with a diagonal hatch, and comparability() in
frontend/lib/supabase.ts blocks the delta outright. A pretty, false chart is exactly
what an evaluator will find.
The vocabulary is closed. A new one means touching three places:
FAILURESinbackend/theker_telemetry/schema.py- the
CHECKonepisodes.failureinbackend/sql/001_schema.sql FAILURE_TEXTinfrontend/lib/ui.ts
Skip the second and the episode writes to disk fine while the upload fails wholesale —
nobody notices until the interface is empty. You no longer have to remember:
backend/tests/test_vocabulario.py compares all three and fails if one lags behind.
- Code identifiers: English.
- Comments, documentation and commit subjects: Spanish.
README.md,CONTRIBUTING.mdandLICENSE: English — they are the public face of the repository.- Issues and pull requests: either. Write in whichever you are clearer in.
That file is written and re-added by next dev itself (see
node_modules/next/dist/server/lib/generate-agent-files.js). Deleting it from a diff
only recreates the uncommitted change; commit it with your work to keep the tree clean.
By contributing you agree that your contributions are licensed under the MIT License.