From 5a93559b79bbe48419790bb2ec250183e428b8f7 Mon Sep 17 00:00:00 2001 From: emil Date: Sun, 5 Jul 2026 15:07:03 +0000 Subject: [PATCH] GRM-132: ci: bump devx to 0.33.0, use devx-check-api-identity-checks --- .devin/skills/testing-and-debugging/SKILL.md | 21 ++++++++++++++++++++ .gitea/workflows/ci.yml | 2 +- AGENTS.md | 17 ++++++++++++++++ Makefile | 7 +++++-- pyproject.toml | 4 ++-- 5 files changed, 46 insertions(+), 5 deletions(-) diff --git a/.devin/skills/testing-and-debugging/SKILL.md b/.devin/skills/testing-and-debugging/SKILL.md index 450c9ed..ff89c1a 100644 --- a/.devin/skills/testing-and-debugging/SKILL.md +++ b/.devin/skills/testing-and-debugging/SKILL.md @@ -69,3 +69,24 @@ source activate.zsh # zsh ``` If `.venv` doesn't exist, run `make setup` first. + +## Common Pitfalls + +### Coverage Verification Before Push + +**Always run `make pytest-cov` before pushing** — CI enforces 100% +coverage and will fail the PR if any lines are uncovered. This is the +most common cause of CI quality job failures after code changes. The +pre-push git hook only validates Vikunja task existence, not tests. + +### API Response Type Checking + +Never use `is True`/`is False` identity checks on API response values. +Many APIs return boolean values as strings (`"true"`/`"false"`). Use +string comparison or truthy/falsy helpers instead. + +### Time Mocking in Tests + +Always mock `time.sleep` and `time.monotonic` in unit tests using +`@patch` decorators. Real sleep calls make tests slow and exceed test +speed limits. diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 6d90ca8..03e2fe5 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: env: CI_GITEA_TOKEN: ${{ secrets.CI_GITEA_TOKEN }} CI_GITEA_USERNAME: ${{ vars.CI_GITEA_USERNAME }} - run: make setup-image EXTRAS=lint + run: make setup-image EXTRAS=ci,lint - name: Lint all run: | . .venv/bin/activate 2>/dev/null || true diff --git a/AGENTS.md b/AGENTS.md index 3d351cc..39380f1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -433,6 +433,23 @@ Change classification is config-driven via `[tool.devx.classify]` in `pyproject. - Secrets are passed via temp JSON files, never on the command line (CWE-214) - CI triggers only on `opened` and `synchronize` PR events (not `labeled`) +### Testing Conventions + +- **Always run `make pytest-cov` before pushing** — CI enforces 100% + coverage and will fail the PR if any lines are uncovered. The pre-push + hook only validates Vikunja task existence, not tests. +- **Never use `is True`/`is False` identity checks on API response + values** — many APIs return boolean values as strings (`"true"`/ + `"false"`). Use string comparison or truthy/falsy helpers instead. +- **Always mock `time.sleep` and `time.monotonic` in unit tests** — real + sleep calls make tests slow and exceed test speed limits. Use + `@patch("time.sleep")` and `@patch("time.monotonic")` decorators. +- **Extract complex inline shell from workflows to tested Python tools** + — SSH loops, curl polling, docker exec chains, and multi-line + if/then/else shell blocks should be Python scripts in `scripts/` + with unit tests. Simple variable checks and venv activation are fine + as inline shell. + ### Container-Level Fix Verification (Mandatory) **Rule:** Before pushing any fix that modifies container state (CA certs, diff --git a/Makefile b/Makefile index a8bdc4d..a8a5246 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all setup setup-ci setup-quality setup-molecule setup-release setup-image install update lint ansible-lint makefile-lint lint-all lint-ruff lint-format lint-bandit lint-deps typecheck checkmake install-hooks test test-unit pytest-cov molecule molecule-all test-all clean workflow-lint workflow-dryrun workflow-check install-tools +.PHONY: all setup setup-ci setup-quality setup-molecule setup-release setup-image install update lint ansible-lint makefile-lint lint-all lint-ruff lint-format lint-bandit lint-deps typecheck checkmake install-hooks test test-unit pytest-cov molecule molecule-all test-all clean workflow-lint workflow-dryrun workflow-check install-tools check-api-identity-checks .PHONY: configure-gitea-pypi .PHONY: create-task create-pr push-with-pr git-push @@ -173,7 +173,10 @@ makefile-lint: echo "checkmake not found, skipping Makefile lint"; \ fi -lint-all: lint ansible-lint makefile-lint workflow-lint +lint-all: lint ansible-lint makefile-lint workflow-lint check-api-identity-checks + +check-api-identity-checks: + @$(BIN)/python -m devx.tools.check_api_identity_checks test-integration: $(BIN)/pytest tests/integration/ -v --no-cov diff --git a/pyproject.toml b/pyproject.toml index b5f9341..9f74981 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ ci = [ "build==1.5.0", "twine==6.2.0", # Reusable CI/CD and dev tools (auto-merge, pr-review, pre-push checks, etc.) - "devx==0.32.0", + "devx==0.33.1", ] # Lint and type-checking tools (quality job) lint = [ @@ -54,7 +54,7 @@ molecule = [ dev = [ "gitea-runner-manager[ci,lint,molecule]", # Reusable CI/CD and dev tools (pre-push hooks, create-task, create-pr) - "devx==0.32.0", + "devx==0.33.1", # Non-Python dev dependency: checkmake (Makefile linter) # Install via: go install github.com/checkmake/checkmake/cmd/checkmake@latest ]