Add Phase Z B4 gatekeeper feature flag
- gate V4/B4 mismatch zones via PHASE_Z_B4_GATEKEEPER env (default OFF) - record mismatch as adapter_needed_units with reason and mismatch_detail - preserve render path byte-identical when flag unset
This commit is contained in:
@@ -26,6 +26,7 @@ MVP-1.5b spec :
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
@@ -1089,6 +1090,30 @@ def run_phase_z2_mvp1(mdx_path: Path, run_id: Optional[str] = None) -> Path:
|
|||||||
}
|
}
|
||||||
# ─── end trace-only runtime 연결 v0 ───
|
# ─── end trace-only runtime 연결 v0 ───
|
||||||
|
|
||||||
|
# ─── B4 gatekeeper (Q-V4B4 / PHASE_Z_B4_GATEKEEPER, default OFF) ───
|
||||||
|
if (
|
||||||
|
os.environ.get("PHASE_Z_B4_GATEKEEPER", "").strip().lower()
|
||||||
|
in {"1", "true", "yes"}
|
||||||
|
and not matches_mapper
|
||||||
|
):
|
||||||
|
adapter_record = {
|
||||||
|
"position": position,
|
||||||
|
"source_section_ids": unit.source_section_ids,
|
||||||
|
"merge_type": unit.merge_type,
|
||||||
|
"template_id": unit.frame_template_id,
|
||||||
|
"reason": "v4_b4_mismatch",
|
||||||
|
"mismatch_detail": {
|
||||||
|
"v4_template_id": mapper_frame_template_id,
|
||||||
|
"b4_selected_template_id": placement_plan.selected_template_id,
|
||||||
|
"match_note": match_note,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
adapter_needed_units.append(adapter_record)
|
||||||
|
print(f" adapter : zone--{position} {unit.source_section_ids} → "
|
||||||
|
f"{unit.frame_template_id} v4_b4_mismatch → adapter_needed (skip render)")
|
||||||
|
continue
|
||||||
|
# ─── end B4 gatekeeper ───
|
||||||
|
|
||||||
# mapper 시도 — 실패 (FitError) 시 zone 을 adapter_needed 로 표시하고 skip
|
# mapper 시도 — 실패 (FitError) 시 zone 을 adapter_needed 로 표시하고 skip
|
||||||
try:
|
try:
|
||||||
slot_payload = map_mdx_to_slots(synth_section, unit.frame_template_id)
|
slot_payload = map_mdx_to_slots(synth_section, unit.frame_template_id)
|
||||||
@@ -1098,6 +1123,7 @@ def run_phase_z2_mvp1(mdx_path: Path, run_id: Optional[str] = None) -> Path:
|
|||||||
"source_section_ids": unit.source_section_ids,
|
"source_section_ids": unit.source_section_ids,
|
||||||
"merge_type": unit.merge_type,
|
"merge_type": unit.merge_type,
|
||||||
"template_id": unit.frame_template_id,
|
"template_id": unit.frame_template_id,
|
||||||
|
"reason": "fit_error",
|
||||||
"fit_error": str(e),
|
"fit_error": str(e),
|
||||||
}
|
}
|
||||||
adapter_needed_units.append(adapter_record)
|
adapter_needed_units.append(adapter_record)
|
||||||
|
|||||||
Reference in New Issue
Block a user