Files
Timmy-time-dashboard/tox.ini
Alexander Whitestone 1191ea2f9a Claude/fix tick engine v16wt (#165)
* fix: wire up tick engine scheduler + add journal + systemd timer

The ThinkingEngine was fully implemented but never called — the background
scheduler was lost during the Celery removal in #133. This commit:

- Add _thinking_scheduler() to dashboard lifespan (5-min cycle)
- Add _write_journal() that appends thoughts to data/journal/YYYY-MM-DD.md
- Add `timmy tick` CLI command for one-shot thinking (systemd-friendly)
- Add deploy/timmy-tick.{service,timer} systemd units

https://claude.ai/code/session_013e7upfJ6negFzu5YNJikge

* Add macOS launchd plist for Timmy tick timer

Equivalent of the existing systemd service/timer for Linux.
Runs `timmy tick` every 5 minutes via launchd on macOS.

https://claude.ai/code/session_013e7upfJ6negFzu5YNJikge

* fix: make macOS launchd timer work with user-local paths

The plist had hardcoded /opt/timmy paths that don't exist on Mac.
Now uses a template with __PROJECT_DIR__ placeholders, a wrapper
script for PATH setup, and an install script that wires it all up.

Usage: ./deploy/install-mac-timer.sh

https://claude.ai/code/session_013e7upfJ6negFzu5YNJikge

* fix: add missing tox pre-commit env + pre-push hook to prevent broken builds

RCA: the pre-commit hook referenced `tox -e pre-commit` which didn't
exist in tox.ini, so commits went unchecked. There was also no
pre-push hook, so broken code could reach GitHub without running
the CI-mirror suite.

- Add [testenv:pre-commit] to tox.ini (format check + unit tests)
- Add .githooks/pre-push that runs `tox -e pre-push` (full CI mirror)

https://claude.ai/code/session_013e7upfJ6negFzu5YNJikge

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-11 10:19:46 -04:00

177 lines
6.8 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 (black), import order (isort), security (bandit), no inline CSS
commands_pre =
deps =
black
isort
bandit>=1.8.0
commands =
black --check --line-length 100 src/ tests/
isort --check-only --profile black --line-length 100 src/ tests/
bandit -r src/ -ll -s B101,B104,B307,B310,B324,B601,B608 -q
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 black + isort
commands_pre =
deps =
black
isort
commands =
black --line-length 100 src/ tests/
isort --profile black --line-length 100 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 =
black
isort
bandit>=1.8.0
commands =
black --check --line-length 100 src/ tests/
isort --check-only --profile black --line-length 100 src/ tests/
bandit -r src/ -ll -s B101,B104,B307,B310,B324,B601,B608 -q
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 =
black
isort
commands =
black --check --line-length 100 src/ tests/
isort --check-only --profile black --line-length 100 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
# ── All Tests (parallel) ─────────────────────────────────────────────────────
[testenv:all]
description = Run all tests in parallel
commands =
pytest tests/ -q --tb=short -n auto --dist worksteal