Skip to content

Testing & Debugging

Oliver Hennhöfer edited this page Apr 7, 2026 · 9 revisions

Testing & Debugging

This page is the operational test and triage playbook for the current stack.

When To Use This Page

Use this page when validating local changes, checking runtime health, or diagnosing user-facing failures across API, telemetry, and monitoring.

Audience

  • Developers debugging service behavior.
  • Operators triaging incidents in local/cluster-like environments.

Test Commands

Backend

From project-code/backend:

uv run python -m ruff check .
uv run python -m pytest -q

Expected result: lint exits 0; tests complete with no failures.

Frontend

From project-code/frontend:

npm run lint
npm run test

Expected result: no lint errors and passing test suite.

Repository pre-commit gate

From project-code/:

pre-commit run --all-files

Expected result: all enabled hooks pass.

Runtime Health Checks

API Gateway

curl http://localhost:8000/health

Expected result: 200 and healthy/liveness payload.

TACTIC Middleware

curl http://localhost:8001/health
curl http://localhost:8001/ready

Expected result: liveness 200; readiness confirms Docker API + model registry are ready.

MQTT Proxy (inside container)

docker compose exec mqtt-proxy wget -qO- http://localhost:8010/health
docker compose exec mqtt-proxy wget -qO- http://localhost:8010/ready/bridge

Expected result: liveness is healthy; bridge readiness reflects configured bridge mode.

DB Sync (inside container)

docker compose exec db-sync wget -qO- http://localhost:8009/health
docker compose exec db-sync wget -qO- http://localhost:8009/ready/schema

Expected result: service healthy and schema ready.

Log Inspection

Tail critical services:

docker compose logs -f api-gateway tactic-middleware db-sync mqtt-proxy mqtt-radar

Focused last-lines checks:

docker compose logs --tail 200 api-gateway
docker compose logs --tail 200 tactic-middleware
docker compose logs --tail 200 mqtt-proxy
docker compose logs --tail 200 db-sync

Debug Flows By Symptom

Frontend loads but charger data is empty/failing

  1. Confirm frontend API target:
# verify VITE_API_URL in active run mode
  1. Check gateway liveness:
curl http://localhost:8000/health
  1. Check TACTIC readiness:
curl http://localhost:8001/ready
  1. Inspect gateway logs for upstream failures.

Monitoring start fails from UI/API

  1. Confirm model registry endpoints are populated:
curl http://localhost:8000/v1/monitors/models
curl http://localhost:8000/v1/monitors/preprocessors
  1. Confirm TACTIC readiness.
  2. Inspect TACTIC logs for Docker API, registry validation, or orchestration failures.

Telemetry not arriving

  1. Verify source publisher (or simulator) is active.
  2. Check proxy health/readiness endpoints.
  3. Inspect proxy logs for topic regex/parse errors or DB write failures.
  4. Verify DB/service path using telemetry endpoints.

Anomalies missing despite telemetry

  1. Verify monitor workload exists:
curl http://localhost:8000/v1/monitors/all
  1. Confirm workload config/model is valid and warmed up.
  2. Check anomaly endpoints:
curl http://localhost:8000/v1/anomalies/count
  1. Inspect RADAR logs for model/runtime errors.

Service Ports (Local Default)

Component Host Port
Frontend 5173
API Gateway 8000
TACTIC Middleware 8001
DB Sync 8009
MQTT Proxy 8010 (internal health)
PostgreSQL/TimescaleDB 5432
MQTT (EMQX) 1883
Source broker (host loopback) 1884
EMQX Dashboard 18083
Mailpit UI / SMTP 8025 / 1025

Related Pages

Clone this wiki locally