refactor: remove default_strategy_profile — single source of truth is GitHub variables#173
Conversation
… GitHub variables Problem: default_strategy_profile in platform-config.json created a false impression that changing it would change the running strategy. In reality, the runtime reads RUNTIME_TARGET_JSON from GitHub variables, and the two sources could diverge silently (LongBridge TQQQ bug). Changes: - platform-config.json: delete default_strategy_profile from all 6 platforms - build_config.py: delete report_default_strategy_profile_drift() and gate - build_platform_config.py / inject_platform_config.py: stop generating it - app.js: simplify defaultStrategyForAccount → reads only GitHub variables; remove hardcoded fallback; remove account.default_strategy_profile reads - worker.js: remove default_strategy_profile from KV sync/clean logic - account-options.example.json: remove all default_strategy_profile fields - tests: delete 6 test methods; update assertions and test data - docs: update README.md / README.zh-CN.md / qmt README - Regenerated: config.js, index.html, page_asset.js, app_js.js Architecture after: one platform = one strategy source = GitHub variable RUNTIME_TARGET_JSON. platform-config.json owns capabilities and deployment config only. No more silent divergence between config and runtime. 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: 5def960ff0
ℹ️ 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".
| if (hinted && strategyAllowedForAccount(platform, account, hinted)) return hinted; | ||
| if (fallback && strategyAllowedForAccount(platform, account, fallback)) return fallback; | ||
| return strategyChoicesForAccount(platform, account)[0] || ""; | ||
| return ""; |
There was a problem hiding this comment.
Preserve empty strategy when no runtime target exists
When /api/config has no matching RUNTIME_TARGET_JSON/STRATEGY_PROFILE for an account, returning an empty profile here does not actually leave the form unconfigured: renderControls() later sees form.strategy is empty and assigns choices[0]. That makes the page show an arbitrary runnable strategy instead of the intended empty state, and if the operator changes only another control such as cash/plugin/runtime-target mode, buildInputs() submits that auto-selected strategy and can initialize or overwrite the runtime target with the first catalog choice.
Useful? React with 👍 / 👎.
动机
default_strategy_profile字段存在于platform-config.json、KV 账号配置、前端回退链等多个位置,但它不影响运行时策略(运行时读的是 GitHub 变量RUNTIME_TARGET_JSON)。这造成了改了配置但没生效的假象——上次 LongBridge TQQQ→SOXL 的问题就是典型案例。改动
核心原则:一个平台 = 一个策略来源 = GitHub 变量
RUNTIME_TARGET_JSONplatform-config.json6 个平台的default_strategy_profilebuild_config.py的report_default_strategy_profile_drift()函数和 gate checkbuild_platform_config.py/inject_platform_config.py对该字段的生成app.js硬编码回退链、account.default_strategy_profile 读取worker.jsKV 同步中的default_strategy_profile写入account-options.example.json所有账户的default_strategy_profiletest_runtime_settings.py6 个测试方法test_cash_financing.js/strategy_switch_worker_validation.mjs测试数据架构变化
之前:
之后:
净删除 255 行,新增 28 行。
🤖 Generated with Claude Code