From e9fe18266d68231006f886777bdafd6ca5c33e57 Mon Sep 17 00:00:00 2001 From: patrick Date: Mon, 17 Aug 2026 20:56:24 -0400 Subject: [PATCH] feat: lint and format tests in CI Only src/ was covered, which is why it stayed clean while tests/ drifted to 38 findings. migrations/ stays out: its alembic template emits unused imports, so every generated revision would fail the gate. --- .gitea/workflows/ci.yml | 4 ++-- .gitea/workflows/release.yml | 4 ++-- AGENTS.md | 12 +++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 3c8bd7d..607be30 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -37,10 +37,10 @@ jobs: run: uv sync --locked - name: Format - run: uv run ruff format --check src/ + run: uv run ruff format --check src/ tests/ - name: Lint - run: uv run ruff check src/ + run: uv run ruff check src/ tests/ # pytest-databases starts a throwaway PostgreSQL container, so this needs a working # Docker daemon on the runner — the same requirement the release workflow has. diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 948b6f2..96cc819 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -42,8 +42,8 @@ jobs: working-directory: backend run: | uv sync --locked - uv run ruff format --check src/ - uv run ruff check src/ + uv run ruff format --check src/ tests/ + uv run ruff check src/ tests/ uv run pytest tests/ -q - uses: actions/setup-node@v4 diff --git a/AGENTS.md b/AGENTS.md index 86d50e2..4fa66ce 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -70,7 +70,7 @@ Backend (from `backend/`): ```bash uv run litestar --app-dir src/chitai/ run --reload # dev server on :8000 pytest tests/ # needs Docker (pytest-databases) -ruff format src/ +ruff format src/ tests/ alchemy --config chitai.database.config.config make-migrations alchemy --config chitai.database.config.config upgrade @@ -104,10 +104,12 @@ API docs are served by the running backend at `http://localhost:8000/schema/` (S - **Migrations are mandatory.** The app runs with `create_all=False`, so a model change without a matching Alembic revision will not reach the database. - **CI gates formatting, linting, types and tests.** `.gitea/workflows/ci.yml` runs on every push - and pull request: `ruff format --check`, `ruff check`, `pytest`, `prettier --check` and - `pnpm check` all **block**; only `eslint` reports without failing, and only until the two - `{@html}` findings in `TODO.md` are fixed. A `v*` tag additionally builds and publishes both - container images — see `docs/ci-release-pipeline.md`. + and pull request: `ruff format --check src/ tests/`, `ruff check src/ tests/`, `pytest`, + `prettier --check` and `pnpm check` all **block**; only `eslint` reports without failing, and + only until the two `{@html}` findings in `TODO.md` are fixed. Ruff covers `src/` and `tests/` + but deliberately not `migrations/`, whose alembic template emits imports it does not use. A + `v*` tag additionally builds and publishes both container images — see + `docs/ci-release-pipeline.md`. - **Commit messages** follow `type: summary` — `feat:`, `fix:`, `refactor:`, `chore:`. - The three `README.md` files are user-facing. Agent-facing knowledge belongs in the `AGENTS.md` files.