fix(detector): 移除 ongoing_actions/visible_entities 空字段检测 + 新增 repair sh

抽检确认这两个字段为空是合法内容状态(静物/黑帧/模糊帧),
VLM 重修也修不好,保留会导致断点续跑死循环。
L3 空字段检测缩减为 frame_summary + spatial_layout。
This commit is contained in:
2026-07-09 00:54:27 -04:00
parent 86573735aa
commit 8c383354c5
3 changed files with 38 additions and 14 deletions
+8 -8
View File
@@ -119,25 +119,25 @@ class TestDetectIssues:
issues = detect_issues(index)
assert any(i.issue_type == "no_children" and i.level == 1 for i in issues)
def test_empty_visible_entities(self) -> None:
"""visible_entities 为空触发 empty_field。"""
def test_empty_visible_entities_not_flagged(self) -> None:
"""visible_entities 为空是合法状态(静物/黑帧),不触发 empty_field。"""
card = L3Card("正常描述", [], ["动作"], [], "居中", {})
l3 = L3Node(id="l1_0_l2_0_l3_0", card=card, timestamp=1.0)
l2 = L2Node(id="l1_0_l2_0", card=_card_l2(), time_range=(0.0, 10.0), children=[l3])
l1 = L1Node(id="l1_0", card=_card_l1(), time_range=(0.0, 10.0), children=[l2])
index = TreeIndex(metadata=IndexMeta("/t.mp4", "video"), roots=[l1])
issues = detect_issues(index)
assert any(i.issue_type == "empty_field" and "visible_entities" in i.details for i in issues)
assert not any(i.issue_type == "empty_field" for i in issues)
def test_empty_ongoing_actions(self) -> None:
"""ongoing_actions 为空触发 empty_field。"""
def test_empty_ongoing_actions_not_flagged(self) -> None:
"""ongoing_actions 为空是合法状态(静物/黑帧),不触发 empty_field。"""
card = L3Card("正常描述", ["实体"], [], [], "居中", {})
l3 = L3Node(id="l1_0_l2_0_l3_0", card=card, timestamp=1.0)
l2 = L2Node(id="l1_0_l2_0", card=_card_l2(), time_range=(0.0, 10.0), children=[l3])
l1 = L1Node(id="l1_0", card=_card_l1(), time_range=(0.0, 10.0), children=[l2])
index = TreeIndex(metadata=IndexMeta("/t.mp4", "video"), roots=[l1])
issues = detect_issues(index)
assert any(i.issue_type == "empty_field" and "ongoing_actions" in i.details for i in issues)
assert not any(i.issue_type == "empty_field" for i in issues)
def test_empty_spatial_layout(self) -> None:
"""spatial_layout 为空也触发 empty_field。"""
@@ -150,7 +150,7 @@ class TestDetectIssues:
assert any(i.issue_type == "empty_field" and "spatial_layout" in i.details for i in issues)
def test_multiple_empty_fields_single_issue(self) -> None:
"""多个字段同时为空只产生一个 issue,details 列出所有空字段。"""
"""多个必填字段同时为空只产生一个 issue,details 列出所有空字段。"""
card = L3Card("", [], [], [], "", {})
l3 = L3Node(id="l1_0_l2_0_l3_0", card=card, timestamp=1.0)
l2 = L2Node(id="l1_0_l2_0", card=_card_l2(), time_range=(0.0, 10.0), children=[l3])
@@ -159,7 +159,7 @@ class TestDetectIssues:
issues = [i for i in detect_issues(index) if i.issue_type == "empty_field"]
assert len(issues) == 1
assert "frame_summary" in issues[0].details
assert "visible_entities" in issues[0].details
assert "spatial_layout" in issues[0].details
def test_time_gap(self) -> None:
l3_a = L3Node(id="l1_0_l2_0_l3_0", card=_card_l3(), timestamp=1.0)