Skip to content

fix(ui): exclude non-runtime strategies from switch dropdown#175

Merged
Pigbibi merged 1 commit into
mainfrom
fix/strategy-live-filter
Jul 7, 2026
Merged

fix(ui): exclude non-runtime strategies from switch dropdown#175
Pigbibi merged 1 commit into
mainfrom
fix/strategy-live-filter

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Bug

策略切换下拉框显示了非 runtime 策略(如 shadow_candidatelive_candidateresearch_backtest_only),虽然标记了 disabled/blocked,但仍然出现在下拉选项中。

根因

strategyAllowedForAccountruntime_enabled 的检查只在 allowed_execution_modes 为空时才生效。在 paper 模式下,runtime_enabled=falseallowed_execution_modes 包含 paper 的策略会通过过滤。

修复

runtime_enabled 检查提前到函数顶部,在任何模式判断之前执行。策略切换控制台只服务于 runtime/live 策略。

+ if (catalogEntry.runtime_enabled !== true) return false;
  if (dcaConfigForStrategy(cleanProfile) && !platformSupportsDca(platform)) return false;
  ...
- if (catalogEntry.runtime_enabled !== true && !allowedModes.length) return false;

LongBridge SG 策略显示

刷新后显示 SOXL(半导体趋势收益)是正确的——GitHub 变量 RUNTIME_TARGET_JSON 中已经是 SOXL。之前网站从 platform-config.json 读默认值显示 TQQQ 是错的(已在 #172/#173 修复)。不需要手动切换

🤖 Generated with Claude Code

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>
@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

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.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🤖 Codex PR Review

⚠️ Human review required: The Codex review could not be completed.

No Codex service URL or API key configured. Set CODEX_AUDIT_SERVICE_URL, ANTHROPIC_API_KEY, or OPENAI_API_KEY.

Please ensure a human reviewer checks this PR before merging.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@Pigbibi
Pigbibi merged commit 0fdf2d3 into main Jul 7, 2026
10 of 11 checks passed
@Pigbibi
Pigbibi deleted the fix/strategy-live-filter branch July 7, 2026 21:45
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.

1 participant