- src: phase_z2 composition/mapper/pipeline/placement_planner/retry, ai_fallback(prompts/schema/validate), mdx_text_atoms 신규 - Front: PipelineTracePanel 신규, FramePanel/SlideCanvas/Home/designAgentApi 등 갱신 + 테스트 4종 추가 - templates/phase_z2: catalog(component_expansion_registry, node_slot_mapping 신규), frames, families, slide_base 갱신 - tests/matching: phase2~26 매칭 실험 스크립트·리포트·온톨로지 전체 (미커밋 진행분) - tests: b4_v4 evidence, task5~28.5 시리즈, regression(imp95 baseline) 등 신규 테스트 대량 추가 - docs/reference: MDX 구조 인벤토리, MDX→Frame 구조 계약 문서 - scripts: mdx 계약/parity/coverage/viewport 체크, gitea comment, run sync 유틸 - .gitignore: tmp*.json, chromedriver, .orchestrator, *.pkl, Front_test* 등 임시/스냅샷 제외 미완성 작업의 보존용 스냅샷 커밋 (2026-07-02) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
"""IMP-33 u2 — AiFallbackProposal schema tests.
|
|
|
|
Scope (Stage 2 plan, u2):
|
|
- Whitelisted proposal_kind values are accepted.
|
|
- Forbidden output forms are rejected: mdx_text / frame_id_change / raw_html / raw_css.
|
|
- extra fields outside the declared schema are rejected (MDX read-only signal).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
from pydantic import ValidationError
|
|
|
|
from src.phase_z2_ai_fallback import AiFallbackProposal, ProposalKind
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"kind_value",
|
|
[
|
|
"builder_options_patch",
|
|
"partial_overrides",
|
|
"slot_mapping_proposal",
|
|
"design_adaptation_plan",
|
|
],
|
|
)
|
|
def test_whitelisted_proposal_kinds_accepted(kind_value: str) -> None:
|
|
proposal = AiFallbackProposal(proposal_kind=kind_value)
|
|
assert proposal.proposal_kind == ProposalKind(kind_value)
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"forbidden",
|
|
["mdx_text", "frame_id_change", "raw_html", "raw_css"],
|
|
)
|
|
def test_forbidden_proposal_kinds_rejected(forbidden: str) -> None:
|
|
with pytest.raises(ValidationError):
|
|
AiFallbackProposal(proposal_kind=forbidden)
|
|
|
|
|
|
def test_unknown_proposal_kind_rejected() -> None:
|
|
with pytest.raises(ValidationError):
|
|
AiFallbackProposal(proposal_kind="something_else")
|
|
|
|
|
|
def test_extra_fields_rejected() -> None:
|
|
"""`extra=forbid` keeps the AI from smuggling raw_html/mdx_text alongside a valid kind."""
|
|
with pytest.raises(ValidationError):
|
|
AiFallbackProposal(proposal_kind="partial_overrides", raw_html="<div/>")
|