Skip to content

arch: E-series — 3 more route groups, codec_dashboard 2921→2530#163

Merged
AVADSA25 merged 2 commits into
mainfrom
dashboard-route-extraction-3
May 30, 2026
Merged

arch: E-series — 3 more route groups, codec_dashboard 2921→2530#163
AVADSA25 merged 2 commits into
mainfrom
dashboard-route-extraction-3

Conversation

@AVADSA25
Copy link
Copy Markdown
Owner

Summary

Continuation of route extraction. Pytest: 2172 → 2185 (+13 regression tests, 0 regressions).

What landed

Phase Group Endpoints Target
E1 /api/update/* 2 (Sparkle check + Ed25519-verified download) routes/update.py
E2 health + manifest + metrics + status 5 (/api/health, /health, /api/status, /manifest.json, /metrics) + HealthResponse model routes/health.py
E4 upload + upload_image + save_file 3 with B1 security helpers (fence markers, size cap, blocklist) routes/upload.py

Deferred to next round:

  • E3 /api/config GET/PUT (22-rule validation matrix + sensitive field masking) — medium risk, standalone PR
  • E5 /api/preview + /preview_frame + /api/run_code (Vibe IDE exec surface — touches subprocess + is_dangerous)
  • E6 /api/tts, /api/response, /api/web_search, /api/command, /api/cdp/status (small standalone endpoints)

LOC trajectory

  • codec_dashboard.py: 2,921 → 2,530 LOC (-391, -13.4% this PR)
  • Cumulative across 5 architecture PRs: 3,912 → 2,530 LOC (-1,382, -35.3%)

Test plan

  • pytest tests/test_route_extractions_e.py13/13 new tests pass
  • pytest tests/test_top10_action_list.py — 25/25 pass (import updated to routes.upload)
  • pytest tests/test_a12_invariant.py + test_dashboard_llm.py + test_dead_code_3g.py — all pass (3 invariant tests updated for moved code locations)
  • pytest tests/ (full) — 2185 passed, 83 skipped, 0 failed in 1m20s

After merge

cd ~/codec-repo && git pull
pm2 restart codec-dashboard codec-mcp-http

🤖 Generated with Claude Code

Mikarina13 and others added 2 commits May 30, 2026 18:07
Continuation of dashboard route extraction (PR #162 follow-up).
Pytest: 2172 → 2185 (+13 regression tests, 0 regressions).

EXTRACTIONS

E1 / SR-47: Sparkle update endpoints → routes/update.py
  2 endpoints (/api/update/check, /api/update/download). Both proxy
  through codec_update which handles Ed25519 signature verification.

E2 / SR-48: public health + manifest + metrics + status → routes/health.py
  5 endpoints (/api/health, /health, /api/status, /manifest.json, /metrics).
  HealthResponse Pydantic model moved with them. /api/services/status
  stays in codec_dashboard.py because it reads _bg_status / _bg_tasks
  globals owned by the startup hooks.

E4 / SR-49: upload + upload_image + save_file → routes/upload.py
  3 security-hardened endpoints bundled because they share defensive
  scaffolding:
    - _UPLOAD_MAX_BYTES + 3-layer size cap (B1 / SR-15)
    - _fence_user_document marker helper (B1 / SR-16)
    - _SAVE_FILE_BLOCKED_* + _save_file_is_safe (A1 / SR-8 mirror of
      PR-1C file_write blocklist)

DEFERRED (next round)
  - E3 routes/config.py — /api/config GET/PUT with 22-rule validation
    matrix + sensitive field masking. Medium-risk; standalone PR.
  - E5 routes/vibe_exec.py — /api/preview, /preview_frame, /api/run_code
    (Vibe IDE exec surface; touches subprocess + is_dangerous check)
  - E6 routes/misc.py — /api/tts, /api/response, /api/web_search,
    /api/command, /api/cdp/status

LOC SHIFT

  codec_dashboard.py: 2,921 → 2,530 LOC (-391, -13.4%)
                     (3,912 → 2,530 cumulative = -1,382, -35.3%)

UPDATED TESTS

- tests/test_top10_action_list.py: `_save_file_is_safe` import points
  to routes.upload (was codec_dashboard).
- tests/test_a12_invariant.py: routes/upload.py allowlisted for vision
  POST (A-11 pending, same as routes/media.py).
- tests/test_dashboard_llm.py: /chat/completions count assertion
  bumped from 4 → 3 (upload_image vision POST moved out).
- tests/test_dead_code_3g.py: HealthResponse now lives at
  routes.health.HealthResponse (E2 extraction).
- tests/test_route_extractions_e.py NEW: 13 tests parametrized across
  3 phases — endpoint-registered + source-side invariants
  (HealthResponse exported, B1 helpers in routes/upload).

NEW INVARIANT FLOOR

  test_dashboard_loc_below_2700 — codec_dashboard.py < 2700 LOC.
  Tightens as future extractions land.

Full pytest: 2185 passed, 83 skipped (env-dependent), 0 failed (1m20s).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@AVADSA25 AVADSA25 merged commit 6b50036 into main May 30, 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