refactor(dashboard): F-series — extract 12 endpoints into 7 route modules#164
Merged
Conversation
…ules (SR-51..56)
codec_dashboard.py: 2,530 → 2,187 LOC (-343 / -13.6%)
Cumulative (since main): 3,912 → 2,187 (-44.1% across B6 + C + D + E + F).
New modules (all loaded via `app.include_router`):
routes/config.py /api/config (GET + PUT) + masking/validation helpers
routes/history.py /api/history, /api/conversations
routes/tts.py /api/tts, /api/response (+ _latest_response_for_session)
routes/vision.py /api/vision (Qwen-VL POST; A-11/A-12 allowlisted)
routes/vibe_exec.py /api/preview, /preview_frame, /api/run_code (H-8 .out cleanup preserved)
routes/web_search.py /api/web_search
routes/cdp.py /api/cdp/status
Test surface (additive, +13 new pins):
- test_route_extractions: 11 endpoint-registered pins + module-export-router pin +
a "dashboard must NOT redefine the moved decorators" pin + LOC floor < 2,300
- test_a12_invariant: allowlist routes/vision.py (A-11 pending, same status as
routes/media.py + routes/upload.py)
- test_dashboard_llm: chat/completions count 3 → 2 (one of the vision strings moved out)
- test_tempfile_leaks: H-8 finally-unlink-rust-.out scanned in routes/vibe_exec.py
Full suite: 2,039 passed / 77 skipped (was 2,025). +18 net.
/api/command and /api/chat (chat_completion) intentionally NOT in F-series —
they're the safety-critical / 608-LOC paths next up after F lands.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
6th architecture-refactor wave in the codec_dashboard route-extraction series.
Moves 12 endpoints out of
codec_dashboard.pyinto 7 focusedroutes/*.pymodules.LOC reduction (since main, cumulative)
That's a 44.1% reduction in
codec_dashboard.pysince the refactor began.New modules
routes/config.pyGET/PUT /api/configroutes/history.py/api/history,/api/conversationsroutes/tts.py/api/tts,/api/response_latest_response_for_sessionhelper (C-2 / PR-4B logic)routes/vision.pyPOST /api/visionroutes/vibe_exec.py/api/preview,/preview_frame,/api/run_code.outcleanup preservedroutes/web_search.pyPOST /api/web_searchcodec_search.search()routes/cdp.pyGET /api/cdp/statusWhat's intentionally still in codec_dashboard.py
/api/command(safety-critical:is_dangerous, skill-hijack chain, consent gate) → deferred/api/chat(chat_completion, 608 LOC streaming + post-LLM[SKILL:...]tag) → next deferred extraction/,/chat,/vibe,/tasks,/cortex,/audit) — they're not API endpoints/api/services/status— reads_bg_status/_bg_tasksglobals owned by the dashboard's startup hook_bg_scheduler,_bg_heartbeat,_bg_watcher)Test plan
python3.13 -m pytest --ignore=tests/test_skills.py -q→ 2,039 passed, 77 skipped (was 2,025; +14 net new tests)app.routes(covered by newTestFSeriesRouteExtractions)codec_dashboard.pyno longer redefines any of the 11 moved decorators (regression pin)< 2,300tightenedtest_a12_invariant:routes/vision.pyadded to the documented A-11-pending allowlisttest_dashboard_llm: count of/chat/completionsstrings in dashboard 3 → 2 (one vision string moved out)test_tempfile_leaks::test_run_code_unlinks_rust_outnow scansroutes/vibe_exec.py(H-8 invariant preserved)ruff checkon all touched files: 0 issuespython3 -c 'import codec_dashboard': clean (all 7 routers wired in)🤖 Generated with Claude Code