@@ -99,32 +99,39 @@ def test_current_matrix_matches_local_workspace(self):
9999 self .assertEqual (report .missing_files , [])
100100 self .assertEqual (report .issues , [])
101101
102- def test_tracked_qpk_consumer_pins_match_latest_matrix_snapshot (self ):
103- expected_pins_by_consumer = {
104- "BinancePlatform" : "9f7e7f8335e97f83f66677ad5e73254a1a421759" ,
105- "CharlesSchwabPlatform" : "9f7e7f8335e97f83f66677ad5e73254a1a421759" ,
106- "CnEquityStrategies" : "54d4ba901ae4e72e09c143c051747b900de55022" ,
107- "CryptoStrategies" : "54d4ba901ae4e72e09c143c051747b900de55022" ,
108- "FirstradePlatform" : "9f7e7f8335e97f83f66677ad5e73254a1a421759" ,
109- "HkEquityStrategies" : "54d4ba901ae4e72e09c143c051747b900de55022" ,
110- "InteractiveBrokersPlatform" : "9f7e7f8335e97f83f66677ad5e73254a1a421759" ,
111- "LongBridgePlatform" : "9f7e7f8335e97f83f66677ad5e73254a1a421759" ,
112- "UsEquityStrategies" : "54d4ba901ae4e72e09c143c051747b900de55022" ,
113- "UsEquitySnapshotPipelines" : "2341557b8ded834bd41ef5a92111361dbf8844d9" ,
102+ def test_tracked_qpk_consumer_pins_are_coherent_per_consumer (self ):
103+ tracked_consumers = {
104+ "BinancePlatform" ,
105+ "CharlesSchwabPlatform" ,
106+ "CnEquityStrategies" ,
107+ "CryptoStrategies" ,
108+ "FirstradePlatform" ,
109+ "HkEquityStrategies" ,
110+ "InteractiveBrokersPlatform" ,
111+ "LongBridgePlatform" ,
112+ "UsEquityStrategies" ,
113+ "UsEquitySnapshotPipelines" ,
114114 }
115115 matrix_pins = check_internal_dependency_matrix .load_matrix (ROOT / "internal_dependency_matrix.json" )
116116 refs = {
117117 (pin .consumer_repo , pin .path ): pin .ref
118118 for pin in matrix_pins
119- if pin .consumer_repo in expected_pins_by_consumer and pin .source_repo == "QuantPlatformKit"
119+ if pin .consumer_repo in tracked_consumers and pin .source_repo == "QuantPlatformKit"
120120 }
121- expected_refs = {
122- (consumer_repo , path ): ref
123- for consumer_repo , ref in expected_pins_by_consumer . items ()
121+ expected_keys = {
122+ (consumer_repo , path )
123+ for consumer_repo in tracked_consumers
124124 for path in ("pyproject.toml" , "uv.lock" )
125125 }
126126
127- self .assertEqual (refs , expected_refs )
127+ self .assertEqual (set (refs ), expected_keys )
128+ for consumer_repo in tracked_consumers :
129+ consumer_refs = {
130+ refs [(consumer_repo , path )]
131+ for path in ("pyproject.toml" , "uv.lock" )
132+ }
133+ self .assertEqual (len (consumer_refs ), 1 )
134+ self .assertRegex (next (iter (consumer_refs )), r"^[0-9a-f]{40}$" )
128135
129136 uesp_strategy_refs = {
130137 (pin .consumer_repo , pin .path ): pin .ref
@@ -133,12 +140,19 @@ def test_tracked_qpk_consumer_pins_match_latest_matrix_snapshot(self):
133140 and pin .source_repo == "UsEquityStrategies"
134141 }
135142 self .assertEqual (
136- uesp_strategy_refs ,
137- {
138- ("UsEquitySnapshotPipelines" , path ): "180701592efda47d8acd824dca98f3d74a5ee462"
139- for path in ("pyproject.toml" , "uv.lock" )
140- },
143+ set (uesp_strategy_refs ),
144+ {("UsEquitySnapshotPipelines" , path ) for path in ("pyproject.toml" , "uv.lock" )},
141145 )
146+ self .assertEqual (len (set (uesp_strategy_refs .values ())), 1 )
147+ self .assertRegex (next (iter (uesp_strategy_refs .values ())), r"^[0-9a-f]{40}$" )
148+
149+ def test_upgrade_document_distinguishes_target_candidate_and_observed_pins (self ):
150+ document = (ROOT / "docs" / "qsl_compat_upgrade.md" ).read_text (encoding = "utf-8" )
151+
152+ self .assertIn ("compat/bundles/<bundle>.toml" , document )
153+ self .assertIn ("internal_dependency_matrix.json" , document )
154+ self .assertIn ("QuantPlatformKit/QPK_PIN" , document )
155+ self .assertNotRegex (document , r"[0-9a-f]{40}" )
142156
143157 def test_require_consumer_files_treats_missing_paths_as_issues (self ):
144158 projects_root = self ._make_projects_root ({})
0 commit comments