Everyday tasks
Here are small jobs you will do often. Each one is short.
Run the tests
Section titled “Run the tests”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 testsCheck and fix the code style
Section titled “Check and fix the code style”We keep the code tidy with two tools: ruff (finds problems) and black (formats).
make lint # check the stylemake fmt # fix the style for youChange the database
Section titled “Change the database”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:
make migrateWhen 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).
Back up the database
Section titled “Back up the database”make backup # save a copy of the database to ./backupsmake restore-drill # practice restoring the latest backupThe restore drill is important. A backup you never test might be broken. So we practice restoring it.
Run a load test
Section titled “Run a load test”A load test sends lots of traffic to see how much the server can handle. With the backend running:
make loadtestIt 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.
Run the web app’s full test
Section titled “Run the web app’s full test”The web app has an end-to-end test. It opens a real browser, signs in, and clicks through the app:
make e2eSave your work
Section titled “Save your work”git add -Agit commit -m "say what you changed"git pushWrite your commit message in plain words. “Fix the alert email” is better than “stuff.”