xueyiming 20 часов назад
Родитель
Сommit
86c2567286

+ 15 - 4
api/services/video_discovery_records.py

@@ -14,6 +14,8 @@ from supply_infra.db.models.video_discovery import (
 )
 from supply_infra.db.session import get_session
 
+_MIN_VISIBLE_BIZ_DT = "20260730"
+
 
 def _json_value(raw: str | None) -> Any:
     if not raw:
@@ -207,7 +209,7 @@ def list_video_discovery_runs(
 ) -> dict[str, Any]:
     """List find-agent runs with live search and candidate counts."""
     with get_session() as session:
-        conditions = []
+        conditions = [VideoDiscoveryRun.biz_dt >= _MIN_VISIBLE_BIZ_DT]
         if biz_dt:
             conditions.append(VideoDiscoveryRun.biz_dt == biz_dt)
         if status:
@@ -249,7 +251,10 @@ def list_video_discovery_runs(
 def get_video_discovery_run(run_id: str) -> dict[str, Any] | None:
     with get_session() as session:
         row = session.scalar(
-            select(VideoDiscoveryRun).where(VideoDiscoveryRun.run_id == run_id)
+            select(VideoDiscoveryRun).where(
+                VideoDiscoveryRun.run_id == run_id,
+                VideoDiscoveryRun.biz_dt >= _MIN_VISIBLE_BIZ_DT,
+            )
         )
         if row is None:
             return None
@@ -266,7 +271,10 @@ def list_video_discovery_searches(
 ) -> dict[str, Any] | None:
     with get_session() as session:
         exists = session.scalar(
-            select(VideoDiscoveryRun.id).where(VideoDiscoveryRun.run_id == run_id)
+            select(VideoDiscoveryRun.id).where(
+                VideoDiscoveryRun.run_id == run_id,
+                VideoDiscoveryRun.biz_dt >= _MIN_VISIBLE_BIZ_DT,
+            )
         )
         if exists is None:
             return None
@@ -355,7 +363,10 @@ def list_video_discovery_candidates(
 ) -> dict[str, Any] | None:
     with get_session() as session:
         exists = session.scalar(
-            select(VideoDiscoveryRun.id).where(VideoDiscoveryRun.run_id == run_id)
+            select(VideoDiscoveryRun.id).where(
+                VideoDiscoveryRun.run_id == run_id,
+                VideoDiscoveryRun.biz_dt >= _MIN_VISIBLE_BIZ_DT,
+            )
         )
         if exists is None:
             return None

+ 1 - 0
prd/09-找视频记录展示设计.md

@@ -32,6 +32,7 @@
 ### 3.1 运行列表
 
 - 筛选:业务日、运行状态、需求词、种子标题、Run ID。
+- 数据范围:固定只展示 `biz_dt >= 20260730` 的运行及其搜索、候选记录。
 - 排序:创建时间倒序,同时间按主键倒序。
 - 摘要:需求词、状态、业务日、搜索页数、候选数。
 - 分页:后端分页,每页 20 条。

+ 27 - 0
tests/api/test_video_discovery_records.py

@@ -153,6 +153,33 @@ def test_lists_runs_with_live_relation_counts(monkeypatch) -> None:
     assert run["relevant_points"] == [{"point": "大字模式"}]
 
 
+def test_hides_runs_before_visible_date(monkeypatch) -> None:
+    factory = _patch_sessions(monkeypatch)
+    _seed(factory)
+
+    response = records_service.list_video_discovery_runs(limit=20, offset=0)
+
+    assert response["total"] == 1
+    assert [item["run_id"] for item in response["items"]] == ["find-001"]
+    assert records_service.get_video_discovery_run("find-002") is None
+    assert (
+        records_service.list_video_discovery_searches(
+            "find-002",
+            limit=20,
+            offset=0,
+        )
+        is None
+    )
+    assert (
+        records_service.list_video_discovery_candidates(
+            "find-002",
+            limit=20,
+            offset=0,
+        )
+        is None
+    )
+
+
 def test_lists_searches_and_candidates_with_filters(monkeypatch) -> None:
     factory = _patch_sessions(monkeypatch)
     _seed(factory)