From 0cc44105d2481e402911ae75c859fe37ce6ed48a Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Tue, 30 Jun 2026 23:05:12 +0800 Subject: [PATCH] fix: add combo profile to test expectations and live-enable matrix - Add HK_EQUITY_COMBO_PROFILE imports and expected sets in catalog tests - Update build_live_enablement_matrix() to include combo profiles - Fix profile_count/selectable_profile_count assertions - Add HK_EQUITY_COMBO_PROFILE to PROFILE_LIVE_ENABLEMENT_THRESHOLDS Co-Authored-By: Claude --- src/hk_equity_strategies/live_enablement_matrix.py | 2 +- src/hk_equity_strategies/runtime_readiness.py | 10 ++++++++++ tests/test_catalog.py | 3 +++ tests/test_live_enablement_matrix.py | 7 ++++--- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/hk_equity_strategies/live_enablement_matrix.py b/src/hk_equity_strategies/live_enablement_matrix.py index fa904fb..dd9937d 100644 --- a/src/hk_equity_strategies/live_enablement_matrix.py +++ b/src/hk_equity_strategies/live_enablement_matrix.py @@ -611,7 +611,7 @@ def build_live_enablement_row(profile: str) -> dict[str, Any]: def build_live_enablement_matrix() -> dict[str, Any]: - runtime_profiles = set(get_direct_market_history_profiles()) | set(get_snapshot_backed_profiles()) + runtime_profiles = set(get_runtime_enabled_profiles()) runtime_rows = [_runtime_row(profile).as_dict() for profile in sorted(runtime_profiles)] research_rows = [_research_only_row(profile).as_dict() for profile in sorted(get_research_backtest_only_profiles())] snapshot_rows = [ diff --git a/src/hk_equity_strategies/runtime_readiness.py b/src/hk_equity_strategies/runtime_readiness.py index 26bd0ce..1c61507 100644 --- a/src/hk_equity_strategies/runtime_readiness.py +++ b/src/hk_equity_strategies/runtime_readiness.py @@ -19,6 +19,7 @@ from hk_equity_strategies.runtime_etf_product_policy import build_runtime_etf_product_policy from hk_equity_strategies.runtime_market_data_policy import build_runtime_market_data_policy from hk_equity_strategies.catalog import ( + HK_EQUITY_COMBO_PROFILE, HK_EQUITY_DOMAIN, HK_GLOBAL_ETF_TACTICAL_ROTATION_PROFILE, HK_LOW_VOL_DIVIDEND_QUALITY_SNAPSHOT_PROFILE, @@ -185,6 +186,15 @@ def get_required_live_evidence_fields(profile: str) -> tuple[str, ...]: "min_required_oos_fold_count": MIN_REQUIRED_OOS_FOLD_COUNT, "max_single_period_return_contribution": MAX_SINGLE_PERIOD_RETURN_CONTRIBUTION, }, + HK_EQUITY_COMBO_PROFILE: { + "max_allowed_backtest_drawdown": 0.30, + "min_required_return_to_drawdown_ratio": 0.50, + "max_allowed_annualized_turnover": 1.50, + "min_required_annual_return": 0.0, + "min_required_walk_forward_years": MIN_REQUIRED_WALK_FORWARD_YEARS, + "min_required_oos_fold_count": MIN_REQUIRED_OOS_FOLD_COUNT, + "max_single_period_return_contribution": MAX_SINGLE_PERIOD_RETURN_CONTRIBUTION, + }, } PROFILE_LIVE_OPTIMIZATION_CHECKS: dict[str, tuple[str, ...]] = { diff --git a/tests/test_catalog.py b/tests/test_catalog.py index 63a5bef..0b1d535 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -6,6 +6,7 @@ from hk_equity_strategies import get_strategy_definitions from hk_equity_strategies.catalog import ( + HK_EQUITY_COMBO_PROFILE, HK_EQUITY_DOMAIN, HK_GLOBAL_ETF_TACTICAL_ROTATION_PROFILE, HK_LOW_VOL_DIVIDEND_QUALITY_SNAPSHOT_PROFILE, @@ -25,6 +26,7 @@ def test_catalog_declares_runtime_enabled_hk_direct_strategies(): catalog = get_strategy_definitions() assert set(catalog) == { + HK_EQUITY_COMBO_PROFILE, HK_GLOBAL_ETF_TACTICAL_ROTATION_PROFILE, HK_LOW_VOL_DIVIDEND_QUALITY_SNAPSHOT_PROFILE, } @@ -67,6 +69,7 @@ def test_profile_groups_keep_runtime_research_and_snapshot_scaffolds_separate(): assert get_research_backtest_only_profiles() == frozenset() assert get_runtime_enabled_profiles() == frozenset( { + HK_EQUITY_COMBO_PROFILE, HK_GLOBAL_ETF_TACTICAL_ROTATION_PROFILE, HK_LOW_VOL_DIVIDEND_QUALITY_SNAPSHOT_PROFILE, } diff --git a/tests/test_live_enablement_matrix.py b/tests/test_live_enablement_matrix.py index 7419991..837bfa9 100644 --- a/tests/test_live_enablement_matrix.py +++ b/tests/test_live_enablement_matrix.py @@ -8,6 +8,7 @@ import pytest from hk_equity_strategies.catalog import ( + HK_EQUITY_COMBO_PROFILE, HK_GLOBAL_ETF_TACTICAL_ROTATION_PROFILE, HK_LOW_VOL_DIVIDEND_QUALITY_SNAPSHOT_PROFILE, get_external_snapshot_scaffold_profiles, @@ -40,8 +41,8 @@ def test_live_enablement_matrix_keeps_only_runtime_profiles_selectable_or_listed matrix = build_live_enablement_matrix() assert set(matrix["selectable_profiles"]) == get_runtime_enabled_profiles() - assert matrix["selectable_profile_count"] == 2 - assert matrix["profile_count"] == 2 + assert matrix["selectable_profile_count"] == 3 + assert matrix["profile_count"] == 3 assert matrix["blocked_profile_count"] == 0 assert get_external_snapshot_scaffold_profiles() == frozenset() assert get_research_backtest_only_profiles() == frozenset() @@ -140,6 +141,6 @@ def test_print_hk_live_enablement_matrix_json(): completed = subprocess.run([sys.executable, str(SCRIPT), "--json"], check=True, capture_output=True, text=True) payload = json.loads(completed.stdout) - assert payload["profile_count"] == 2 + assert payload["profile_count"] == 3 assert payload["blocked_profile_count"] == 0 assert set(payload["selectable_profiles"]) == get_runtime_enabled_profiles()