forked from Rockachopa/Timmy-time-dashboard
* polish: streamline nav, extract inline styles, improve tablet UX - Restructure desktop nav from 8+ flat links + overflow dropdown into 5 grouped dropdowns (Core, Agents, Intel, System, More) matching the mobile menu structure to reduce decision fatigue - Extract all inline styles from mission_control.html and base.html notification elements into mission-control.css with semantic classes - Replace JS-built innerHTML with secure DOM construction in notification loader and chat history - Add CONNECTING state to connection indicator (amber) instead of showing OFFLINE before WebSocket connects - Add tablet breakpoint (1024px) with larger touch targets for Apple Pencil / stylus use and safe-area padding for iPad toolbar - Add active-link highlighting in desktop dropdown menus - Rename "Mission Control" page title to "System Overview" to disambiguate from the chat home page - Add "Home — Timmy Time" page title to index.html https://claude.ai/code/session_015uPUoKyYa8M2UAcyk5Gt6h * fix(security): move auth-gate credentials to environment variables Hardcoded username, password, and HMAC secret in auth-gate.py replaced with os.environ lookups. Startup now refuses to run if any variable is unset. Added AUTH_GATE_SECRET/USER/PASS to .env.example. https://claude.ai/code/session_015uPUoKyYa8M2UAcyk5Gt6h * refactor(tooling): migrate from black+isort+bandit to ruff Replace three separate linting/formatting tools with a single ruff invocation. Updates tox.ini (lint, format, pre-push, pre-commit envs), .pre-commit-config.yaml, and CI workflow. Fixes all ruff errors including unused imports, missing raise-from, and undefined names. Ruff config maps existing bandit skips to equivalent S-rules. https://claude.ai/code/session_015uPUoKyYa8M2UAcyk5Gt6h --------- Co-authored-by: Claude <noreply@anthropic.com>
170 lines
6.4 KiB
INI
170 lines
6.4 KiB
INI
[tox]
|
|
envlist = lint, unit, integration
|
|
no_package = true
|
|
|
|
# ── Base ─────────────────────────────────────────────────────────────────────
|
|
[testenv]
|
|
allowlist_externals = timeout, perl, docker, mkdir, bash, grep
|
|
commands_pre = pip install -e ".[dev]" --quiet
|
|
|
|
setenv =
|
|
TIMMY_TEST_MODE = 1
|
|
TIMMY_DISABLE_CSRF = 1
|
|
TIMMY_SKIP_EMBEDDINGS = 1
|
|
|
|
# ── Lint & Format ────────────────────────────────────────────────────────────
|
|
|
|
[testenv:lint]
|
|
description = Check formatting, imports, security (ruff), no inline CSS
|
|
commands_pre =
|
|
deps =
|
|
ruff>=0.8.0
|
|
commands =
|
|
ruff check src/ tests/
|
|
ruff format --check src/ tests/
|
|
bash -c 'files=$(grep -rl "<style" src/dashboard/templates/ --include="*.html" 2>/dev/null); if [ -n "$files" ]; then echo "ERROR: inline <style> blocks found — move CSS to static/css/mission-control.css:"; echo "$files"; exit 1; fi; echo "No inline CSS — OK"'
|
|
|
|
[testenv:format]
|
|
description = Auto-format code with ruff
|
|
commands_pre =
|
|
deps =
|
|
ruff>=0.8.0
|
|
commands =
|
|
ruff check --fix src/ tests/
|
|
ruff format src/ tests/
|
|
|
|
[testenv:typecheck]
|
|
description = Static type checking with mypy
|
|
commands =
|
|
mypy src --ignore-missing-imports --no-error-summary
|
|
|
|
# ── Test Environments ────────────────────────────────────────────────────────
|
|
|
|
[testenv:unit]
|
|
description = Fast tests — excludes e2e, functional, and external services
|
|
commands =
|
|
pytest tests/ -q --tb=short \
|
|
--ignore=tests/e2e \
|
|
--ignore=tests/functional \
|
|
-m "not ollama and not docker and not selenium and not external_api and not skip_ci" \
|
|
-n auto --dist worksteal
|
|
|
|
[testenv:integration]
|
|
description = Integration tests (marked with @pytest.mark.integration)
|
|
commands =
|
|
pytest tests/ -q --tb=short \
|
|
-m "integration and not ollama and not docker and not selenium and not external_api" \
|
|
-n auto --dist worksteal
|
|
|
|
[testenv:functional]
|
|
description = Functional tests — real HTTP, no mocking (excl slow + selenium)
|
|
commands =
|
|
pytest tests/functional/ -q --tb=short -n0 \
|
|
-m "not slow and not selenium"
|
|
|
|
[testenv:e2e]
|
|
description = End-to-end tests — full system, may be slow
|
|
commands =
|
|
pytest tests/e2e/ -q --tb=short -n0
|
|
|
|
[testenv:fast]
|
|
description = All tests except e2e, functional, and external
|
|
commands =
|
|
pytest tests/ -q --tb=short \
|
|
--ignore=tests/e2e \
|
|
--ignore=tests/functional \
|
|
-m "not ollama and not docker and not selenium and not external_api" \
|
|
-n auto --dist worksteal
|
|
|
|
[testenv:ollama]
|
|
description = Live LLM tests via Ollama (requires running Ollama)
|
|
commands =
|
|
pytest tests/ -q --tb=short -m ollama --timeout=120
|
|
|
|
# ── CI / Coverage ────────────────────────────────────────────────────────────
|
|
|
|
[testenv:ci]
|
|
description = CI test suite with coverage + JUnit XML (mirrors GitHub Actions)
|
|
commands =
|
|
mkdir -p reports
|
|
pytest tests/ \
|
|
--cov=src \
|
|
--cov-report=term-missing \
|
|
--cov-report=xml:reports/coverage.xml \
|
|
--cov-fail-under=73 \
|
|
--junitxml=reports/junit.xml \
|
|
-p no:xdist \
|
|
-m "not ollama and not docker and not selenium and not external_api"
|
|
|
|
[testenv:coverage]
|
|
description = Full coverage report (terminal + XML)
|
|
commands =
|
|
pytest tests/ -q --tb=short \
|
|
--cov=src \
|
|
--cov-report=term-missing \
|
|
--cov-report=xml \
|
|
--cov-fail-under=73 \
|
|
-p no:xdist \
|
|
-m "not ollama and not docker and not selenium and not external_api"
|
|
|
|
[testenv:coverage-html]
|
|
description = Coverage with HTML report
|
|
commands =
|
|
pytest tests/ -q --tb=short \
|
|
--cov=src \
|
|
--cov-report=term-missing \
|
|
--cov-report=html \
|
|
--cov-fail-under=73 \
|
|
-p no:xdist \
|
|
-m "not ollama and not docker and not selenium and not external_api"
|
|
|
|
# ── Pre-push (mirrors CI exactly) ────────────────────────────────────────────
|
|
|
|
[testenv:pre-push]
|
|
description = Local gate — lint + full CI suite (same as GitHub Actions)
|
|
deps =
|
|
ruff>=0.8.0
|
|
commands =
|
|
ruff check src/ tests/
|
|
ruff format --check src/ tests/
|
|
bash -c 'files=$(grep -rl "<style" src/dashboard/templates/ --include="*.html" 2>/dev/null); if [ -n "$files" ]; then echo "ERROR: inline <style> blocks found — move CSS to static/css/mission-control.css:"; echo "$files"; exit 1; fi; echo "No inline CSS — OK"'
|
|
mkdir -p reports
|
|
pytest tests/ \
|
|
--cov=src \
|
|
--cov-report=term-missing \
|
|
--cov-report=xml:reports/coverage.xml \
|
|
--cov-fail-under=73 \
|
|
--junitxml=reports/junit.xml \
|
|
-p no:xdist \
|
|
-m "not ollama and not docker and not selenium and not external_api"
|
|
|
|
# ── Pre-commit (fast local gate) ────────────────────────────────────────────
|
|
|
|
[testenv:pre-commit]
|
|
description = Fast pre-commit gate — format check + unit tests (30s budget)
|
|
deps =
|
|
ruff>=0.8.0
|
|
commands =
|
|
ruff check src/ tests/
|
|
ruff format --check src/ tests/
|
|
pytest tests/ -q --tb=short \
|
|
--ignore=tests/e2e \
|
|
--ignore=tests/functional \
|
|
-m "not ollama and not docker and not selenium and not external_api and not skip_ci" \
|
|
-n auto --dist worksteal
|
|
|
|
# ── Dev Server ───────────────────────────────────────────────────────────────
|
|
|
|
[testenv:dev]
|
|
description = Start dashboard with auto-reload (local development)
|
|
commands =
|
|
uvicorn dashboard.app:app --reload --host 0.0.0.0 --port 8000 \
|
|
--reload-exclude ".claude"
|
|
|
|
# ── All Tests (parallel) ─────────────────────────────────────────────────────
|
|
|
|
[testenv:all]
|
|
description = Run all tests in parallel
|
|
commands =
|
|
pytest tests/ -q --tb=short -n auto --dist worksteal
|