@@ -408,6 +408,35 @@ def test_overview_same_api_date_after_check_updates_keeps_no_valid_output_suppre
408408 self .assertEqual (overview [0 ]["days_behind" ], 0 )
409409 self .assertEqual (overview [0 ]["status_color" ], "green" )
410410
411+ def test_overview_cached_api_date_after_no_valid_output_is_not_pending (self ):
412+ """更新后仅依赖缓存 API 日期时,same-date no_valid_output 仍不应显示落后。"""
413+ self ._write_timestamp ("coin-cap" , "2026-03-10" )
414+ update_api_latest_dates (self .log_dir , {"coin-cap" : "2026-03-11" })
415+ report = _new_report ("test" , mode = "network" )
416+ _append_result (
417+ report ,
418+ product = "coin-cap" ,
419+ status = "skipped" ,
420+ reason_code = "no_valid_output" ,
421+ error = "同步未产生可用输出,已跳过状态推进。" ,
422+ date_time = "2026-03-11" ,
423+ )
424+ _update_product_last_status (self .log_dir , report )
425+
426+ import unittest .mock
427+ with unittest .mock .patch (
428+ "quantclass_sync_internal.data_query.report_dir_path" ,
429+ return_value = self .log_dir ,
430+ ):
431+ overview = get_products_overview (
432+ self .data_root ,
433+ ["coin-cap" ],
434+ today = date (2026 , 3 , 13 ),
435+ )
436+
437+ self .assertEqual (overview [0 ]["days_behind" ], 0 )
438+ self .assertEqual (overview [0 ]["status_color" ], "green" )
439+
411440 def test_overview_preserves_green_after_sync_when_api_cache_exists (self ):
412441 """同步结果为 up_to_date 时,若保留 API 缓存字段,总览仍应显示绿色。"""
413442 self ._write_timestamp ("coin-cap" , "2026-03-11" )
0 commit comments