Skip to content

Everyday tasks

Here are small jobs you will do often. Each one is short.

Terminal window
make test # run every test
.venv/bin/pytest agent # only the agent tests
.venv/bin/pytest backend # only the backend tests
.venv/bin/pytest agent/tests/safety -v # the six safety tests

We keep the code tidy with two tools: ruff (finds problems) and black (formats).

Terminal window
make lint # check the style
make fmt # fix the style for you

The database tables are built by migrations. A migration is a small file with steps to add or change tables. They live in backend/app/db/migrations/versions/.

To apply all migrations:

Terminal window
make migrate

When you add a new table, you add a new migration file. Give it the next number, like 0007_.... Each migration says how to go forward (upgrade) and how to undo it (downgrade).

Terminal window
make backup # save a copy of the database to ./backups
make restore-drill # practice restoring the latest backup

The restore drill is important. A backup you never test might be broken. So we practice restoring it.

A load test sends lots of traffic to see how much the server can handle. With the backend running:

Terminal window
make loadtest

It writes a report to docs/loadtest-report.md. The report says how many telemetry messages per second the server handled and how fast it replied.

The web app has an end-to-end test. It opens a real browser, signs in, and clicks through the app:

Terminal window
make e2e
Terminal window
git add -A
git commit -m "say what you changed"
git push

Write your commit message in plain words. “Fix the alert email” is better than “stuff.”