Skip to content

fix: defer optional performance monitor numeric imports - #767

Merged
Pigbibi merged 3 commits into
mainfrom
fix/arch03b-lightweight-performance-monitor
Nov 2, 2026
Merged

Pigbibi merged 3 commits into
mainfrom
fix/arch03b-lightweight-performance-monitor

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

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 the
series 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_monitor needs a supplied ReturnCollector namespace because
that 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

  • Build a wheel and install without extras into a clean venv: import and local
    decision/execution recording succeed with NumPy/pandas absent; numeric invocation
    raises the expected missing dependency before snapshots are written.
  • Install the same wheel with [research] in another clean venv: deterministic
    numeric 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 external
    operations during probes.
  • Run that regression against archived main: core fails with missing pandas,
    research passes. This reproduces ARCH-03A with the same corrected test.
  • Full QPK suite with CI-equivalent GITHUB_SHA: 3567 passed, 2 skipped,
    1277 subtests passed
    , 31 warnings, 79% coverage on Linux / Python 3.13.5.
  • Ruff, 36 documentation-checker tests, documentation phase 2 (0 blocking;
    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 supplemental
whole-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 31009f36b9d144497410cfe3a5b78e2517052961
raises ModuleNotFoundError: pandas when importing
quant_platform_kit.strategy_lifecycle.performance_monitor. The same wheel with
[research] imports successfully. Core requirements are empty and the existing
research extra supplies NumPy/pandas.

Risk

Low. Affected paths: src/quant_platform_kit/strategy_lifecycle/performance_monitor.py, related tests and docs/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.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0fab2701-0082-46ff-a2cc-c7e7a9a08ca9
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Pigbibi Pigbibi added the owner-approved Owner approval for high-risk PRs. AI agents must never apply this label. label Nov 2, 2026
@Pigbibi
Pigbibi marked this pull request as ready for review November 2, 2026 14:37
@Pigbibi
Pigbibi merged commit a873fb4 into main Nov 2, 2026
9 checks passed
@Pigbibi
Pigbibi deleted the fix/arch03b-lightweight-performance-monitor branch November 2, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owner-approved Owner approval for high-risk PRs. AI agents must never apply this label.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants