test: 통합 스냅샷 재생성 스크립트 추가 + 회귀 테스트 갱신 (#29 후속 작업분)
Multi-MDX Regression (IMP-91) / multi-mdx-regression (push) Failing after 9m49s
Multi-MDX Regression (IMP-91) / multi-mdx-regression (push) Failing after 9m49s
- tests/integration/scripts/regenerate_snapshots.py: 스냅샷 일괄 재생성 도구 - 통합 스냅샷 9종 갱신, 회귀/유닛 테스트 7건 보강 - ISSUE_DRAFTS_2026-07-02.md: 7/2 전수 검토 이슈 초안 보존 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ only pins the artifact-production contract.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -41,33 +42,48 @@ class PipelineRun(NamedTuple):
|
||||
run_dir: Path
|
||||
|
||||
|
||||
def run_pipeline_for_snapshot(mdx_id: str, run_id: str) -> "PipelineRun":
|
||||
"""단일 mdx 를 스냅샷 계약 환경으로 실행 (issue #29 에서 fixture 에서 추출).
|
||||
|
||||
AI_FALLBACK_ENABLED=false 강제 — 스냅샷 런은 결정론이어야 하고
|
||||
[[feedback_ai_isolation_contract]] 상 ``ai_called`` 기본값은 False.
|
||||
로컬 .env 가 데모용으로 AI 를 켜 두어도 (pydantic-settings 는 실제
|
||||
env var 가 .env 보다 우선) CI/스냅샷 계약은 영향받지 않는다.
|
||||
tests/integration/scripts/regenerate_snapshots.py 가 동일 함수를
|
||||
재사용해 스냅샷 갱신 절차와 테스트 실행 환경의 표류를 방지한다.
|
||||
"""
|
||||
env = {**os.environ, "AI_FALLBACK_ENABLED": "false"}
|
||||
cp = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"-m",
|
||||
"src.phase_z2_pipeline",
|
||||
str(SAMPLES_DIR / f"{mdx_id}.mdx"),
|
||||
run_id,
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=360,
|
||||
cwd=str(REPO_ROOT),
|
||||
env=env,
|
||||
)
|
||||
return PipelineRun(
|
||||
mdx_id=mdx_id,
|
||||
run_id=run_id,
|
||||
returncode=cp.returncode,
|
||||
stdout=cp.stdout,
|
||||
stderr=cp.stderr,
|
||||
run_dir=RUNS_DIR / run_id / "phase_z2",
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def multi_mdx_runs() -> Dict[str, PipelineRun]:
|
||||
"""Run the Phase Z pipeline once per mdx in ``MDX_SET`` (session-cached)."""
|
||||
cache: Dict[str, PipelineRun] = {}
|
||||
for mdx_id in MDX_SET:
|
||||
run_id = f"imp91_{mdx_id}_{uuid.uuid4().hex[:8]}"
|
||||
cp = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"-m",
|
||||
"src.phase_z2_pipeline",
|
||||
str(SAMPLES_DIR / f"{mdx_id}.mdx"),
|
||||
run_id,
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=360,
|
||||
cwd=str(REPO_ROOT),
|
||||
)
|
||||
cache[mdx_id] = PipelineRun(
|
||||
mdx_id=mdx_id,
|
||||
run_id=run_id,
|
||||
returncode=cp.returncode,
|
||||
stdout=cp.stdout,
|
||||
stderr=cp.stderr,
|
||||
run_dir=RUNS_DIR / run_id / "phase_z2",
|
||||
)
|
||||
cache[mdx_id] = run_pipeline_for_snapshot(mdx_id, run_id)
|
||||
return cache
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user