research: extract setup helpers into research_setup.rs (fixes file-size gate)
ci / gates (push) Successful in 6s
ci / frontend (push) Successful in 51s
ci / rust (push) Failing after 1m0s
ci / e2e (push) Has been skipped
ci / publish (push) Has been skipped

research.rs hit 1446 lines with the wizard-fold + regression-fix
commits, tripping the CI file-size gate (limit 1250). Pure extraction
into a sibling module; no behavior change.

Moved to routes/research_setup.rs:
- RepoContext (now pub — used by build_coordinator_task)
- TopicSchedule (now pub — request body sub-struct)
- research_workspace_root (now pub)
- prepare_topic_runtime (already pub — used by loops iteration path)
- ensure_repo_workspace (now pub — used by start_topic + prepare)
- materialize_topic_loops (now pub — used by create_topic)

research.rs re-imports them via `use crate::routes::research_setup::{...}`
so the calling code reads identically.

New line counts:
  research.rs        1127 lines (was 1446, limit 1250)
  research_setup.rs   321 lines (new)

Also updated the loop-iteration callsite in routes/loops.rs to point
at the new path (crate::routes::research_setup::prepare_topic_runtime).

No API changes; migrations unaffected.
This commit is contained in:
Omar Sobh
2026-07-10 09:15:25 -07:00
parent 80c23e57ed
commit c0c5fd7104
4 changed files with 336 additions and 330 deletions
+1 -1
View File
@@ -90,7 +90,7 @@ pub async fn compose_and_enqueue_iteration(
// repo files + an isolated daemon to hit. Idempotent — the
// second iteration reattaches to the existing container. Runs
// even when the topic has no repo (harmless no-op).
crate::routes::research::prepare_topic_runtime(pool, workspace_id, topic_id).await;
crate::routes::research_setup::prepare_topic_runtime(pool, workspace_id, topic_id).await;
let task = compose_research_iteration_task(pool, topic_id, template_ref).await;
cm_db::repo::loops::enqueue_iteration_with_topic(
pool,