Contributing¶
Who is this page for?
Developers changing GAME’s code or docs. The repository’s CONTRIBUTING.md
is the quick reference for the contribution flow; this page is the canonical
home for the test/coverage workflow and the architectural context behind it
(the root TESTING.md is a thin pointer here).
Development setup¶
git clone https://github.com/fvergaracl/GAME.git
cd GAME
poetry install
cp .env.sample .env
poetry run alembic upgrade head
poetry run uvicorn app.main:app --reload # http://localhost:8000
Read Architecture before your first non-trivial change - the layer boundaries are enforced socially, not by the compiler, so knowing which layer owns what is how reviews go smoothly.
Where code goes¶
Change |
Lives in |
|---|---|
New HTTP endpoint |
|
Business logic |
|
New persistence query |
|
New table |
|
Wire-format change |
|
New scoring strategy |
|
New dependency wiring |
|
Testing¶
GAME uses pytest with a layered suite under tests/ and one-command
runners (they load .env for you):
Suite |
Run it |
|---|---|
Unit |
|
E2E (controlled) |
|
E2E (real infra) |
|
Load (k6) |
|
Or drive pytest directly:
poetry run pytest
poetry run pytest --cov=app --cov-branch --cov-report=html
poetry run pytest -k "test_assign_points"
Guidelines:
Every feature/fix ships with tests. Unit-test services in isolation; reserve real-infra E2E for integration behavior.
Because persistence is abstracted, services run against SQLite in tests and PostgreSQL in production - keep repository queries portable.
CI enforces quality gates on every PR: a lint job (
ruff check,black --check,isort --check-only) and the test suite with a blocking coverage gate -pytest --cov-fail-underfails the build (and the PR) when coverage drops below the floor. The threshold is set in one place,.github/workflows/coverage.yml; it is a hard gate, not an aspiration. A separate Dashboard CI job covers the React frontend, and Codecov tracks the trend.
Code style¶
Python 3.12, PEP 8. Formatting/linting is handled by Ruff, Black and isort (isort uses the
blackprofile so the two never disagree); the CI lint gate runs them in--checkmode. Install the local hooks withpre-commit installto catch the same issues before you push.Public functions and classes get Google-style docstrings - they are not decoration, they are the API reference (Codebase Reference) via
napoleon.Match the surrounding code: the codebase favors small, well-named functions, explicit dependencies, and comments that explain why (often referencing the sprint or the bug a guard prevents) rather than what.
Documentation¶
Docs are part of the product, not an afterthought. The information architecture follows the Diátaxis model - every page declares who it is for and stays in its lane:
Diátaxis type |
Purpose |
Examples here |
|---|---|---|
Tutorial |
Learning by doing |
|
How-to |
Task-oriented steps |
|
Explanation |
Understanding |
|
Reference |
Dry facts |
Configuration Reference, REST API Reference, Codebase Reference |
Where docs live¶
Location |
Content |
|---|---|
|
This Sphinx site (reStructuredText). Built to GitHub Pages on every
push to |
|
Auto-generated module reference ( |
|
DSL block reference and runbook (linked from the editor). |
|
The domain model and its rendered entity-relationship diagram
( |
Top-level |
|
Building the docs locally¶
# One-off build
poetry run sphinx-build -b html docs/source _build/html
# Live-reloading preview while you write
poetry run sphinx-autobuild docs/source _build/html
# Regenerate the module reference after adding/moving modules
.venv/bin/sphinx-apidoc -f -e -M -o docs/source/api app
Keep the build warning-clean: a broken cross-reference or an orphaned page is a bug. Add a one-line “Who is this page for?” admonition to every new page so its audience is explicit.
Submitting a change¶
Branch:
git checkout -b feature/your-feature-name.Make the change with tests and docstrings/docs.
Run the relevant test suite and the docs build locally.
Open a PR with a clear description and linked issues. CI runs tests, coverage, linting,
pip-audit(make auditlocally), and the docs build.
Report bugs and request features via GitHub Issues; discuss design in GitHub Discussions.