feat(engines): V6 Phase 3 — additive engines layer (re-export wrappers)#28
Merged
Conversation
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.
There was a problem hiding this comment.
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 RiskCheckResult → RiskCheckOutcome. |
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 thesrc/engines/reportsubpackage does not exist in the current changes, so the import will raiseModuleNotFoundError. Add thereportengine wrapper (re-exportingsrc.backtest.report_generator/src.backtest.attributionas 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 on lines
+25
to
+33
| __all__ = ( | ||
| "data", | ||
| "execution", | ||
| "risk", | ||
| "portfolio", | ||
| "backtest", | ||
| "research", | ||
| "report", | ||
| ) |
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 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 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
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.
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.
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.src.engines.datasrc.data_sources.providers,src.data_sources.data_portal,src.data_sources.trading_calendar,src.data_sources.qualitysrc.engines.executionsrc.core.order_manager,src.simulation.matching_engine,src.simulation.execution_models,src.simulation.order,src.simulation.order_book,src.simulation.slippagesrc.engines.risksrc.core.risk_manager_v2,src.core.pre_trade_risk,src.core.reconciliationsrc.engines.portfoliosrc.core.portfolio,src.core.capital_allocator,src.core.account_managersrc.engines.backtestsrc.backtest.engine,src.backtest.engine_base,src.backtest.repro,src.backtest.admission,src.backtest.analysissrc.engines.researchsrc.mlops.model_registry,src.mlops.training,src.mlops.inference,src.mlops.signals,src.mlops.validationsrc.engines.reportsrc.backtest.report_generator,src.backtest.attributionWhy
The Phase 2 ports in
src.core.contracts.portsdefine 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.RiskCheckResultcollides by name with the V6 SSOT DTOsrc.core.contracts.dto.RiskCheckResult. Insidesrc.engines.risk, the V5 class is re-exposed under the aliasRiskCheckOutcomeso it doesn't shadow the contract DTO. The V5 import path is unchanged for existing callers.Validation
python -m pytest tests/engines/ -v→ 23 passed.scripts/local_ci.ps1 -Jobs test -SkipInstall) → 1257 passed, 35 skipped, 0 failed (1234 baseline + 23 new).Scope
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.