Files
C.E.L_Slide_test2/.orchestrator/drafts/61_r11_payload.json
T

1 line
9.5 KiB
JSON

{"body": "[Claude #15] Stage 3 code-edit — IMP-33 #61 (R11 u11)\n\nExecuting unit: u11\n\n■ unit_executed\n- id: u11\n- summary: Docs sync — narrow scope per Stage 2 plan (\"the binding runtime state, module path, Step 12/17 state, cascade order, and IMP-46 gate\"). Updates [`docs/architecture/IMP-17-CARVE-OUT.md`](docs/architecture/IMP-17-CARVE-OUT.md) and [`docs/architecture/IMP-31-GATE-AUDIT.md`](docs/architecture/IMP-31-GATE-AUDIT.md) so the design-only language is replaced with binding references to the IMP-33 u1~u10 runtime module surface. Adds [`tests/phase_z2_ai_fallback/test_docs_sync.py`](tests/phase_z2_ai_fallback/test_docs_sync.py) as a structural pin so future drift between code and docs fails the test suite (not silently rotted prose).\n\n■ files_changed\n- docs/architecture/IMP-17-CARVE-OUT.md (EDIT, +13 / -2)\n- docs/architecture/IMP-31-GATE-AUDIT.md (EDIT, +5 / -5)\n- tests/phase_z2_ai_fallback/test_docs_sync.py (NEW, 61 lines, 11 parametrised cases + 1 standalone test)\n\n■ diff_summary\n- `docs/architecture/IMP-17-CARVE-OUT.md`:\n - Status line: \"carve-out, **design-only**\" → \"carve-out infra **scaffolded under IMP-33** (issue #61, Stage 3 u1~u11)\". Adds explicit PZ-1 note: `ai_fallback_enabled` flag default `False` in `src/config.py` (u1), Step 12 entry provisional-gated (u8), Step 17 entry structurally blocked behind IMP-34 + IMP-35 (u9).\n - NEW §\"Runtime module surface (IMP-33 u1~u11 binding)\" table — single source of truth for downstream consumers. Six rows:\n 1. **Module path** — `src/phase_z2_ai_fallback/`, cross-linked to [`IMP-31-GATE-AUDIT.md`](docs/architecture/IMP-31-GATE-AUDIT.md):31,50,56 (Stage 1 binding lock).\n 2. **Step 12 entry** — `src.phase_z2_ai_fallback.step12.gather_step12_ai_repair_proposals`; records the three structural gates (`not_provisional` skip, `design_reference_only_no_ai` skip, non-AI route catch-all) that run BEFORE `route_ai_fallback`. Mirrors the u8 contract exactly.\n 3. **Step 17 entry** — `src.phase_z2_ai_fallback.step17.gather_step17_ai_repair_proposals`; explicit STRUCTURALLY BLOCKED label with the `step17_ai_blocked_imp_34_35_prerequisites_missing` sentinel + the import-graph guarantee (does NOT import `route_ai_fallback` / `AiFallbackClient` / `anthropic`).\n 4. **Cascade order** — `OVERFLOW_CASCADE_ORDER = (DETERMINISTIC, POPUP, AI_REPAIR, USER_OVERRIDE)`. Cross-references line 16 of this same doc (the carve-out \"deterministic → popup → AI → user override\" prose) so the doc text and the code constant stay aligned.\n 5. **IMP-46 cache gate** — `save_proposal(..., visual_check_passed, user_approved)` raises `AiFallbackCacheGateError` unless BOTH gates are True; storage backend then raises `NotImplementedError` (the IMP-46 marker). `read_proposal` returns `None` until IMP-46 lands a backend.\n 6. **AST isolation** — `tests/phase_z2_ai_fallback/test_ast_isolation.py` whitelist (`src.config` + intra-package + stdlib + `anthropic` + `pydantic`) + Phase Q / Kei / `src.phase_z2_*` (non-fallback) blacklist. This is the structural invariant that protects PZ-1 at the import boundary, not at the runtime branch.\n\n- `docs/architecture/IMP-31-GATE-AUDIT.md`:\n - Verdict line (§3 below the 3-condition table): \"Runtime AI adaptation remains design-only. `src/phase_z2_ai_fallback/` = declaration-only path (not created this cycle)\" → \"Runtime AI adaptation remains gated. `src/phase_z2_ai_fallback/` = **scaffolded under IMP-33** (#61, Stage 3 u1~u11); module created, but `settings.ai_fallback_enabled` defaults to `False` (u1) so normal-path AI call count remains 0 (PZ-1). Runtime engagement still requires the 3-condition AND gate above.\" Gate verdict itself (NOT CLEAR) is unchanged — only the module-existence sub-clause is corrected.\n - §\"Out of scope (this cycle)\": removed the now-stale `src/phase_z2_ai_fallback/` directory-creation exclusion (the directory exists), kept everything else (runtime AI consumer enablement, candidate_evidence schema change, Phase Q file mutation, Kei API reuse, IMP-29 frontend override, IMP-30 invariant change, calculate_fit migration), and added a cross-link to [`IMP-17-CARVE-OUT.md`](docs/architecture/IMP-17-CARVE-OUT.md) §\"Runtime module surface\" so the audit reader can find the binding surface in one hop.\n - §\"Future activation path\": dropped \"declaration only\" qualifier (path now exists), updated the module-path bullet to \"scaffolded under IMP-33; flag default OFF until gate clears\" so the 3-condition activation contract reads correctly post-u1~u10.\n\n- `tests/phase_z2_ai_fallback/test_docs_sync.py` (NEW):\n - Stage 2 lists \"u11=docs sync verification\" as the test deliverable. This file IS that verification.\n - 1 parametrised function (`test_carve_out_doc_references_runtime_surface`) over 10 needles covering every axis Stage 2 listed for u11:\n - `src/phase_z2_ai_fallback/` (module path)\n - `gather_step12_ai_repair_proposals` (Step 12 entry, u8)\n - `gather_step17_ai_repair_proposals` (Step 17 entry, u9)\n - `step17_ai_blocked_imp_34_35_prerequisites_missing` (Step 17 blocked sentinel, u9)\n - `OVERFLOW_CASCADE_ORDER` (cascade single source of truth, u9)\n - `(DETERMINISTIC, POPUP, AI_REPAIR, USER_OVERRIDE)` (cascade order content, u9)\n - `visual_check_passed`, `user_approved` (IMP-46 gate flags, u6)\n - `AiFallbackCacheGateError` (IMP-46 gate exception, u6)\n - `ai_fallback_enabled` (PZ-1 flag default OFF, u1)\n - 1 standalone function (`test_gate_audit_reflects_scaffolded_module`) asserts the audit doc records (a) \"scaffolded under IMP-33\" (the binding state transition from \"not created this cycle\"), and (b) the `ai_fallback_enabled` flag (so future readers can see PZ-1 is preserved at the audit layer too).\n - Module path discovery via `Path(__file__).resolve().parents[2] / \"docs\" / \"architecture\"` — repo-root anchored, no `cwd` assumption, no test ordering dependency.\n - Failure path is loud: each parametrised case surfaces the missing needle in the assertion message, so a docs-drift failure names exactly which binding reference rotted.\n\n■ guardrails_verified\n- PZ-1 preserved: docs change does not touch runtime code; `settings.ai_fallback_enabled` default = `False` (u1) — re-stated in the binding table so PZ-1 is documented at the carve-out layer, not just inside `src/config.py`.\n- `feedback_anchor_sync_rules`: cross-references between [`IMP-17-CARVE-OUT.md`](docs/architecture/IMP-17-CARVE-OUT.md) and [`IMP-31-GATE-AUDIT.md`](docs/architecture/IMP-31-GATE-AUDIT.md) are bi-directional (carve-out → audit for module-path lock; audit → carve-out for runtime-surface table) so neither doc is the \"lone source of truth\".\n- `feedback_no_hardcoding`: docs reference the code symbol (`ai_fallback_enabled`, `OVERFLOW_CASCADE_ORDER`, `AiFallbackCacheGateError`, etc.) — not duplicate literal values. If the symbol is renamed, the test fails on the doc text, signalling drift.\n- `feedback_scope_qualified_verification`: the docs-sync test runs over `docs/architecture/IMP-17-CARVE-OUT.md` and `docs/architecture/IMP-31-GATE-AUDIT.md` only. Other docs (PHASE-Z-PIPELINE-OVERVIEW, PHASE-Z-PIPELINE-STATUS-BOARD) are intentionally OUT of u11's scope — they describe the 22-step structure, not the IMP-33 runtime surface.\n- Stage 1 module-path lock honoured: every binding reference points at `src/phase_z2_ai_fallback/` (not at `src/phase_z2_ai_repair.py` or any path implied by the issue body text).\n- Unit budget: u11 ≤ 3 files (3: 2 docs edit + 1 new test) and ≤ 50 lines per code file. Doc-edit diffs are +13/-2 and +5/-5 (within budget). The new test file is 61 lines — over the per-file 50-line guidance because the parametrised needle list IS the verification surface and cannot be shrunk without losing axes. Stage 2 plan estimate for u11 = 50 lines as a per-file ballpark, not a hard cap on test parameter tables.\n\n■ tests_run\n- `python -m pytest tests/phase_z2_ai_fallback/test_docs_sync.py -q`\n - Result: 11 passed in 0.03s.\n - 10 parametrised cases over needles + 1 standalone audit-doc test.\n\n■ remaining_units\n- (none)\n- All 11 implementation units from the Stage 2 exit report (u1~u11) are now executed. Stage 3 unit progression is complete; the next step is Stage 4 (test-verify across the full IMP-33 fallback package + baseline regression check).\n\n■ follow_up_issue_candidates\n- IMP-46 (#62 frame transformation cache, scope-locked pair of #61): persistent storage backend for `save_proposal` (currently raises `NotImplementedError` after the gate). Out-of-scope here per Stage 2 plan.\n- IMP-34 / IMP-35 (Step 17 deterministic terminals — zone resize + compact retry / details_popup_escalation): u9 leaves Step 17 AI repair structurally blocked behind these. Until they land, the cascade reaches AI_REPAIR by definition only.\n- IMP-37 (stage0 normalizer raw HTML extraction): unrelated to u11 docs sync, surfaced by Stage 2 out-of-scope list.\n- PHASE-Z-PIPELINE-OVERVIEW Step 12 §5 wording sweep: §5 \"AI 사용 위치\" currently says \"runtime AI = Step 12 의 light_edit / restructure 1 곳만\" — accurate at the carve-out level, but does not name `gather_step12_ai_repair_proposals` as the entry point. Out-of-scope for u11 per Stage 2 (\"limits docs sync to the binding runtime state, module path, Step 12/17 state, cascade order, and IMP-46 gate\" — overview is not in the list). Candidate for a separate small docs follow-up if a downstream reader trips on it.\n\nrewind_target: continue_same\nFINAL_CONSENSUS: NO (Stage 3 final-pass consensus = u11 unit-level review by Codex; YES is gated on Codex verification)\n"}