Skip to content

feat(engines): V6 Phase 3 — additive engines layer (re-export wrappers)#28

Merged
magic-alt merged 1 commit into
mainfrom
feature/v6-engines-layer
May 20, 2026
Merged

feat(engines): V6 Phase 3 — additive engines layer (re-export wrappers)#28
magic-alt merged 1 commit into
mainfrom
feature/v6-engines-layer

Conversation

@magic-alt
Copy link
Copy Markdown
Owner

Summary

V6 Phase 3 of the open-platform reorg (per docs/ROADMAP.md §8.5 / docs/architecture/open-platform.md).

Introduces src/engines/ with seven additive subpackages that re-export the canonical V5 implementations from their original locations. No code is moved or modified. This is the "additive wrappers" pattern called out for Phase 3 in the roadmap.

Engine Re-exports from
src.engines.data src.data_sources.providers, src.data_sources.data_portal, src.data_sources.trading_calendar, src.data_sources.quality
src.engines.execution src.core.order_manager, src.simulation.matching_engine, src.simulation.execution_models, src.simulation.order, src.simulation.order_book, src.simulation.slippage
src.engines.risk src.core.risk_manager_v2, src.core.pre_trade_risk, src.core.reconciliation
src.engines.portfolio src.core.portfolio, src.core.capital_allocator, src.core.account_manager
src.engines.backtest src.backtest.engine, src.backtest.engine_base, src.backtest.repro, src.backtest.admission, src.backtest.analysis
src.engines.research src.mlops.model_registry, src.mlops.training, src.mlops.inference, src.mlops.signals, src.mlops.validation
src.engines.report src.backtest.report_generator, src.backtest.attribution

Why

The Phase 2 ports in src.core.contracts.ports define stable contracts; Phase 3 establishes the directory layout where plugins, the upcoming runtime classes (Phase 6) and the public SDK (Phase 5) will look for the engines that implement those contracts. By making this layer pure re-exports, we get the new namespace without risking V5 behavior.

Notable detail

The V5 class src.core.risk_manager_v2.RiskCheckResult collides by name with the V6 SSOT DTO src.core.contracts.dto.RiskCheckResult. Inside src.engines.risk, the V5 class is re-exposed under the alias RiskCheckOutcome so it doesn't shadow the contract DTO. The V5 import path is unchanged for existing callers.

Validation

  • python -m pytest tests/engines/ -v23 passed.
  • Local CI (scripts/local_ci.ps1 -Jobs test -SkipInstall) → 1257 passed, 35 skipped, 0 failed (1234 baseline + 23 new).

Scope

  • Additive only: no V5 module is touched.
  • No new dependencies.
  • 9 new files, +452 lines.

Next

Phases 4 (Adapters consolidation), 5 (Plugin SPI + SDK), 6 (Platform / Runtime alignment), 7 (distribution split), 8 (legacy compat + deprecation) will follow as separate branches/PRs.

Introduce src/engines/ with seven additive subpackages (data, execution, risk, portfolio, backtest, research, report) that re-export the canonical V5 implementations from src.data_sources / src.core / src.simulation / src.backtest / src.mlops. No code is moved or modified; the new import paths line up with the V6 Phase 2 ports so plugins, runtimes and the public SDK can depend on a stable, port-aligned namespace.

Notes:
- The V5 'risk_manager_v2.RiskCheckResult' class is re-exposed under src.engines.risk as 'RiskCheckOutcome' so it does not shadow the V6 SSOT DTO of the same name in src.core.contracts.dto.
- tests/engines/test_engines_layer.py (23 tests) verifies every subpackage imports cleanly, every __all__ name resolves, and re-exports are object-identical to their V5 originals.

Local CI: 1257 passed, 35 skipped.
Copilot AI review requested due to automatic review settings May 20, 2026 07:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds the V6 “engines layer” namespace (src.engines.*) as an additive wrapper layer intended to re-export existing V5 implementations under port-aligned, stable import paths, plus structural tests validating those re-exports.

Changes:

  • Introduce src/engines/ with subpackages that re-export canonical V5 symbols via __all__.
  • Add structural pytest coverage ensuring subpackages import cleanly and selected re-exports are object-identical to their originals.
  • Record the new engines layer in CHANGELOG.md.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/engines/__init__.py Declares the engines namespace and its exported subpackages.
