Files
C.E.L_Slide_test2/tests/test_phase_z2_ai_fallback_config.py
kyeongmin c864fe0479 feat(#61): IMP-33 AI fallback scaffolding (u1~u11, flag default OFF)
Frame-aware AI fallback module scaffolded under src/phase_z2_ai_fallback/
with master flag ai_fallback_enabled=False; normal-path AI call count
remains 0. AI output constrained to builder_options_patch /
partial_overrides / slot_mapping_proposal; MDX / frame_id / raw HTML /
raw CSS mutations rejected at schema layer. IMP-46 cache gate (cache.py)
raises AiFallbackCacheGateError unless visual_check_passed AND
user_approved. Step 12 wires AI repair after IMP-30 provisional payload
only; Step 17 stays blocked behind IMP-34 / IMP-35 prerequisites.
AST isolation guard forbids fallback package from importing Phase Q /
Kei / pipeline runtime symbols. Docs IMP-17 / IMP-31 bound to runtime
module surface via 11-row structural test pin (test_docs_sync.py) so
drift fails CI.

Tests: 116 fallback / 161 phase_z2 regression / 526 scoped full sweep
all passing. Existing pre-IMP-33 fixture issue in scripts/test_phase_t_*
remains untouched (out of scope).

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

47 lines
1.6 KiB
Python

"""IMP-33 u1 — AI fallback Settings defaults (locked).
These defaults are the binding contract from Stage 2 plan (per-unit u1):
- ai_fallback_enabled = False (master flag OFF; fallback path only)
- ai_fallback_model = "claude-opus-4-6-20250415"
- ai_fallback_timeout_s = 60.0
- ai_fallback_max_retries = 3
- ai_fallback_backoff_base_s = 1.0
- ai_fallback_backoff_cap_s = 8.0
- ai_fallback_backoff_jitter = 0.3
- ai_fallback_budget_per_run = 10
- ai_fallback_circuit_breaker_threshold = 5
Downstream u4 (client) MUST source timeout/retry/backoff/budget/circuit from
Settings; inline literals are forbidden by Stage 2 plan.
"""
from __future__ import annotations
from src.config import Settings
def test_ai_fallback_master_flag_default_off() -> None:
s = Settings()
assert s.ai_fallback_enabled is False, (
"AI fallback master flag MUST default OFF (normal path AI=0 contract)."
)
def test_ai_fallback_model_default_locked() -> None:
s = Settings()
assert s.ai_fallback_model == "claude-opus-4-6-20250415"
def test_ai_fallback_retry_timeout_backoff_defaults_locked() -> None:
s = Settings()
assert s.ai_fallback_timeout_s == 60.0
assert s.ai_fallback_max_retries == 3
assert s.ai_fallback_backoff_base_s == 1.0
assert s.ai_fallback_backoff_cap_s == 8.0
assert s.ai_fallback_backoff_jitter == 0.3
def test_ai_fallback_budget_and_circuit_defaults_locked() -> None:
s = Settings()
assert s.ai_fallback_budget_per_run == 10
assert s.ai_fallback_circuit_breaker_threshold == 5