Development Checks
What you'll do
Run the same quality gates locally that Craik runs in CI on every pull
request and push to main. By the end you'll have a tight inner loop:
tests, linting, type-checking, and the policy contract — all reproducible.
Prerequisites
- Python 3.12 or newer (
python3 --version). - A local checkout of the Craik repo with the
devextras installed. uvrecommended (but not required) for reproducible, hermetic command runs.
git clone https://github.com/eidetic-labs/craik.git
cd craik
python3 -m pip install -e ".[dev]"
The four core gates
pytest
Unit, contract, and integration tests. Covers runtime contracts, case-file assembly, policy gates, receipt redaction, handoff structure, and provider adapters.
ruff check
Lints style, imports, and a curated set of correctness rules. Runs in under a second on the full repo.
mypy
Strict type-checking. Craik runtime contracts are Pydantic models — keep them honest.
craik policy test
Exercises the policy contract: strict defaults, immutable path behavior, memory proposal defaults, fail-open receipts, automation fail-closed behavior, and redaction.
Run them with uv (recommended)
uv run resolves a per-invocation Python environment, so the command runs
the same way locally as in CI.
uv run --python 3.12 --extra dev pytest
uv run --python 3.12 --extra dev ruff check .
uv run --python 3.12 --extra dev mypy
uv run --python 3.12 --extra dev craik policy test
Run them with the venv you already have
If you installed the dev extras into a virtual environment, just call the tools directly:
pytest
ruff check .
mypy
craik policy test
Useful narrower runs
pytest -k case_fileRun only the case-file-related tests.
pytest tests/test_docs.py -xRun just the docs tests (link resolution, required coverage). Stops on first failure.
ruff check src/craik/runtimeLint just one subtree — useful when iterating on a module.
mypy src/craik/policyType-check one package at a time.
What CI runs
The CI workflow (.github/workflows/ci.yml) runs the same four gates plus
a quickstart smoke test (python scripts/quickstart_smoke.py) and the
Docusaurus build (docs/). If your local sweep is green, the chances of
CI surprising you on a vanilla change are low.
What to do when a gate fails
Tests failing
- Re-run with
pytest -x -vvvto stop at first failure with full output. - Use
pytest --lfafter a fix to re-run only the last failures. - Snapshot mismatches in contract tests usually mean a schema changed — update the matching fixture deliberately.
Lint / type failing
ruff check . --fixhandles the autofixable cases.mypyerrors that look mysterious are almost always a missing or wrong type hint on a runtime contract — start there.- Don't disable a rule to make CI green without a comment justifying why.