Skip to content

fix: correct strategy stop and rebalance notification queries - #398

Merged
brokermr810 merged 76 commits into
mainfrom
test
Nov 21, 2026
Merged

brokermr810 merged 76 commits into
mainfrom
test

Conversation

@brokermr810

Copy link
Copy Markdown
Collaborator

Summary

Fix the column "name" does not exist regression introduced in #397. Automatic-stop cleanup and portfolio rebalance notification queries now use the existing qd_strategies_trading.strategy_name column.

Also honor an operator's explicit stop-and-close request when it upgrades a pending automatic-stop command. Automatic stops still default to preserving positions.

Regression coverage

Replace the hand-written database fixture with the repository's real init.sql, apply the batch migration twice, and use the production PostgreSQL cursor adapter. Cover command claiming/completion, strategy names, tenant ownership, notification target/language resolution, all selected delivery channels, deduplication, and stop-and-close behavior.

Validation

  • 557 tests passed in the expanded regression suite; the optional PostgreSQL notification-concurrency test was then run separately and passed (558 total).
  • Ruff, backend structure guardrail, documentation validation, and git diff --check passed.
  • Tests used disposable, network-isolated PostgreSQL with mocked exchange and external notification calls.

Deployment and limits

No database schema change or additional migration is needed for this hotfix. Deploy updated backend/worker code through the normal release process. Previously exhausted stop commands are not automatically replayed; affected deployments need operator review. No live accounts or positions were modified during validation.

tianhe added 30 commits November 1, 2026 17:17
Signed-off-by: TIANHE <[email protected]>

# Conflicts:
#	backend_api_python/app/routes/community.py
Signed-off-by: TIANHE <[email protected]>

# Conflicts:
#	backend_api_python/tests/test_safe_exec.py
#	backend_api_python/tests/test_strategy_runtime_process_isolation.py
Signed-off-by: TIANHE <[email protected]>

# Conflicts:
#	backend_api_python/app/professional_report/features/equity.py
#	backend_api_python/app/research/workflows.py
#	backend_api_python/tests/test_professional_report_builder.py
…emails

Persist definitive order failure streaks and portfolio batch outcomes, send deduplicated alerts across opted-in channels, and render transactional emails using localized monochrome templates and configured branding.

Signed-off-by: TIANHE <[email protected]>
Signed-off-by: TIANHE <[email protected]>

# Conflicts:
#	backend_api_python/app/services/strategy_v2/live_execution.py
#	backend_api_python/app/services/trading_executor.py
#	backend_api_python/tests/test_strategy_v2_order_gateway.py
#	docs/trading/LIVE_TRADING_SAFETY.md
#	docs/trading/LIVE_TRADING_SAFETY_CN.md
Use the canonical strategy_name column for automatic-stop and rebalance notifications, honor explicit stop-and-close requests, and exercise the production schema and notification delivery paths in regression tests.

Signed-off-by: TIANHE <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@brokermr810
brokermr810 merged commit c6ad8fe into main Nov 21, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants