chore: snapshot in-progress question-gen work before preflight fixes

This commit is contained in:
2026-07-16 04:12:21 -04:00
parent 11a5545f57
commit a4c429b247
39 changed files with 738 additions and 283 deletions
+11 -33
View File
@@ -126,9 +126,7 @@ def prompts_dir(tmp_path: Path) -> Path:
class TestObserveFrameNormal:
"""两轮正常执行(verify=True)。"""
def test_two_round_normal(
self, frame_files: list[Path], prompts_dir: Path
) -> None:
def test_two_round_normal(self, frame_files: list[Path], prompts_dir: Path) -> None:
from app.search.vision import observe_frame
vlm = FakeVLMProvider(responses=["raw evidence", "verified ok"])
@@ -158,9 +156,7 @@ class TestObserveFrameNormal:
class TestObserveFrameExtractOnly:
"""verify=False 仅执行提取轮。"""
def test_extract_only(
self, frame_files: list[Path], prompts_dir: Path
) -> None:
def test_extract_only(self, frame_files: list[Path], prompts_dir: Path) -> None:
from app.search.vision import observe_frame
vlm = FakeVLMProvider(responses=["only extract"])
@@ -183,9 +179,7 @@ class TestObserveFrameExtractOnly:
class TestObserveFrameOCRInjection:
"""OCR 注入:文本非空时并置于问题前。"""
def test_ocr_injected(
self, frame_files: list[Path], prompts_dir: Path
) -> None:
def test_ocr_injected(self, frame_files: list[Path], prompts_dir: Path) -> None:
from app.search.vision import observe_frame
vlm = FakeVLMProvider(responses=["evidence with ocr"])
@@ -216,9 +210,7 @@ class TestObserveFrameOCRInjection:
class TestObserveFrameOCRFailDegrades:
"""OCR 转录抛出异常时降级:不注入 OCR、ocr_failed=1。"""
def test_ocr_failure_degrades(
self, frame_files: list[Path], prompts_dir: Path
) -> None:
def test_ocr_failure_degrades(self, frame_files: list[Path], prompts_dir: Path) -> None:
from app.search.vision import observe_frame
vlm = FakeVLMProvider(responses=["evidence no ocr"])
@@ -245,9 +237,7 @@ class TestObserveFrameOCRFailDegrades:
class TestObserveFrameOCRNone:
"""ocr=None 时不执行转录。"""
def test_ocr_none(
self, frame_files: list[Path], prompts_dir: Path
) -> None:
def test_ocr_none(self, frame_files: list[Path], prompts_dir: Path) -> None:
from app.search.vision import observe_frame
vlm = FakeVLMProvider(responses=["no ocr"])
@@ -274,9 +264,7 @@ class TestObserveFrameOCRNone:
class TestObserveFrameVLMExtractFailure:
"""VLM 提取轮失败 → 返回 [VL错误]。"""
def test_vlm_extract_failure(
self, frame_files: list[Path], prompts_dir: Path
) -> None:
def test_vlm_extract_failure(self, frame_files: list[Path], prompts_dir: Path) -> None:
from app.search.vision import observe_frame
vlm = FakeVLMProvider(raises=[RuntimeError("VLM timeout")])
@@ -302,9 +290,7 @@ class TestObserveFrameVLMExtractFailure:
class TestObserveFrameVLMVerifyFailureDegrades:
"""VLM 验证轮失败 → 降级:保留提取结果 + [验证] 跳过。"""
def test_vlm_verify_failure_degrades(
self, frame_files: list[Path], prompts_dir: Path
) -> None:
def test_vlm_verify_failure_degrades(self, frame_files: list[Path], prompts_dir: Path) -> None:
from app.search.vision import observe_frame
vlm = FakeVLMProvider(
@@ -359,9 +345,7 @@ class TestObserveFrameFileMissing:
class TestObserveFrameStatsKeys:
"""stats 包含全部五个预期键。"""
def test_stats_keys_complete(
self, frame_files: list[Path], prompts_dir: Path
) -> None:
def test_stats_keys_complete(self, frame_files: list[Path], prompts_dir: Path) -> None:
from app.search.vision import observe_frame
vlm = FakeVLMProvider(responses=["evidence"])
@@ -386,9 +370,7 @@ class TestObserveFrameStatsKeys:
class TestObserveFrameDiscrepancyAndAbstain:
"""VLM 返回含 '分歧''[证据不存在]' 时对应 stats 标记。"""
def test_discrepancy_flag(
self, frame_files: list[Path], prompts_dir: Path
) -> None:
def test_discrepancy_flag(self, frame_files: list[Path], prompts_dir: Path) -> None:
from app.search.vision import observe_frame
vlm = FakeVLMProvider(responses=["发现分歧:OCR 与画面不一致"])
@@ -408,9 +390,7 @@ class TestObserveFrameDiscrepancyAndAbstain:
assert collected[0]["discrepancy"] == 1
def test_abstain_flag(
self, frame_files: list[Path], prompts_dir: Path
) -> None:
def test_abstain_flag(self, frame_files: list[Path], prompts_dir: Path) -> None:
from app.search.vision import observe_frame
vlm = FakeVLMProvider(responses=["[证据不存在] 无法判断"])
@@ -434,9 +414,7 @@ class TestObserveFrameDiscrepancyAndAbstain:
class TestObserveFrameTelemetryPassthrough:
"""session_id 和 parent_call_id 透传到 VLM 调用。"""
def test_telemetry_passthrough(
self, frame_files: list[Path], prompts_dir: Path
) -> None:
def test_telemetry_passthrough(self, frame_files: list[Path], prompts_dir: Path) -> None:
from app.search.vision import observe_frame
vlm = FakeVLMProvider(responses=["evidence"])