rebuild(stage-15): complete governance and handoff

This commit is contained in:
leefer
2026-07-30 08:46:12 +08:00
parent fa7a8dde06
commit d1b3b977d2
14 changed files with 498 additions and 13 deletions
+20 -1
View File
@@ -21,7 +21,7 @@ from backend.data.policy import DataPolicyError, DataSourcePolicy
from backend.data.providers.ifind import IfindProvider
from backend.data.providers.tushare import TushareProvider
from backend.data.repository import MarketRepository
from backend.data.sentiment import calculate_sentiment
from backend.data.sentiment import _phase, calculate_sentiment
from backend.database.connection import Database
from backend.database.migrations import MIGRATIONS, MigrationRunner
from backend.features.market.snapshot import build_snapshot
@@ -403,6 +403,25 @@ def test_sentiment_has_all_weighted_components_and_extreme_risk_cap() -> None:
}
def test_sentiment_phase_transitions_require_confirmed_recovery_and_fermentation() -> None:
phase, _reason = _phase(
{"phase": "冰点"}, 28, 3, 40, 45, 50, "修复", False
)
assert phase == "冰点"
phase, _reason = _phase(
{"phase": "修复", "fermentation_signal_count": 0},
55,
8,
60,
55,
60,
"发酵",
False,
)
assert phase == "修复"
def test_incomplete_daily_snapshot_is_rejected_without_overwriting(tmp_path) -> None:
database = Database(tmp_path / "sync.db")
MigrationRunner(database).upgrade(MIGRATIONS)