Split monolithic workbench/server.py into resource route modules and a shared error registry
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Read research_multiplier/workbench/server.py to map its route dispatch, duplicated error mappings, security checks, and transaction helpers before extracting modules under research_multiplier/workbench/. Use scripts/architecture_map.py to identify the required module boundaries, then verify the refactor with python scripts/architecture_map.py check, pytest -m offline, tests/offline/test_workbench_server.py, and the PostgreSQL route/workbench regressions.
Written by the indexing model from the issue text.
Description
Task difficulty and Agent fit
- D3 · 8/15. Scope 2, uncertainty 1, impact 2, verification 2, dependencies 1. Behavior-preserving modularization of
research_multiplier/workbench/server.py(1,475 lines) into domain route modules and a shared error registry. - Recommended configuration. Codex / gpt-6.2-sol / xhigh, 50 and $0.90 per benchmark task. Floor 50 in the Artificial Analysis Coding Agent Index v2.1. Trellin snapshot checked 2026-11-22.
- Required skills and verification. Python HTTP server refactoring, security boundary preservation,
scripts/architecture_map.py, full offline and PostgreSQL workbench route test suites. - Scored baseline.
c7f731bon main.
Problem
research_multiplier/workbench/server.py has grown to 1,475 lines and concentrates 50+ HTTP routes inside monolithic if/elif chains (_read_api, do_POST, _get_v1, _post_v1) alongside ~18 separate exception-to-HTTP-status maps duplicated across GET, POST, and v1 handlers.
Because nearly every backend feature PR adds or edits routes in server.py (including #341, #363, #364, #370, #371, #376, #404, #405, #406, #408, #414, #416), it has become the primary merge-conflict hotspot across parallel backend work and makes it easy to miss an error branch or security guard when adding a route.
Scope
- Keep
WorkbenchServerlifecycle, session/origin/host security enforcement (_trusted,_authorized), JSON body bounds,Cache-Control: no-store, and transaction helpers (read,write,write_project) in one clear core. - Extract domain route registration / dispatch into focused modules under
research_multiplier/workbench/(for example: v1 workspace routes, intake & review routes, squad & agent-work routes, proof/canvas/library routes) so parallel feature work touches isolated route modules. - Centralize error-class-to-status mapping (including sanitized
DatabaseOperationErrorand fallback codes) into one table-driven error registry shared by GET and POST paths, eliminating duplicatedexcept/elif self.path == ...branches. - Preserve 100% of existing HTTP routes, status codes, JSON shapes, headers, and security invariants (zero behavior changes).
- Regenerate
docs/architecture-map.mdand passpython scripts/architecture_map.py check(A1–A3).
Acceptance criteria
-
research_multiplier/workbench/server.pyis reduced from its monolithic dispatch/error-mapping structure into focused modules underresearch_multiplier/workbench/with a single shared error-mapping registry. - Every existing
/api/*and/api/v1/*route preserves its exact HTTP method, query/body validation, session/origin checks, status codes, headers, and error payloads. -
python scripts/architecture_map.py checkpasses with updateddocs/architecture-map.mdand zero new layering violations. - Full offline suite (
pytest -m offline),tests/offline/test_workbench_server.py, and CI PostgreSQL route/workbench regressions pass unchanged.
Related: #11, #226.
- Dominant language
- Python
- Stars
- 2
- Forks
- 0
- Avg merge
- 56m
- Merged PRs (30d)
- 190
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SAFuDarren/Trellin
-
area:web difficulty:d1 layer:entry priority:p2 status:ready type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
SAFuDarren/Trellin#421 ·
Maintainers usually reply within 1 day
-
area:web difficulty:d3 layer:entry priority:p1 status:triage type:feature
Difficulty 4/5 3-5 days Newbie friendliness 48/100
SAFuDarren/Trellin#423 ·
Maintainers usually reply within 1 day
-
area:web difficulty:d3 layer:entry priority:p1 status:triage type:feature
Difficulty 4/5 3-5 days Newbie friendliness 45/100
SAFuDarren/Trellin#422 ·
Maintainers usually reply within 1 day
-
difficulty:d3 layer:entry priority:p1 status:ready type:chore
Difficulty 4/5 3-5 days Newbie friendliness 48/100
SAFuDarren/Trellin#412 · 5 comments ·
Maintainers usually reply within 1 day
-
difficulty:d4 layer:collab priority:p1 status:ready type:feature
Difficulty 5/5 Over a week Newbie friendliness 25/100
SAFuDarren/Trellin#403 · 11 comments ·
Maintainers usually reply within 1 day
All issues in SAFuDarren/Trellin
Similar issues
-
Status: Triage Suggestion
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
GTNewHorizons/GT-New-Horizons-Modpack#27957 ·
Maintainers usually reply within 1 day
-
changelog investigate
Difficulty 1/5 Under an hour Newbie friendliness 85/100
ramnes/notion-sdk-py#522 ·
-
top `--file` with a non-UTF-8 CSV gives a raw codec error and "Check the arguments."Possibly taken @Beehtrix claimed this today. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
laaielichter/Gulliver#263 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
LearningCircuit/local-deep-research#10161 ·
Maintainers usually reply within 1 day