src/engines/data/__init__.py Re-exports V5 data provider/portal/calendar/quality symbols.
src/engines/execution/__init__.py Re-exports V5 OMS + simulation execution/matching/slippage primitives.
src/engines/risk/__init__.py Re-exports V5 risk primitives and aliases RiskCheckResultRiskCheckOutcome.
src/engines/portfolio/__init__.py Re-exports V5 portfolio/capital allocation/account management symbols.
src/engines/backtest/__init__.py Re-exports V5 backtest engine, admission, repro, and analysis helpers.
src/engines/research/__init__.py Re-exports V5 MLOps registry/training/inference/signals/validation symbols.
tests/engines/__init__.py Documents the structural test intent for the engines layer.
tests/engines/test_engines_layer.py Structural tests for imports, __all__ resolution, and identity re-exports (includes report).
CHANGELOG.md Adds an Unreleased entry describing the engines layer and aliasing behavior.
Comments suppressed due to low confidence (1)

tests/engines/test_engines_layer.py:101

  • This test imports src.engines.report, but the src/engines/report subpackage does not exist in the current changes, so the import will raise ModuleNotFoundError. Add the report engine wrapper (re-exporting src.backtest.report_generator / src.backtest.attribution as described) or adjust/remove the test accordingly.
def test_report_engine_reexports_are_identity() -> None:
    from src.backtest.report_generator import InteractiveReportGenerator as Original
    from src.engines.report import InteractiveReportGenerator as Reexport

    assert Reexport is Original

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +10 to +18
ENGINE_SUBPACKAGES = (
"src.engines.data",
"src.engines.execution",
"src.engines.risk",
"src.engines.portfolio",
"src.engines.backtest",
"src.engines.research",
"src.engines.report",
)
Comment thread src/engines/__init__.py
Comment on lines +25 to +33
__all__ = (
"data",
"execution",
"risk",
"portfolio",
"backtest",
"research",
"report",
)
Comment thread src/engines/__init__.py
Comment on lines +35 to +36
# Subpackages are imported lazily on first attribute access so that
# importing ``src.engines`` does not eagerly load heavy V5 modules.
Comment thread CHANGELOG.md
Comment on lines +7 to +9
### Added
- V6 Phase 3 (open platform — Engines layer): introduce the `src/engines/` package with seven additive subpackages — `data`, `execution`, `risk`, `portfolio`, `backtest`, `research`, `report` — each re-exporting the canonical V5 implementation from its original location (`src.data_sources`, `src.core`, `src.simulation`, `src.backtest`, `src.mlops`). Nothing is moved or modified; the new import paths line up with the V6 Phase 2 ports so plugins, runtimes and the public SDK can depend on a stable, port-aligned namespace. The V5 `RiskCheckResult` is re-exposed as `RiskCheckOutcome` under `src.engines.risk` to avoid shadowing the V6 SSOT DTO of the same name.

Comment thread tests/engines/__init__.py
Comment on lines +3 to +5
These tests are purely structural — they verify that the seven engine
subpackages (``data``, ``execution``, ``risk``, ``portfolio``,
``backtest``, ``research``, ``report``) import cleanly, that the names
@magic-alt magic-alt merged commit 4de6a43 into main May 20, 2026
12 of 14 checks passed
magic-alt added a commit that referenced this pull request May 20, 2026
The bare 'report' pattern in .gitignore matched src/engines/report/, silently
excluding the file from PR #28 (V6 Phase 3 engines layer). Local tests passed
because the working tree has the file, but GitHub CI failed with
'ModuleNotFoundError: No module named src.engines.report'.

- Replace bare 'report' with root-anchored '/report/' so only the top-level
  runtime output directory is ignored.
- Track src/engines/report/__init__.py (the V6 ReportPort wrapper).

Verified: tests/engines/test_engines_layer.py — 23 passed.
magic-alt added a commit that referenced this pull request May 20, 2026
The bare 'report' pattern in .gitignore matched src/engines/report/, silently
excluding the file from PR #28 (V6 Phase 3 engines layer). Local tests passed
because the working tree has the file, but GitHub CI failed with
'ModuleNotFoundError: No module named src.engines.report'.

- Replace bare 'report' with root-anchored '/report/' so only the top-level
  runtime output directory is ignored.
- Track src/engines/report/__init__.py (the V6 ReportPort wrapper).

Verified: tests/engines/test_engines_layer.py — 23 passed.
@magic-alt magic-alt deleted the feature/v6-engines-layer branch May 21, 2026 01:10
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.

2 participants