clippy: struct-bundle enqueue_iteration_with_topic + fix doc list warnings
ci / gates (push) Successful in 6s
ci / frontend (push) Successful in 40s
ci / rust (push) Successful in 3m58s
ci / e2e (push) Has been skipped
ci / publish (push) Successful in 4m12s

CI's clippy stage failed with -D warnings on three classes of lint:

1. map_clone in loops::recent_reorders — .map(|a| a.clone()) is the
   pattern clippy wants replaced by .cloned(). Trivial swap.

2. too_many_arguments on enqueue_iteration_with_topic (8 args, ceiling
   7). Refactored the caller-side surface into a new
   IterationEnqueue<'a> struct with fields for each column. Matches
   the pattern research::NewTopic + loops::NewLoop already use for
   the same clippy ceiling. Callers in loops.rs (routes) + the
   enqueue_iteration wrapper updated to build the struct literal.

3. doc_lazy_continuation + doc_list_indentation — two doc comment
   blocks used ambiguous list-like layouts:
   - compose_iteration_task's ASCII-art prepended-block preview:
     wrapped in a ```text fence so clippy stops parsing "RESEARCH
     ARTIFACT:" etc as list continuation.
   - fire_initial_burst_if_set's mention of `burst - 1`: rewrote so
     "- 1" doesn't start a line and get misread as list marker.

Purely a refactor + doc pass; no behavior change.
This commit is contained in:
Omar Sobh
2026-07-10 09:21:24 -07:00
parent c0c5fd7104
commit 51756d0e68
2 changed files with 64 additions and 39 deletions
+34 -15
View File
@@ -441,7 +441,7 @@ pub async fn recent_reorders(
.await?;
let arr: Vec<Value> = row
.and_then(|r| r.try_get::<Value, _>("reorder_events").ok())
.and_then(|v| v.as_array().map(|a| a.clone()))
.and_then(|v| v.as_array().cloned())
.unwrap_or_default();
// Appended in chronological order (oldest → newest); reversing then
// taking `limit` yields the newest N in newest-first order.
@@ -762,17 +762,33 @@ pub async fn enqueue_iteration(
) -> Result<Uuid, DbError> {
enqueue_iteration_with_topic(
pool,
loop_id,
workspace_id,
task,
graph,
iteration,
parent_run_id,
None,
IterationEnqueue {
loop_id,
workspace_id,
task,
graph,
iteration,
parent_run_id,
research_topic_id: None,
},
)
.await
}
/// Batched arguments for `enqueue_iteration_with_topic`. Bundled so the
/// signature stays under clippy's 7-arg ceiling — the columns are
/// all conceptually one "run to enqueue for a loop", not free-floating
/// parameters.
pub struct IterationEnqueue<'a> {
pub loop_id: Uuid,
pub workspace_id: Uuid,
pub task: &'a str,
pub graph: &'a Value,
pub iteration: i32,
pub parent_run_id: Option<Uuid>,
pub research_topic_id: Option<Uuid>,
}
/// Variant of `enqueue_iteration` that also sets `research_topic_id` on
/// the topology_runs row. Used by kind='research' loops so
/// `freeze_research_outcome` writes a new outcome version each
@@ -780,14 +796,17 @@ pub async fn enqueue_iteration(
/// and a research topic.
pub async fn enqueue_iteration_with_topic(
pool: &PgPool,
loop_id: Uuid,
workspace_id: Uuid,
task: &str,
graph: &Value,
iteration: i32,
parent_run_id: Option<Uuid>,
research_topic_id: Option<Uuid>,
args: IterationEnqueue<'_>,
) -> Result<Uuid, DbError> {
let IterationEnqueue {
loop_id,
workspace_id,
task,
graph,
iteration,
parent_run_id,
research_topic_id,
} = args;
let run_id = Uuid::now_v7();
// Dynamic query so the new column combination (loop_id +
// research_topic_id on the same row) doesn't require an offline