Testing & debugging¶
Unit tests (no AWS)¶
Tests stub fs_config and fs_obs in tests/conftest.py before any pipes
import, so the suite runs offline:
cd skynet-sources-harvester
source env/bin/activate
python -m pytest tests/ -q
Watchdog tests live separately:
python -m pytest watchdogs/tests/ -q
Naming conventions:
test_aisd_*— ticket-specific regression suitestest_*— module-level unit tests for pure helpers
Pre-commit hooks (black line-length 120, trailing whitespace, pyupgrade
--py38-plus) run via pre-commit install if configured locally.
Logging¶
| Logger | Used for |
|---|---|
skynet-harvester |
Task and library code (campaign_sync.py, basepipe.py, …) |
skynet-harvester.observability |
pipes/observability.py structured events |
| Luigi CLI | --log-level DEBUG on python -m luigi |
On failure, fs_obs.critical() records a structured event with the correlation
ID minted at task start.
Environment variables for debugging¶
| Variable | Effect |
|---|---|
ENVIRONMENT=local |
Staging secrets; safe default for laptop |
LOCAL_PROD_DB=1 |
MySQL from /prd/..., everything else from /stg/... |
WATCHDOG_* |
Watchdog thresholds (see watchdog.md) |
Local debugging workflow¶
export ENVIRONMENT=local- Pick the wrapper or leaf class from Task catalog
- Run with
--workers 1 --log-level DEBUG --local-scheduler - If a task skips as already complete, remove its marker under
luigi/default/ - For AI actions, inspect MySQL tables
ai_actions_results,publish_validation
Luigi scheduler (on EC2)¶
luigid exposes http://localhost:8082. The watchdog uses it for RUNNING /
PENDING / DONE counts and stuck-task detection. Locally you usually skip luigid
with --local-scheduler.
Database inspection¶
Connection settings come from MYSQL_SETTINGS in config/cfg.py. Use staging
credentials only unless LOCAL_PROD_DB=1 is explicitly set.
Common failure modes¶
| Symptom | Likely cause |
|---|---|
ImportError on fs_config / scf |
venv not activated or pip install -r requirements.txt incomplete |
| Secret access denied | AWS creds lack secretsmanager:GetSecretValue |
| Task completes instantly, no data | Luigi marker still present from prior run |
| WordPress publish 401 | Application password / site path — see docs/aisd-homepage-quality/ runbooks |
| Provider API errors | Check skynet-provider-api pin (requirements-dev.txt vs requirements-prd.txt) |
Feature-specific runbooks (SQL patches, validation scripts) remain under
docs/aisd-* folders in the repository; they are ticket artifacts rather than
part of this nav tree.