- 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>
94 lines
3.2 KiB
Python
94 lines
3.2 KiB
Python
from pathlib import Path
|
|
from types import SimpleNamespace
|
|
|
|
from phase_z2_composition import select_layout_preset
|
|
from phase_z2_pipeline import _build_task24_layout_decision_basis, parse_mdx
|
|
|
|
|
|
def _sample_mdx(prefix: str) -> Path:
|
|
for path in sorted(Path("samples/mdx").glob(f"{prefix}*.mdx")):
|
|
if "(원본)" not in path.name:
|
|
return path
|
|
raise AssertionError(f"sample mdx not found for prefix {prefix!r}")
|
|
|
|
|
|
def _unit(section_id: str):
|
|
return SimpleNamespace(source_section_ids=[section_id])
|
|
|
|
|
|
def _zone(position: str, template_id: str = "frame"):
|
|
return {
|
|
"position": position,
|
|
"template_id": template_id,
|
|
"content_weight": {
|
|
"score": 1.0,
|
|
"text_length": 100,
|
|
"subsection_count": 2,
|
|
},
|
|
"min_height_px": 120,
|
|
}
|
|
|
|
|
|
def test_task24_mdx01_intro_counts_as_top_level_body_zone():
|
|
_, sections, footer = parse_mdx(_sample_mdx("01."))
|
|
units = [_unit(s.section_id) for s in sections]
|
|
|
|
assert [s.section_id for s in sections] == ["01-intro", "01-1", "01-2"]
|
|
assert select_layout_preset(units) == "top-1-bottom-2"
|
|
|
|
basis = _build_task24_layout_decision_basis(
|
|
units=units,
|
|
zones_data=[_zone("top"), _zone("bottom-left"), _zone("bottom-right")],
|
|
slide_footer=footer,
|
|
layout_preset="top-1-bottom-2",
|
|
auto_layout_preset="top-1-bottom-2",
|
|
layout_override_applied=False,
|
|
)
|
|
|
|
assert basis["task24"] == "normalized_top_level_unit_layout"
|
|
assert basis["top_level_unit_count"] == 3
|
|
assert basis["zone_count"] == 3
|
|
assert basis["summary_footer_excluded_from_zone_count"] is True
|
|
assert basis["unit_source_section_ids"] == [["01-intro"], ["01-1"], ["01-2"]]
|
|
|
|
|
|
def test_task24_registered_component_expansion_stays_frame_internal():
|
|
_, sections, footer = parse_mdx(_sample_mdx("02."))
|
|
units = [_unit(s.section_id) for s in sections]
|
|
|
|
assert [s.section_id for s in sections] == ["02-1", "02-2"]
|
|
assert select_layout_preset(units) == "horizontal-2"
|
|
assert sections[1].sub_sections
|
|
assert sections[1].sub_sections[0]["component"] == "DxEffect"
|
|
|
|
basis = _build_task24_layout_decision_basis(
|
|
units=units,
|
|
zones_data=[_zone("top"), _zone("bottom")],
|
|
slide_footer=footer,
|
|
layout_preset="horizontal-2",
|
|
auto_layout_preset="horizontal-2",
|
|
layout_override_applied=False,
|
|
)
|
|
|
|
assert basis["top_level_unit_count"] == 2
|
|
assert basis["zone_count"] == 2
|
|
assert basis["unit_source_section_ids"] == [["02-1"], ["02-2"]]
|
|
assert "component expansions are frame-internal" in basis["policy"]
|
|
|
|
|
|
def test_task24_footer_never_increases_body_zone_count():
|
|
units = [_unit("09-1"), _unit("09-2")]
|
|
basis = _build_task24_layout_decision_basis(
|
|
units=units,
|
|
zones_data=[_zone("top"), _zone("bottom")],
|
|
slide_footer="Source footer text",
|
|
layout_preset="horizontal-2",
|
|
auto_layout_preset="horizontal-2",
|
|
layout_override_applied=False,
|
|
)
|
|
|
|
assert basis["fixed_footer_present"] is True
|
|
assert basis["summary_footer_excluded_from_zone_count"] is True
|
|
assert basis["top_level_unit_count"] == 2
|
|
assert basis["zone_count"] == 2
|