[documents] document_routes.py (1662 lines) mixes 6+ concerns — needs feature-based split #769

Closed
opened 2026-06-03 00:24:03 +02:00 by sleepy · 0 comments
Owner

"File: routes/document_routes.py — 1662 lines This file is the single largest route file in the codebase and handles at least 6 distinct concerns: 1. Document CRUD (add, get, list, delete, update) 2. Collection management (create, delete, list collections) 3. Document search/query (search endpoint) 4. Scrape/URL ingestion (scrape endpoint, HTML processing) 5. Knowledge graph endpoints (graph construction, querying) 6. Admin/stats endpoints (usage stats, health) AGENTS.md: "Split files exceeding ~400 lines or containing multiple concerns" AGENTS.md: "Organize code by feature/domain, not by technical role" Action: Split into feature-based route modules: - routes/documents/crud.py — Document CRUD - routes/documents/collections.py — Collection management - routes/documents/search.py — Search/query - routes/documents/ingestion.py — Scrape/URL ingestion - routes/documents/knowledge_graph.py — Knowledge graph endpoints - routes/documents/admin.py — Stats/health - routes/documents/__init__.py — Router aggregation"

"**File**: `routes/document_routes.py` — 1662 lines This file is the single largest route file in the codebase and handles at least 6 distinct concerns: 1. **Document CRUD** (add, get, list, delete, update) 2. **Collection management** (create, delete, list collections) 3. **Document search/query** (search endpoint) 4. **Scrape/URL ingestion** (scrape endpoint, HTML processing) 5. **Knowledge graph endpoints** (graph construction, querying) 6. **Admin/stats endpoints** (usage stats, health) AGENTS.md: *\"Split files exceeding ~400 lines or containing multiple concerns\"* AGENTS.md: *\"Organize code by feature/domain, not by technical role\"* **Action**: Split into feature-based route modules: - `routes/documents/crud.py` — Document CRUD - `routes/documents/collections.py` — Collection management - `routes/documents/search.py` — Search/query - `routes/documents/ingestion.py` — Scrape/URL ingestion - `routes/documents/knowledge_graph.py` — Knowledge graph endpoints - `routes/documents/admin.py` — Stats/health - `routes/documents/__init__.py` — Router aggregation"
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sleepy/odysseus#769
No description provided.