fix(ui): exclude non-runtime strategies from switch dropdown#175
Conversation
strategyAllowedForAccount had a loophole: runtime_enabled was only checked when allowed_execution_modes was empty. In paper mode, strategies with runtime_enabled=false but paper in allowed_execution_modes (e.g. shadow_candidate, live_candidate) would pass the filter and appear in the strategy dropdown. Fix: check runtime_enabled first, before any mode-specific logic. The strategy-switch-console is for live/runtime strategies only. Co-Authored-By: Claude <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
🤖 Codex PR ReviewPlease ensure a human reviewer checks this PR before merging. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6363765522
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const cleanProfile = cleanStrategyProfile(profile); | ||
| const catalogEntry = strategyCatalogEntry(cleanProfile); | ||
| if (!catalogEntry.profile) return false; | ||
| if (catalogEntry.runtime_enabled !== true) return false; |
There was a problem hiding this comment.
Allow paper-only strategy switches
This rejects every non-runtime profile before checking the selected execution mode, but the worker still treats paper-only candidates as valid: assertStrategyAllowedForAccount only requires runtime_enabled for execution_mode === "live", and the validation test explicitly allows us_equity_combo_leveraged in paper mode. For paper accounts, these allowed_execution_modes: ["paper", ...] shadow/candidate strategies disappear from the UI, so users can no longer launch paper experiments that the backend still supports.
Useful? React with 👍 / 👎.
Bug
策略切换下拉框显示了非 runtime 策略(如
shadow_candidate、live_candidate、research_backtest_only),虽然标记了 disabled/blocked,但仍然出现在下拉选项中。根因
strategyAllowedForAccount中runtime_enabled的检查只在allowed_execution_modes为空时才生效。在 paper 模式下,runtime_enabled=false但allowed_execution_modes包含paper的策略会通过过滤。修复
将
runtime_enabled检查提前到函数顶部,在任何模式判断之前执行。策略切换控制台只服务于 runtime/live 策略。LongBridge SG 策略显示
刷新后显示 SOXL(半导体趋势收益)是正确的——GitHub 变量
RUNTIME_TARGET_JSON中已经是 SOXL。之前网站从platform-config.json读默认值显示 TQQQ 是错的(已在 #172/#173 修复)。不需要手动切换。🤖 Generated with Claude Code