Skip to content

Fix strategy switch config sync conflicts#150

Merged
Pigbibi merged 1 commit into
mainfrom
fix/strategy-switch-config-sync-audit
Jul 2, 2026
Merged

Fix strategy switch config sync conflicts#150
Pigbibi merged 1 commit into
mainfrom
fix/strategy-switch-config-sync-audit

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

变更

  • 修复策略切换页现金/融资初始冲突:账号配置的 cash_only_execution_mode 优先参与同步,渲染前执行互斥纠偏,避免融资+预留现金比例同时锁死。
  • 去掉现金/融资两个主选择器的互相禁用,改为选择后自动 reconcile,用户可从冲突态恢复。
  • 修复 option_overlay_mode 账号配置未被前端同步读取的问题。
  • 修复 Worker 只读到 CASH_ONLY_EXECUTION 变量时丢失 currentStrategies 条目的问题。
  • 移除各平台 fallback 默认账号里的 0.03/150 预留现金值,避免“未读取到真实当前配置”时误显示为当前预留现金策略。

验证

  • node tests/test_cash_financing.js
  • node tests/strategy_switch_worker_validation.mjs
  • python3 python/scripts/build_config.py --check
  • node --check page_asset.js / strategy_profiles_asset.js / worker.js / app.js
  • python3 -m unittest discover -s python/tests
  • git diff --check

Co-Authored-By: Codex <noreply@openai.com>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🤖 Codex PR Review

⚠️ Review skipped: 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.

@Pigbibi Pigbibi merged commit 5674ca9 into main Jul 2, 2026
8 checks passed
@Pigbibi Pigbibi deleted the fix/strategy-switch-config-sync-audit branch July 2, 2026 20:06

@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: 90c2528912

ℹ️ 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".

Comment on lines +1509 to +1511
if (configured !== "current") {
form.optionOverlayMode = configured;
return;

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 Gate saved option overlays by strategy support

When an account has option_overlay_mode: "enabled" saved and the user switches that account to a strategy without option overlay defaults, such as ibit_smart_dca, this early return keeps form.optionOverlayMode as enabled. The render path then disables the option-overlay select for unsupported strategies, while hasValidOptionOverlayPolicy() rejects enabled on unsupported strategies, leaving the dispatch button disabled with no way for the user to clear the saved mode from the UI.

Useful? React with 👍 / 👎.

Comment on lines +771 to +776
if (!form || allowMarginExplicitlySelected(form) || !form._prevReserve) return;
form.reservePolicyMode = form._prevReserve.mode;
form.minReservedCashUsd = form._prevReserve.floor;
form.reservedCashRatio = form._prevReserve.ratio;
form.reservedCashTouched = true;
delete form._prevReserve;

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 Clear stale saved reserve before restoring it

After a reserve policy is saved in _prevReserve by toggling allow-margin on, that field is not cleared when the user later changes accounts or explicitly changes the reserve policy to none. In those flows this restore path can resurrect the previous account's or previously-cleared reserve settings the next time allow-margin is toggled off, causing a dispatch with an unexpected reserve-cash override.

Useful? React with 👍 / 👎.

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