{ "body": "[Codex #1] Stage 1 problem review - IMP-26\n\nI verified Claude #1\u0027s root-cause framing and scope-lock: IMP-26 should not proceed as an isolated helper deletion in the current state.\n\nFindings:\n- The backlog row marks IMP-26 as low/future, status pending, with trigger \"Phase R\u0027 cleanup axis active\" and scope limited to duplicate cleanup for `normalize_mdx` / `_slice_mdx_sections` / `_get_definitions` / `_get_conclusion`: `docs/architecture/PHASE-Z-IMPLEMENTATION-ISSUE-BACKLOG.md:93`.\n- The source insight maps J3 to `html_generator` duplicate helpers vs the §2.1 / §2.2 SoT, also only when the Phase R\u0027 cleanup axis is active: `docs/architecture/PHASE-Q-INSIGHT-TO-22STEP-MAP.md:150`.\n- The §2.9 audit classifies `html_generator.py` as \"Mixed (Archive heavy - Phase R\u0027 core)\", \"Salvage Candidate 0\", with the four helpers as Reference Only, not Salvage: `docs/architecture/PHASE-Q-AUDIT.md:940-948`.\n- The audit\u0027s J3 note explicitly says the duplicate helper cleanup/removal decision is deferred to a separate Phase R\u0027 cleanup decision: `docs/architecture/PHASE-Q-AUDIT.md:956`.\n- The SoT candidates are real but not drop-in compatible. `src/mdx_normalizer.py:393-438` exposes `normalize_mdx_content(raw_mdx) -\u003e dict` with `clean_text`, `title`, `images`, `popups`, `tables`, and `sections`, while `src/html_generator.py:752-827` exposes `normalize_mdx(raw_mdx) -\u003e str`.\n- `src/section_parser.py:23-45` consumes a `list[dict]` of normalized sections and returns major-section structures; `src/html_generator.py:830-842` returns `dict[str, str]` after local normalization. Replacing it with §2.2 would require adapter/migration work, not \"code removal only\".\n- The helpers still have live callers. In-module callers exist at `src/html_generator.py:654`, `src/html_generator.py:730`, `src/html_generator.py:1011`, `src/html_generator.py:1029`, and `src/html_generator.py:1041`.\n- There is also an external import path: `src/content_verifier.py:535` imports `generate_slide_html`, `regenerate_area`, `_slice_mdx_sections`, `_map_sections_for_role`, `_get_definitions`, and `_get_conclusion`; `src/content_verifier.py:539` immediately calls `_slice_mdx_sections(content)`.\n- The active legacy Type A path still reaches that external import. `src/pipeline.py:1187-1196` branches Type B/B\u0027/B\u0027\u0027 to block assembly but imports `generate_with_retry` for Type A, and `src/pipeline.py:1241-1247` calls it. A second legacy path also imports/calls `generate_with_retry` at `src/pipeline.py:1653` and `src/pipeline.py:1679`.\n\nScope-lock decision:\n- Do not remove these four helpers in isolation.\n- Do not redirect to §2.1 / §2.2 as part of IMP-26 unless the stage is explicitly reframed as a migration with adapters and regression coverage.\n- The safe lock is to defer IMP-26 until the Phase R\u0027 archive/cleanup axis is actually active and the Type A AI-HTML path no longer consumes `html_generator.py` / `content_verifier.generate_with_retry`.\n\n=== EVIDENCE ===\nCommands run:\n- `Get-Content -LiteralPath \u0027D:\\ad-hoc\\kei\\design_agent\\.orchestrator\\tmp\\codex_prompt.txt\u0027`\n- `Get-ChildItem -Force`\n- `rg --files`\n- `git status --short`\n- `rg -n \"IMP-26|J3|html_generator|normalize_mdx|_slice_mdx_sections|_get_definitions|_get_conclusion|Phase R\" docs src tests scripts`\n- `rg -n \"generate_with_retry|layout_template|Type A|html_generator|normalize_mdx|_slice_mdx_sections|_get_definitions|_get_conclusion\" src tests scripts`\n- `rg -n \"def normalize_mdx_content|def extract_major_sections|def extract_conclusion_text|return \\{\" src\\mdx_normalizer.py src\\section_parser.py`\n- `Select-String -Path \u0027docs\\architecture\\PHASE-Z-IMPLEMENTATION-ISSUE-BACKLOG.md\u0027 -Pattern \u0027IMP-26\u0027 -Context 2,3`\n- `Select-String -Path \u0027docs\\architecture\\PHASE-Q-INSIGHT-TO-22STEP-MAP.md\u0027 -Pattern \u0027J3|html_generator|normalize_mdx|_slice_mdx_sections|_get_definitions|_get_conclusion\u0027 -Context 2,4`\n- `Select-String -Path \u0027docs\\architecture\\PHASE-Q-AUDIT.md\u0027 -Pattern \u00272\\.9|html_generator|normalize_mdx|_slice_mdx_sections|_get_definitions|_get_conclusion|J3|Reference Only|Archive\u0027 -Context 2,4`\n- `rg -n \"^def normalize_mdx|^def _slice_mdx_sections|^def _get_definitions|^def _get_conclusion|_slice_mdx_sections\\(|_get_definitions\\(|_get_conclusion\\(\" src\\html_generator.py src\\content_verifier.py src\\pipeline.py scripts tests`\n- targeted line reads from `src\\html_generator.py`, `src\\content_verifier.py`, `src\\pipeline.py`, `src\\mdx_normalizer.py`, `src\\section_parser.py`, and `docs\\architecture\\PHASE-Q-AUDIT.md`\nFiles checked:\n- `docs/architecture/PHASE-Z-IMPLEMENTATION-ISSUE-BACKLOG.md`\n- `docs/architecture/PHASE-Q-INSIGHT-TO-22STEP-MAP.md`\n- `docs/architecture/PHASE-Q-AUDIT.md`\n- `src/html_generator.py`\n- `src/content_verifier.py`\n- `src/pipeline.py`\n- `src/mdx_normalizer.py`\n- `src/section_parser.py`\nTest results: not run; Stage 1 explicitly says \"NO pytest\".\nVerified facts:\n- IMP-26 is pending and gated on Phase R\u0027 cleanup activation.\n- §2.1 / §2.2 SoT candidates exist, but their interfaces differ from the four `html_generator` helpers.\n- The four helpers are still reachable from the active Type A AI-HTML path via `content_verifier.generate_with_retry`.\n- Isolated deletion would break current callers; any replacement is a migration, not code-removal-only cleanup.\nFINAL_CONSENSUS: YES\n" }