@@ -52,13 +52,37 @@ def test_expired_ai_signal_is_excluded_from_long_context_and_warns(tmp_path: Pat
5252 assert report ["summary" ]["long_context_available" ] is False
5353
5454
55+ def test_legacy_market_confirmation_without_quality_metadata_cannot_score (tmp_path : Path ) -> None :
56+ market_path = tmp_path / "legacy_market.csv"
57+ market_path .write_text (
58+ "symbol,as_of,return_5d,return_20d,return_63d,relative_return_20d,relative_return_63d,volume_zscore,drawdown_63d,volatility_21d,market_score,data_source,price_observation_count\n "
59+ "MU,2026-05-30,0.03,0.12,0.28,0.07,0.13,1.2,-0.06,0.33,0.99,yahoo_chart,120\n " ,
60+ encoding = "utf-8" ,
61+ )
62+ report = build_advisory_report (
63+ as_of = "2026-05-30" ,
64+ cadence = "weekly" ,
65+ political_events_path = ROOT / "examples/political_events.example.csv" ,
66+ political_watchlist_path = ROOT / "examples/political_watchlist.example.csv" ,
67+ market_confirmation_path = market_path ,
68+ )
69+
70+ assert report ["final_decisions" ]["recommendations" ] == []
71+
72+
5573def test_manifest_records_input_hash_and_upstream_metadata (tmp_path : Path ) -> None :
5674 report_path = tmp_path / "report.json"
5775 markdown_path = tmp_path / "report.md"
5876 report_path .write_text ("{}\n " , encoding = "utf-8" )
5977 markdown_path .write_text ("# report\n " , encoding = "utf-8" )
6078 input_path = ROOT / "examples/political_events.example.csv"
61- report = {"as_of" : "2026-05-30" , "cadence" : "weekly" , "schema_version" : "5" , "mode" : "model_recommendations" }
79+ report = {
80+ "as_of" : "2026-05-30" ,
81+ "cadence" : "weekly" ,
82+ "schema_version" : "5" ,
83+ "mode" : "model_recommendations" ,
84+ "source_artifacts" : {"political_events" : str (input_path )},
85+ }
6286
6387 manifest_path = write_report_manifest (
6488 report = report ,
@@ -71,8 +95,11 @@ def test_manifest_records_input_hash_and_upstream_metadata(tmp_path: Path) -> No
7195
7296 manifest = json .loads (manifest_path .read_text (encoding = "utf-8" ))
7397 assert manifest ["upstream_repositories" ]["QuantStrategyLab/PoliticalEventTrackingResearch" ] == "abc123"
74- assert manifest ["source_artifacts" ]["political_events" ]["sha256" ]
75- assert manifest ["source_artifacts" ]["political_events" ]["schema" ].startswith ("event_id," )
98+ assert manifest ["source_artifacts" ]["political_events" ] == str (input_path )
99+ metadata = manifest ["source_artifacts_metadata" ]
100+ assert metadata ["schema_version" ] == "1"
101+ assert metadata ["items" ]["political_events" ]["sha256" ]
102+ assert metadata ["items" ]["political_events" ]["schema" ].startswith ("event_id," )
76103
77104
78105def test_low_confidence_events_remain_verify_source_until_verified () -> None :
0 commit comments