Skip to content

refactor(dashboard): F-series — extract 12 endpoints into 7 route modules#164

Merged
AVADSA25 merged 1 commit into
mainfrom
dashboard-route-extraction-4
May 31, 2026
Merged

refactor(dashboard): F-series — extract 12 endpoints into 7 route modules#164
AVADSA25 merged 1 commit into
mainfrom
dashboard-route-extraction-4

Conversation

@AVADSA25

Copy link
Copy Markdown
Owner

Summary

6th architecture-refactor wave in the codec_dashboard route-extraction series.
Moves 12 endpoints out of codec_dashboard.py into 7 focused routes/*.py modules.

LOC reduction (since main, cumulative)

Wave After Net
Pre-B6 baseline 3,912
B6 (chat helpers + crew split) 3,706 -206
C1..C5 (5 route groups + crews) 3,618 -88
D1..D5 (qchat/vibe/schedules/prompts/media) 3,000 -618
E1/E2/E4 (update/health/upload) 2,530 -470
F1..F7 (this PR) 2,187 -343

That's a 44.1% reduction in codec_dashboard.py since the refactor began.

New modules

Module Endpoints Notes
routes/config.py GET/PUT /api/config + masking, 22-rule validation matrix
routes/history.py /api/history, /api/conversations read-only browse
routes/tts.py /api/tts, /api/response + _latest_response_for_session helper (C-2 / PR-4B logic)
routes/vision.py POST /api/vision Qwen-VL; A-11/A-12 allowlisted alongside media/upload
routes/vibe_exec.py /api/preview, /preview_frame, /api/run_code H-8 Rust .out cleanup preserved
routes/web_search.py POST /api/web_search proxies codec_search.search()
routes/cdp.py GET /api/cdp/status Chrome DevTools probe

What'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
  • Page renderers (/, /chat, /vibe, /tasks, /cortex, /audit) — they're not API endpoints
  • /api/services/status — reads _bg_status / _bg_tasks globals owned by the dashboard's startup hook
  • Background daemons (_bg_scheduler, _bg_heartbeat, _bg_watcher)

Test plan

  • python3.13 -m pytest --ignore=tests/test_skills.py -q2,039 passed, 77 skipped (was 2,025; +14 net new tests)
  • All 11 F-series endpoints reachable via app.routes (covered by new TestFSeriesRouteExtractions)
  • codec_dashboard.py no longer redefines any of the 11 moved decorators (regression pin)
  • LOC floor < 2,300 tightened
  • test_a12_invariant: routes/vision.py added to the documented A-11-pending allowlist
  • test_dashboard_llm: count of /chat/completions strings in dashboard 3 → 2 (one vision string moved out)
  • test_tempfile_leaks::test_run_code_unlinks_rust_out now scans routes/vibe_exec.py (H-8 invariant preserved)
  • ruff check on all touched files: 0 issues
  • python3 -c 'import codec_dashboard': clean (all 7 routers wired in)

🤖 Generated with Claude Code

…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>
@AVADSA25 AVADSA25 merged commit 8c3bbbf into main May 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants