Repository navigation
fix: defer optional performance monitor numeric imports - #767
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Pigbibi
marked this pull request as ready for review
November 2, 2026 14:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI assistance
OpenAI Codex (GPT-6 family) authored the change; reviewed by the 代码审查合并 review bot. Draft only; no merge or deployment.
What changed
Keep the recording interface lightweight (option B). Load pandas, numeric
metrics and the return collector inside
run_monitor, and pandas inside theseries validator. Reuse the existing dependency-free backtest window constant.
No recording, metric calculation, persistence or risk behavior change is intended;
module import now succeeds without optional numerics. Calling numeric monitoring
without them still fails explicitly before reading or writing snapshots.
Read-only source searches found recording consumers in CryptoStrategies and the
Binance, IBKR, Schwab and Firstrade platforms; none uses the incidental numeric
helper re-exports. Crypto already declares NumPy/pandas at runtime. One QPK test
now patches the metric function at its defining module. Runtime annotation
inspection of
run_monitorneeds a suppliedReturnCollectornamespace becausethat import is type-only; no such consumer was found. Public recording names,
logger, signatures, defaults and payloads remain unchanged. Existing downstream
pins require a separately authorized rollout. No dependency declarations, pins,
CI policy, trading controls or stop-loss switches change.
How verified
decision/execution recording succeed with NumPy/pandas absent; numeric invocation
raises the expected missing dependency before snapshots are written.
[research]in another clean venv: deterministicnumeric unit path verifies compound return, excess CAGR, crypto annualization,
defaults, all reloaded window metrics and the persisted wire payload. Both
environments pass
pip check, verify installed origins and block externaloperations during probes.
research passes. This reproduces ARCH-03A with the same corrected test.
GITHUB_SHA: 3567 passed, 2 skipped,1277 subtests passed, 31 warnings, 79% coverage on Linux / Python 3.13.5.
one existing README advisory), all five dependency refs, diff hygiene,
workflow-configured commitlint and redacted added-commit Gitleaks pass.
Initial local full-suite failures were the three existing benchmark tests that
require CI's
GITHUB_SHA; unchanged main reproduces all three. A supplementalwhole-directory secret scan flags one unchanged synthetic test fixture; the
required added-commit scan is clean. Other Python versions, hosted CI and full
platform startup have not been verified. No broker/cloud calls or live orders.
Why
ARCH-03A (
FAILURE_REPRODUCED, evidence:REPORT_ARCH03A_dependency-closure.md)showed that a plain QPK wheel at
31009f36b9d144497410cfe3a5b78e2517052961raises
ModuleNotFoundError: pandaswhen importingquant_platform_kit.strategy_lifecycle.performance_monitor. The same wheel with[research]imports successfully. Core requirements are empty and the existingresearch extra supplies NumPy/pandas.
Risk
Low. Affected paths:
src/quant_platform_kit/strategy_lifecycle/performance_monitor.py, related tests anddocs/ARCHITECTURE.md. Import-time behavior only; no dependency declarations, pins, CI policy, trading controls or stop-loss switches change. Downstream pin rollout requires separate authorization.