ci: add local pre-push gate (ruff + mypy + pytest)

Forgejo Actions is not enabled on the instance, so run the same checks
locally before pushing:

- scripts/check.sh runs ruff, mypy, and pytest (mirrors the CI workflow).
- .githooks/pre-push invokes it; enable per clone with
  `git config core.hooksPath .githooks`. Bypass with `git push --no-verify`.
- Fix the pytest invocation in the CI workflow (and document it): use
  `python -m pytest` so the repo root is on sys.path, otherwise the test
  modules fail to `import tests.*`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-07-07 10:48:57 +02:00
commit b6e99eed41
4 changed files with 69 additions and 2 deletions

View file

@ -157,9 +157,22 @@ Für Details siehe [`docs/SECURITY_AND_OPERATIONS.md`](docs/SECURITY_AND_OPERATI
```bash
pip install -e ".[dev]"
pytest -q
python -m pytest -q
```
`python -m pytest` (statt des `pytest`-Skripts) legt das Repo-Root auf
`sys.path`, damit die Testmodule `import tests.*` auflösen.
**Lokales CI-Gate:** `scripts/check.sh` bündelt `ruff` + `mypy` + `pytest`
(spiegelt `.forgejo/workflows/ci.yml`). Als Pre-Push-Hook aktivieren — er
blockt einen Push bei Fehlern:
```bash
git config core.hooksPath .githooks # einmalig pro Clone
```
Einen einzelnen Push im Notfall umgehen: `git push --no-verify`.
Die Test-Suite deckt die Prompt-Eingabeschicht (Datei- und URL-Quellen inkl.
SSRF-Abwehr mit gemockter DNS-Auflösung und DNS-Pinning), die
Konfigurationsauflösung (inkl. `${ENV}`-Expansion), die CLI-Validierung, die