Skip to content

Add Firstrade strategy precheck runtime reports#90

Merged
Pigbibi merged 1 commit into
mainfrom
codex/add-firstrade-runtime-reports
Jun 18, 2026
Merged

Add Firstrade strategy precheck runtime reports#90
Pigbibi merged 1 commit into
mainfrom
codex/add-firstrade-runtime-reports

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • wrap Firstrade strategy runs with runtime_report.v1 persistence
  • make /precheck run a silent dry-run strategy cycle instead of a health-only response
  • suppress cycle notifications and plugin alert dispatch during Firstrade precheck
  • copy plugin summaries and plugin errors into the runtime report shape used by other platforms

Config

  • set EXECUTION_REPORT_GCS_URI=gs://qsl-runtime-logs-shared/execution-reports for FirstradePlatform

Tests

  • git diff --check
  • python -m py_compile main.py application/rebalance_service.py tests/test_request_handling.py
  • PYTHONPATH=/home/ubuntu/Projects/QuantPlatformKit/src timeout 120 python -m pytest tests/test_request_handling.py -q (skipped locally: Flask is not installed in this VPS env)

@Pigbibi Pigbibi merged commit 3694cbc into main Jun 18, 2026
1 check passed
@Pigbibi Pigbibi deleted the codex/add-firstrade-runtime-reports branch June 18, 2026 07:14

@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: 50f9914475

ℹ️ 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 thread main.py
Comment on lines +126 to +130
return replace(
settings,
dry_run_only=bool(dry_run_override),
live_trading_enabled=False if dry_run_override else settings.live_trading_enabled,
runtime_target=runtime_target,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Disable precheck strategy-state persistence

When FIRSTRADE_PERSIST_STRATEGY_RUNS=true, forcing dry_run_only here still leaves persist_strategy_runs enabled for /precheck. run_strategy_cycle then writes a dry-run latest.json to the same strategy-run key used by live idempotency, and application/strategy_run_persistence.py:is_duplicate_live_run ignores dry_run_only states, so a scheduled precheck after a live terminal run can make the next live /run in that period submit again instead of being skipped as a duplicate. Disable strategy-run state persistence for forced prechecks while still persisting the runtime report.

Useful? React with 👍 / 👎.

Comment thread main.py


def _build_run_id() -> str:
return datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")

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 Use unique IDs for runtime reports

This run ID only has one-second resolution, but persist_runtime_report derives the local/GCS report path from run_id. If Cloud Run handles two requests for the same strategy/account in the same second (for example a scheduler retry overlapping a manual /run, with concurrency enabled), the later report overwrites the earlier one, losing one runtime record. Include a unique suffix such as a UUID or request ID in addition to the timestamp.

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