Files
C.E.L_Slide_test2/docs/architecture/IMP-17-CARVE-OUT.md
kyeongmin e10ec36617 feat(IMP-17): AI repair fallback infra carve-out — design-only boundary + 3-cond AND gate
u1 — src/phase_z2_pipeline.py:564 route hint comment corrected from
non-existent IMP-31 to IMP-17 (carve-out, AI fallback only, normal path 밖).
Line 565 IMP-29 frontend override reference untouched.

u2 — docs/architecture/IMP-17-CARVE-OUT.md (new) defines:
- allowed scope (Step 12 restructure proposal, Step 16/17 retry fallback)
- forbidden scope (normal-path AI calls, MDX compression, HTML structure)
- 3-condition AND activation gate (User GO ∧ B4 frame_selection evidence
  ∧ IMP-04 catalog + IMP-05 V4 fallback live)
- pattern shape reference (link-only): content_editor.py:21,318 +
  sse_utils.py:16-50 (Phase Q Archive Candidate, no port)
- AI 격리 contract + Kei persona 단절 (permanent)

u3 — PHASE-Z-IMPLEMENTATION-ISSUE-BACKLOG.md:68 IMP-17 row gains
carve-out doc link + 3-cond AND gate pointer.

u4 — PHASE-Q-INSIGHT-TO-22STEP-MAP.md AI repair fallback infra registry
row prefixed with IMP-17 + carve-out link; normal_path=no preserved.

Anchor test: tests/orchestrator_unit/test_imp17_comment_anchor.py asserts
line 564 IMP-17 wording AND line 565 IMP-29 preservation (2 tests pass).

Runtime behavior change: 0. Only delta in executable file is one comment
line. Normal-path AI invocation count remains 0.

Refs: gitea #17

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 08:12:43 +09:00

4.0 KiB

IMP-17 — AI repair fallback infrastructure (carve-out)

Status: carve-out, design-only. Normal-path AI calls = 0. No runtime fallback code lands until the activation gate clears.

Source anchors

  • IMP-17 backlog row — PHASE-Z-IMPLEMENTATION-ISSUE-BACKLOG.md:68 (carve-out — normal path 밖, soft link IMP-04 + IMP-05).
  • INSIGHT-MAP §3 — PHASE-Q-INSIGHT-TO-22STEP-MAP.md (G3 AI repair fallback infra registry row, normal path = no).
  • 22-step pipeline — PHASE-Z-PIPELINE-OVERVIEW.md Step 12 (lines 280-287), Step 16 (lines 318-325), Step 17 (lines 326-333).
  • Pattern shape reference (Phase Q Archive — link-only, do not port) — src/content_editor.py:21,318 (httpx + retry shape, imports sse_utils) + src/sse_utils.py:16-50 (SSE token parser).
  • Route hint emission site — src/phase_z2_pipeline.py:564 (restructureai_adaptation_required route hint; deterministic emission today, AI consumer deferred to IMP-17).

Carve-out boundary

Allowed (fallback path only)

  • Step 12: when V4 emits restructure (route hint ai_adaptation_required) AND deterministic mapping cannot satisfy the frame contract, an AI proposal MAY be invoked to map content_objectInternal Region / Frame Slot. Output = placement proposal at content-object granularity. Frame selection, layout selection, zone topology remain deterministic.
  • Step 16 / 17: when retry router exhausts deterministic actions (zone_ratio_retry / layout_adjust / frame_reselect / details_popup_escalation / image_fit_candidate / frame_internal_fit_candidate) AND user-approved fallback budget remains, an AI proposal MAY be invoked. Output scope identical to Step 12 — content-object placement only.

Forbidden (any path)

  • Normal-path AI calls (Step 12 deterministic mapper, all other steps).
  • MDX 원문 요약·삭제·재작성 (Phase Z spacing direction guardrail: never compress text).
  • HTML / CSS 직접 생성, frame contract 신설, layout / zone topology 결정 (Layer-A / Layer-B planning은 코드 영역).
  • 공통 padding / spacing / tolerance 축소 (PZ-4 — no silent shrink).
  • 신규 IMP ID 발급 (이 carve-out 은 IMP-17 슬롯에 영구 귀속).

Activation gate (3-condition AND — all three required)

  1. User GO — 명시적 axis activation 요청. carve-out 자체로는 코드 작성 트리거 안 됨.
  2. B4 frame_selection evidence integration complete — Step 9 frame_selection 의 evidence trace 가 안정화되어야 fallback proposal 이 어떤 frame contract 안에서 동작해야 하는지 식별 가능.
  3. IMP-04 (catalog 확장) + IMP-05 (V4 fallback) live — 카탈로그가 32 frame 으로 확장되고 V4 rank-2/3 fallback 이 활성화돼야 ai_adaptation_required 라우트가 실제 의미를 가짐 (현재는 dead-end route hint).

세 조건 중 하나라도 미충족이면 본 carve-out 은 design-only 상태로 잠겨 있다.

Phase Q content_editor.pyArchive Candidate (PHASE-Q-AUDIT.md:660-673) — 포팅 대상 아님. 모양만 참조한다:

  • httpx async streaming + retry 구조 — src/content_editor.py:21,318 라인 부근 (import + stream_sse_tokens 호출 site).
  • SSE token 파서 분리 모듈 — src/sse_utils.py:16-50 (stream_sse_tokens 본체).
  • EDITOR_PROMPT (Kei persona) 및 Kei-API endpoint 는 영구 단절. 재사용 금지.

AI 격리 + Kei persona 단절 contract

  • AI 호출은 normal path 에 없다 (Phase Z 원칙, memory feedback_ai_isolation_contract).
  • 출력 단위는 항상 content_object / Internal Region / Frame Slot 또는 restructuring proposal — HTML 구조 / 레이아웃 / 프리셋 결정 X.
  • Phase Q 자산 (Kei persona prompts, Kei-API endpoint, persona retry semantics) 과 단절. Phase Z 의 fallback runtime 은 별도 prompt / endpoint 설계로 출발한다 (본 carve-out 활성 시).