diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..7a10a5c44 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + +permissions: + contents: read + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Type-check & test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false + + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: '3.12' + + - uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2 + with: + enable-cache: true + + - name: Install dependencies + run: uv sync --frozen + + # pre-commit.ci already runs ruff and bandit, but it cannot run the + # `language: system` mypy hook (see .pre-commit-config.yaml `skip:`), + # so mypy runs here instead. + - name: Type-check with mypy + run: uv run mypy strix/ + + - name: Run tests + run: uv run pytest -q diff --git a/AGENTS.md b/AGENTS.md index ab3fd988d..733b2df20 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -63,7 +63,7 @@ Target-specific workflows built on the same engine: - Python 3.12+, managed with `uv`. Install dev deps: `make dev-install`. - Lint/format/type-check/security, all in one: `make check-all` (ruff, mypy, bandit). -- Tests: `uv run pytest`. +- Tests: `make test` (or `uv run pytest`). Included in `make check-all`. - Run from source: `uv run strix --target `. - Layout: `strix/agents` (agent graph + prompts), `strix/tools` (proxy, browser, terminal, scanners), `strix/runtime` (Docker sandbox), `strix/report` (findings, SARIF), `strix/skills` (internal knowledge packs the pentest agents load โ€” different from the consumer skills in `skills/`), `strix/interface` (CLI/TUI), `containers/` (sandbox image). - Pre-commit hooks: `make pre-commit` (or `uv run pre-commit install`). diff --git a/Makefile b/Makefile index 05038f799..14c42af95 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: help install dev-install format lint type-check security check-all clean pre-commit setup-dev dev viewer wheel tui-build tui-test tui-lint +.PHONY: help install dev-install format lint type-check security test check-all clean pre-commit setup-dev dev viewer wheel tui-build tui-test tui-lint TUI_BINARY := build/sidecar/strix-tui$(if $(filter Windows_NT,$(OS)),.exe) @@ -13,6 +13,7 @@ help: @echo " lint - Lint code with ruff" @echo " type-check - Run type checking with mypy and pyright" @echo " security - Run security checks with bandit" + @echo " test - Run the test suite with pytest" @echo " check-all - Run all code quality checks" @echo "" @echo "Development:" @@ -57,7 +58,12 @@ security: uv run bandit -r strix/ -c pyproject.toml @echo "โœ… Security checks complete!" -check-all: format lint type-check security +test: + @echo "๐Ÿงช Running tests with pytest..." + uv run pytest + @echo "โœ… Tests complete!" + +check-all: format lint type-check security test @echo "โœ… All code quality checks passed!" pre-commit: diff --git a/tests/test_pricing.py b/tests/test_pricing.py index c9e9e5dfb..e8e2db977 100644 --- a/tests/test_pricing.py +++ b/tests/test_pricing.py @@ -13,7 +13,14 @@ def test_resolves_common_bare_model_names() -> None: resolve_litellm_model.cache_clear() assert resolve_litellm_model("deepseek-v4-flash") == "deepseek/deepseek-v4-flash" assert resolve_litellm_model("openai/deepseek-v4-flash") == "deepseek/deepseek-v4-flash" - assert resolve_litellm_model("grok-4.5") == "xai/grok-4.5" + # Several providers resell grok-4.5 at identical prices, so the resolver is + # free to return any of them (it only declines to guess when prices differ). + # Assert the contract -- a provider-qualified name LiteLLM can price -- rather + # than which equally-priced entry happens to sort first. + resolved_grok = resolve_litellm_model("grok-4.5") + assert resolved_grok is not None + assert resolved_grok.endswith("/grok-4.5") + assert resolved_grok in litellm.model_cost # MiniMax-M3 is sold by several LiteLLM providers at different prices, so # the resolver must not guess from its bare name. A provider-qualified # model remains deterministic.