Skip to content

Commit 1ed8bee

Browse files
authored
Merge pull request #490 from PlanExeOrg/split-mcp-cloud-http-server
Split mcp_cloud/http_server.py into four focused modules
2 parents 4e4ed00 + 60406a8 commit 1ed8bee

11 files changed

Lines changed: 3790 additions & 1432 deletions

docs/proposals/131-codebase-cleanliness-remediation-roadmap.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Large modules make the code harder to reason about, harder to test in isolation,
6969
### Fix steps
7070

7171
1. ~~Split `frontend_multi_user/src/app.py` by concern into `auth`, `billing`, `admin`, `downloads`, `account`, and `plan_routes`.~~ **Done** (PR #476): Split 3,857-line monolith into 6 Flask Blueprint modules + utils (app.py reduced to 1,441 lines). Follow-up fix: updated all `url_for()` calls in templates to use blueprint-prefixed endpoint names (`plan_routes.*`, `auth.*`, `downloads.*`).
72-
2. Split `mcp_cloud/http_server.py` into `middleware`, `route_registration`, `tool_http_bridge`, and `server_boot`.
72+
2. ~~Split `mcp_cloud/http_server.py` into `middleware`, `route_registration`, `tool_http_bridge`, and `server_boot`.~~ **Done**: Split 1,439-line monolith into 4 focused modules + re-export shim.
7373
3. Convert `worker_plan/worker_plan_internal/plan/run_plan_pipeline.py` from a giant task registry file into a thin pipeline assembly module plus task-specific modules grouped by stage.
7474
4. Extract reusable orchestration helpers from `worker_plan_database/app.py` into focused worker, billing, and queue modules.
7575
5. Set an internal size target for service modules. As a starting rule, new files should stay below roughly 500 lines unless there is a strong reason not to.
@@ -182,7 +182,7 @@ The multi-user frontend handles auth, admin flows, billing, downloads, and user
182182
### Phase 2: Split the Worst Offenders
183183

184184
1. ~~Refactor `frontend_multi_user/src/app.py` first because it mixes the most distinct business concerns.~~ **Done** (PR #476). Template `url_for()` references fixed to match new blueprint endpoints.
185-
2. Refactor `mcp_cloud/http_server.py` second because it sits on a public protocol boundary.
185+
2. ~~Refactor `mcp_cloud/http_server.py` second because it sits on a public protocol boundary.~~ **Done**.
186186
3. Refactor `worker_plan_database/app.py` and `run_plan_pipeline.py` in smaller slices to avoid destabilizing the execution engine.
187187

188188
### Phase 3: Remove Operational Noise
@@ -210,7 +210,7 @@ This proposal integrates with existing PlanExe boundaries rather than fighting t
210210

211211
1. No production-facing Python module above 1,500 lines after the first cleanup wave.
212212
2. ~~`frontend_multi_user/src/app.py` reduced by at least 50% through route and helper extraction.~~ **Done** (PR #476): Reduced by 63% (3,857 → 1,441 lines).
213-
3. `mcp_cloud/http_server.py` reduced to a focused HTTP assembly module rather than a mixed implementation file.
213+
3. ~~`mcp_cloud/http_server.py` reduced to a focused HTTP assembly module rather than a mixed implementation file.~~ **Done**: Split into `server_boot.py`, `middleware.py`, `tool_http_bridge.py`, `route_registration.py` + re-export shim.
214214
4. Zero uncategorized top-level `print()` statements in production service modules.
215215
5. Documented justification for all remaining `except Exception:` boundaries in service code.
216216
6. New automated tests covering multi-user billing, retry, and download flows.

0 commit comments

Comments
 (0)