Add Cloud Run precheck route#61
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30039f7bc5
ℹ️ 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".
|
|
||
| @app.route("/precheck", methods=["POST", "GET"]) | ||
| def handle_precheck(): | ||
| return _handle_request(dry_run_only_override=True, response_body="Precheck OK") |
There was a problem hiding this comment.
Enforce dry-run in precheck execution path
Passing dry_run_only_override=True here does not actually force a dry run for order placement: the request eventually calls execute_rebalance() in main.py, which still builds broker adapters from RUNTIME_SETTINGS.dry_run_only. In environments where IBKR_DRY_RUN_ONLY=false, a POST to /precheck can submit real orders even though this route is documented as precheck-only, so the new scheduler split can trigger unintended executions.
Useful? React with 👍 / 👎.
| def test_handle_precheck_post_uses_dry_run_override(strategy_module, monkeypatch): | ||
| observed = {"called": False, "dry_run_only_override": None, "events": []} | ||
|
|
||
| monkeypatch.setattr(strategy_module, "build_request_log_context", lambda: types.SimpleNamespace(run_id="run-001")) |
There was a problem hiding this comment.
Import types before using SimpleNamespace in tests
The new precheck tests reference types.SimpleNamespace but this module is not imported in tests/test_request_handling.py. Once runtime dependencies are installed and these tests run, build_request_log_context lambdas will raise NameError: name 'types' is not defined, preventing the new precheck coverage from executing.
Useful? React with 👍 / 👎.
Summary
Tests
Note: local pytest could not run on this VPS because the active shell points at another project's venv and is missing pandas; CI will run with repo requirements.