-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(serve): split edda-serve/src/lib.rs into sub-modules #375
Copy link
Copy link
Closed
Labels
refactorCode refactoringCode refactoring
Description
Problem
edda-serve/src/lib.rs is 8,722 lines with 12 distinct concerns mixed into a single file. It is both the largest file and one of the most frequently changed (churn hotspot), creating merge conflict risk and poor navigability.
Mixed concerns include: auth/pairing, decisions, drafts, events, telemetry, snapshots, analytics, metrics, policy, sync, dashboard/UI, ingestion, SSE streaming.
Proposed Structure
src/
├── lib.rs (~100 lines: re-exports, serve() entrypoint)
├── error.rs (~50 lines: AppError enum)
├── state.rs (~50 lines: AppState, config)
├── middleware.rs (~100 lines: auth middleware)
├── api/
│ ├── mod.rs (router setup)
│ ├── decisions.rs (~350 lines)
│ ├── drafts.rs (~500 lines)
│ ├── events.rs (~220 lines)
│ ├── telemetry.rs (~310 lines)
│ ├── snapshots.rs (~315 lines)
│ ├── analytics.rs (~275 lines)
│ ├── metrics.rs (~335 lines)
│ ├── sync.rs (~110 lines)
│ ├── briefs.rs (~405 lines)
│ ├── ingestion.rs (~280 lines)
│ └── stream.rs (~120 lines)
Notes
- No sub-modules currently exist — this would be the first split
handle_draft_action(245 lines) is the largest single function- Tests (~4,300 lines) should mirror the module split
- Pure refactor — no behavior change
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
refactorCode refactoringCode refactoring