MCPcopy Create free account
hub / github.com/acking-you/static_flow / transition_comment_task

Method transition_comment_task

crates/store/src/comments_store.rs:432–475  ·  view source on GitHub ↗
(
        &self,
        task_id: &str,
        next_status: &str,
        admin_note: Option<String>,
        failure_reason: Option<String>,
        bump_attempt: bool,
    )

Source from the content-addressed store, hash-verified

430 }
431
432 pub async fn transition_comment_task(
433 &self,
434 task_id: &str,
435 next_status: &str,
436 admin_note: Option<String>,
437 failure_reason: Option<String>,
438 bump_attempt: bool,
439 ) -> Result<Option<CommentTaskRecord>> {
440 let mut record = match self.get_comment_task(task_id).await? {
441 Some(record) => record,
442 None => return Ok(None),
443 };
444
445 validate_transition(&record.status, next_status)?;
446
447 let now = now_ms();
448 record.status = next_status.to_string();
449 record.updated_at = now;
450 if let Some(note) = admin_note {
451 record.admin_note = normalize_optional_text(Some(note));
452 }
453 if let Some(reason) = failure_reason {
454 record.failure_reason = normalize_optional_text(Some(reason));
455 }
456 if bump_attempt {
457 record.attempt_count = record.attempt_count.saturating_add(1);
458 }
459 if (next_status == COMMENT_STATUS_APPROVED || next_status == COMMENT_STATUS_RUNNING)
460 && record.approved_at.is_none()
461 {
462 record.approved_at = Some(now);
463 }
464 if next_status == COMMENT_STATUS_DONE || next_status == COMMENT_STATUS_REJECTED {
465 record.completed_at = Some(now);
466 }
467 if next_status == COMMENT_STATUS_RUNNING {
468 record.failure_reason = None;
469 record.completed_at = None;
470 }
471
472 let table = self.tasks_table().await?;
473 upsert_comment_task_record(&table, &record).await?;
474 Ok(Some(record))
475 }
476
477 pub async fn delete_comment_task(&self, task_id: &str) -> Result<()> {
478 let tasks_table = self.tasks_table().await?;

Callers 6

admin_retry_comment_taskFunction · 0.80
process_one_taskFunction · 0.80
mark_task_failedFunction · 0.80

Calls 6

validate_transitionFunction · 0.85
get_comment_taskMethod · 0.80
tasks_tableMethod · 0.80
now_msFunction · 0.70
normalize_optional_textFunction · 0.70

Tested by

no test coverage detected