feat: make runtime settings market aware - #194
Conversation
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e09ff0a347
ℹ️ 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".
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
When platform=qmt is selected, the form still defaults execution_mode to live, and neither the workflow safety gate nor validate_target enforces QMT's configured dry_run_only=true and live_configured=false. For cn_industry_etf_rotation, which permits live execution, an apply run therefore validates successfully and writes execution_mode=live, dry_run_only=false, and QMT_DRY_RUN_ONLY=false, despite QMT being marked not_wired; reject live QMT switches or force paper/dry-run before allowing writes.
ℹ️ 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".
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4d0c129d8
ℹ️ 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".
Co-Authored-By: Codex <noreply@openai.com>
|
Also addressed the QMT live-mode review in 9271e6a: runtime target validation now rejects live execution whenever the platform deployment declares live_configured=false. QMT dry-run targets remain valid; the new regression test confirms live QMT targets fail before variable writes. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9271e6a53e
ℹ️ 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".
|
|
||
| function usesServiceTargetsAsRuntimeSource(platform) { | ||
| return platform === "ibkr"; | ||
| return ["ibkr", "schwab", "firstrade"].includes(platform); |
There was a problem hiding this comment.
Read LongBridge inventories for repository-scoped switches
When a LongBridge switch explicitly uses variable_scope=repository and CLOUD_RUN_SERVICE_TARGETS_JSON already exists, the inspected manual workflow fetches and patches that inventory, and build_switch_target emits only the patched inventory rather than direct RUNTIME_TARGET_JSON/STRATEGY_PROFILE assignments. Because this predicate excludes LongBridge, the console never reads the updated source and continues showing the previous environment/direct-variable strategy; include LongBridge here or reject repository-scoped LongBridge switches.
Useful? React with 👍 / 👎.
| execution_mode = str(runtime_target.get("execution_mode") or "").strip().lower() | ||
| deployment = platform.get("deployment", {}) if isinstance(platform, dict) else {} | ||
| if ( | ||
| execution_mode == "live" | ||
| and isinstance(deployment, dict) | ||
| and deployment.get("live_configured") is False | ||
| ): | ||
| errors.append(f"platform {platform_id} has no live runtime configuration") |
There was a problem hiding this comment.
Enforce disabled live platforms before profile lookup
When a hand-authored target uses an uncatalogued strategy profile, the early return above this new check skips the live_configured gate entirely. For example, a QMT target with strategy_profile="unknown_profile", execution_mode="live", and dry_run_only=false currently passes validate_target with no errors and can be applied, despite QMT being declared to have no live configuration; perform the platform-level live check before returning for an unknown strategy.
Useful? React with 👍 / 👎.
| for name, value in repository_variables.items(): | ||
| if name in GENERATED_VARIABLES: | ||
| errors.append(f"repository_variables.{name} duplicates a generated variable") | ||
| if name in extra_variable_names: | ||
| errors.append(f"repository_variables.{name} duplicates extra_variables.{name}") | ||
| if name in RESEARCH_ONLY_EXTRA_VARIABLES: | ||
| errors.append( | ||
| f"repository_variables.{name} is research-only and must not be stored in live switch settings" | ||
| ) | ||
| if is_secret_variable_name(name): | ||
| errors.append(f"repository_variables.{name} looks like a secret and must not be stored here") | ||
| if isinstance(value, str) and "\n" in value: | ||
| errors.append(f"repository_variables.{name} must be a single-line value") |
There was a problem hiding this comment.
Validate dry-run flags in repository variables
When a hand-authored target places a platform dry-run flag in the newly supported repository_variables, this validator omits the consistency check that validate_extra_variables applies. A Schwab target with execution_mode="paper", dry_run_only=true, and repository_variables.SCHWAB_DRY_RUN_ONLY="false" therefore validates and renders contradictory assignments, allowing consumers of the platform-specific flag to run with live behavior; apply the same platform dry-run consistency validation here or restrict this field to the service inventory variable.
Useful? React with 👍 / 👎.
Summary
Validation