wip: phase_z2 evidence 파이프라인 + matching 실험(phase2~26) + 프론트 trace 패널 진행분 스냅샷
- 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>
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
from pathlib import Path
|
||||
from uuid import uuid4
|
||||
|
||||
from src.phase_z2_pipeline import (
|
||||
_apply_section_id_aliases_to_overrides,
|
||||
_build_section_id_aliases,
|
||||
_infer_layout_from_zone_section_keys,
|
||||
parse_mdx,
|
||||
)
|
||||
|
||||
|
||||
def _tmp_mdx(name: str) -> Path:
|
||||
base = Path("data") / "_tmp_task22_tests" / uuid4().hex
|
||||
base.mkdir(parents=True, exist_ok=True)
|
||||
return base / name
|
||||
|
||||
|
||||
def test_t22_pre_intro_is_promoted_to_stable_unit():
|
||||
mdx = _tmp_mdx("01.sample.mdx")
|
||||
mdx.write_text(
|
||||
"""---
|
||||
title: Sample
|
||||
---
|
||||
|
||||
import Something from './x.astro';
|
||||
|
||||
- **Intro label**
|
||||
- Intro body text
|
||||
|
||||
<br/>
|
||||
---
|
||||
|
||||
## 1. First section
|
||||
|
||||
- First body
|
||||
|
||||
## 2. Second section
|
||||
|
||||
- Second body
|
||||
""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
title, sections, footer = parse_mdx(mdx)
|
||||
|
||||
assert title == "Sample"
|
||||
assert footer is None
|
||||
assert [s.section_id for s in sections] == ["01-intro", "01-1", "01-2"]
|
||||
assert sections[0].section_num == 0
|
||||
assert sections[0].title == "Intro label"
|
||||
assert "Intro body text" in sections[0].raw_content
|
||||
assert "import Something" not in sections[0].raw_content
|
||||
assert "---" not in sections[0].raw_content
|
||||
|
||||
|
||||
def test_t22_import_only_preamble_does_not_create_intro_unit():
|
||||
mdx = _tmp_mdx("02.sample.mdx")
|
||||
mdx.write_text(
|
||||
"""---
|
||||
title: Sample
|
||||
---
|
||||
|
||||
import DxEffect from './dx.astro';
|
||||
|
||||
## 1. Body
|
||||
|
||||
- Body text
|
||||
""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
_, sections, _ = parse_mdx(mdx)
|
||||
|
||||
assert [s.section_id for s in sections] == ["02-1"]
|
||||
|
||||
|
||||
def test_t22_intro_alias_rewrites_orphan_section_overrides():
|
||||
_, sections, _ = parse_mdx(_write_intro_fixture("01.sample.mdx"))
|
||||
aliases = _build_section_id_aliases(sections)
|
||||
|
||||
assignments, frames, trace = _apply_section_id_aliases_to_overrides(
|
||||
{"top-left": ["01-1"], "top-right": ["01-2"], "bottom": ["01-3"]},
|
||||
{"01-3": "bim_dx_comparison_table"},
|
||||
aliases,
|
||||
)
|
||||
|
||||
assert aliases["01-3"] == "01-intro"
|
||||
assert assignments["bottom"] == ["01-intro"]
|
||||
assert frames["01-intro"] == "bim_dx_comparison_table"
|
||||
assert trace["applied"] is True
|
||||
assert trace["zone_section_rewrites"] == [
|
||||
{"zone_id": "bottom", "from": "01-3", "to": "01-intro"}
|
||||
]
|
||||
|
||||
|
||||
def test_t22_manual_zone_keys_can_infer_matching_layout():
|
||||
inferred = _infer_layout_from_zone_section_keys(
|
||||
{"top-left": ["01-1"], "top-right": ["01-2"], "bottom": ["01-intro"]},
|
||||
unit_count=3,
|
||||
)
|
||||
|
||||
assert inferred == "top-2-bottom-1"
|
||||
|
||||
|
||||
def _write_intro_fixture(name: str) -> Path:
|
||||
mdx = _tmp_mdx(name)
|
||||
mdx.write_text(
|
||||
"""---
|
||||
title: Sample
|
||||
---
|
||||
|
||||
- **Intro label**
|
||||
- Intro body text
|
||||
|
||||
## 1. First section
|
||||
|
||||
- First body
|
||||
|
||||
## 2. Second section
|
||||
|
||||
- Second body
|
||||
""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
return mdx
|
||||
|
||||
Reference in New Issue
Block a user