File tree Expand file tree Collapse file tree
news_pipeline/cli/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -663,6 +663,8 @@ def _full_collect_retry_reason(
663663 return None
664664 eligible_count = int (board_meta ["diagnostics" ].get ("eligibleCount" ) or 0 )
665665 if stats .get ("sources_collected" , 0 ) == 0 :
666+ if packs and eligible_count >= MIN_HEALTHY_BOARD_ELIGIBLE :
667+ return None
666668 return "cadence produced zero collected sources"
667669 if not packs and stats .get ("skipped_cadence" , 0 ) > 0 :
668670 return "no board candidates after cadence-limited collect"
Original file line number Diff line number Diff line change @@ -1104,6 +1104,44 @@ def test_prepare_one_compacts_success_step_logs_in_json_payload(monkeypatch: pyt
11041104 assert "large stderr" not in output
11051105
11061106
1107+ def test_prepare_one_does_not_full_collect_retry_when_existing_board_is_healthy () -> None :
1108+ reason = heartbeat_prepare_one ._full_collect_retry_reason (
1109+ collect = True ,
1110+ full_collect = False ,
1111+ steps = [
1112+ {
1113+ "name" : "collect" ,
1114+ "ok" : True ,
1115+ "stdout" : "sources_collected=0 items=0 skipped_cadence=14 failed=0" ,
1116+ "stderr" : "" ,
1117+ }
1118+ ],
1119+ packs = [{"queueId" : f"candidate-{ index } " } for index in range (6 )],
1120+ board_meta = {"diagnostics" : {"eligibleCount" : heartbeat_prepare_one .MIN_HEALTHY_BOARD_ELIGIBLE }},
1121+ )
1122+
1123+ assert reason is None
1124+
1125+
1126+ def test_prepare_one_full_collect_retry_still_runs_when_cadence_board_is_thin () -> None :
1127+ reason = heartbeat_prepare_one ._full_collect_retry_reason (
1128+ collect = True ,
1129+ full_collect = False ,
1130+ steps = [
1131+ {
1132+ "name" : "collect" ,
1133+ "ok" : True ,
1134+ "stdout" : "sources_collected=0 items=0 skipped_cadence=14 failed=0" ,
1135+ "stderr" : "" ,
1136+ }
1137+ ],
1138+ packs = [{"queueId" : "candidate-1" }],
1139+ board_meta = {"diagnostics" : {"eligibleCount" : heartbeat_prepare_one .MIN_HEALTHY_BOARD_ELIGIBLE - 1 }},
1140+ )
1141+
1142+ assert reason == "cadence produced zero collected sources"
1143+
1144+
11071145
11081146def test_headline_board_penalizes_recent_topic_family_saturation (tmp_path : Path ) -> None :
11091147 content = tmp_path / "src/content/equinoxHaber"
You can’t perform that action at this time.
0 commit comments