Enable paper monthly execution dedup#140
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf6b230b27
ℹ️ 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".
| execution_dedup_enabled=resolve_execution_dedup_enabled( | ||
| env_reader=self.env_reader, | ||
| dry_run_only=self.dry_run_only, | ||
| account_scope=self.account_region, |
There was a problem hiding this comment.
Use the runtime target account scope for PAPER defaults
When a deployment is described by RUNTIME_TARGET_JSON with account_scope: "PAPER" but keeps ACCOUNT_REGION as a market/region such as HK or US, this passes the region into resolve_execution_dedup_enabled, so the new PAPER default never activates for live paper-account runs. The runtime target already carries the account-scope field, so the default should be based on that value (falling back to the region only when no target scope exists) to match the intended PAPER account scope behavior.
Useful? React with 👍 / 👎.
| effective = _first_non_empty(effective_date) | ||
| if not signal and not effective: | ||
| return False | ||
| month_segment = _month_segment(signal, effective) |
There was a problem hiding this comment.
Avoid scanning the signal month as the only report month
This narrows prior-report fallback to the signal month, but runtime reports are persisted under the run started_at month, not necessarily the signal snapshot month. For monthly snapshots whose signal date is from the previous month but the execution/report is produced during the next month's execution window, this searches the previous-month prefix and misses the successful current-month report, allowing a duplicate execution attempt despite the fallback.
Useful? React with 👍 / 👎.
Summary
PAPERaccount scope, including paper-account live mode.diagnostics.signal_snapshot.Why
Monthly snapshot strategies may be triggered repeatedly inside the monthly execution window, but once a paper monthly signal has completed or produced a successful no-action result, later invocations should not generate another execution attempt.
Validation
PYTHONPATH=.:/home/ubuntu/Projects/QuantPlatformKit/src:/home/ubuntu/Projects/UsEquityStrategies/src:/home/ubuntu/Projects/HkEquityStrategies/src /tmp/qsl-pytest-venv/bin/python -m pytest -q tests/test_execution_state.py tests/test_runtime_composer.py::test_runtime_composer_builds_runtime_and_config_from_local_builders tests/test_rebalance_service.py::RebalanceServiceNotificationTests::test_run_strategy_skips_when_execution_marker_already_exists tests/test_rebalance_service.py::RebalanceServiceNotificationTests::test_run_strategy_skips_when_prior_report_matches_execution_signal