Issue 410 / PR 422 Verification Plan¶
Source: - Issue: https://github.com/tradai-bot/tradai/issues/410 - PR: https://github.com/tradai-bot/tradai/pull/422
Goal: prove PR 422 fully fixes strategy launch failures caused by missing runtime environment variables.
1. Local Verification¶
Run focused backend tests:
uv run pytest services/backend/tests/unit/test_strategy_operations_service.py services/backend/tests/unit/test_strategy_ops_routes.py -v -p no:cacheprovider
Expected: - All focused strategy operations tests pass. - Tests prove dry-run injects TRADING_MODE and STRATEGY_ID. - Tests prove live mode requires exchange_secret_name. - Tests prove live mode passes EXCHANGE_SECRET_NAME. - Tests prove Backend does not override STRATEGY.
Run lint:
uv run ruff check services/backend/src/tradai/backend/core/strategy_operations.py services/backend/src/tradai/backend/api/operations_routes.py services/backend/src/tradai/backend/api/schemas.py services/backend/tests/unit/test_strategy_operations_service.py services/backend/tests/unit/test_strategy_ops_routes.py
Run type check:
uv run mypy services/backend/src/tradai/backend/core/strategy_operations.py services/backend/src/tradai/backend/api/operations_routes.py services/backend/src/tradai/backend/api/schemas.py --ignore-missing-imports
2. Deploy Backend to AWS Dev¶
After PR 422 is merged, or after building from its branch, push and deploy Backend:
just service-push backend tradai eu-central-1 latest
just ecs-force-deploy backend tradai eu-central-1 tradai-dev
Wait for Backend to stabilize before running runtime checks.
3. Verify Dry-Run Launch Reaches RUNNING¶
Set ALB:
Launch dry-run:
curl -s -X POST "$ALB/api/v1/strategies/E2ETestStrategy/run" \
-H "Content-Type: application/json" \
-d '{"mode":"dry-run"}'
Expected: - HTTP 201. - Response status is PENDING.
Verify ECS service:
aws ecs describe-services \
--cluster tradai-dev \
--services strategy-e2eteststrategy \
--profile tradai \
--region eu-central-1 \
--query 'services[0].{Running:runningCount,Pending:pendingCount,Desired:desiredCount}'
Expected within 60-120 seconds:
4. Verify Container Logs¶
List tasks:
aws ecs list-tasks \
--cluster tradai-dev \
--service-name strategy-e2eteststrategy \
--profile tradai \
--region eu-central-1
Inspect recent logs in /ecs/tradai/dev.
Expected: - No STRATEGY_ID environment variable required. - No STRATEGY or FREQTRADE_STRATEGY required. - Container remains alive instead of exiting with validation failure.
5. Verify Trading State and PnL¶
Check trading state:
aws dynamodb scan \
--table-name tradai-trading-state-dev \
--filter-expression "strategy_id = :s" \
--expression-attribute-values '{":s":{"S":"E2ETestStrategy"}}' \
--profile tradai \
--region eu-central-1 \
--select COUNT
Expected: - Count is >= 1.
Check PnL:
Expected: - Response is not empty once heartbeat has populated pnl_snapshot.
6. Verify Live Mode Fails Fast Without Secret¶
curl -i -X POST "$ALB/api/v1/strategies/E2ETestStrategy/run" \
-H "Content-Type: application/json" \
-d '{"mode":"live"}'
Expected: - HTTP 400. - Response mentions EXCHANGE_SECRET_NAME. - ECS service/task definition is not changed.
Pass Criteria¶
PR 422 fully solves issue 410 if:
- Dry-run launch reaches ECS
RUNNING. - Logs no longer show missing
STRATEGY_ID. - Logs no longer show missing strategy class.
- Live mode without
exchange_secret_namefails before ECS deployment. - Local tests pass.
- CI remains green.
Caveat¶
If dry-run still fails with STRATEGY or FREQTRADE_STRATEGY required, then the base task definition or strategy image is missing FREQTRADE_STRATEGY. That would be outside PR 422's Backend runtime override fix, but it still blocks issue 410 runtime acceptance and must be fixed in the strategy image/task definition path.