diff --git a/crates/api_clients/comet_api_client/src/requests/get_video_task/get_video_task.rs b/crates/api_clients/comet_api_client/src/requests/get_video_task/get_video_task.rs index 78dc3af879..d2a217bf2f 100644 --- a/crates/api_clients/comet_api_client/src/requests/get_video_task/get_video_task.rs +++ b/crates/api_clients/comet_api_client/src/requests/get_video_task/get_video_task.rs @@ -90,8 +90,24 @@ pub async fn get_video_task(args: GetVideoTaskArgs<'_>) -> Result panic!("Expected TaskNotFound, got: {:?}", other), } } + + /// Live diagnostic: polls the known historical tasks and prints their full + /// state, including the failure reason recovered from the content + /// endpoint for failed tasks. Free (read-only GETs, no generation cost), + /// but hits the real API. Run manually with: + /// cargo test -p comet_api_client live_poll_known_task_ids -- --ignored --nocapture + /// + /// NB: The poll endpoint reports failures as a bare `status: "failed"`. + /// The ONLY way to learn WHY is `GET /v1/videos/{id}/content`, whose error + /// message leaks the underlying provider status (eg. "VIOLATION" for + /// content-moderation rejections — these run to progress 100 and then + /// fail when the finished output is moderated). + #[ignore] + #[tokio::test] + async fn live_poll_known_task_ids() { + let api_key = load_api_key(); + + for task_id in KNOWN_TASK_IDS { + println!("===== {task_id}"); + + let task = match get_video_task(GetVideoTaskArgs { api_key: &api_key, task_id }).await { + Ok(task) => task, + Err(err) => { + println!(" poll error: {err}"); + continue; + } + }; + + println!(" status: {}", task.status); + println!(" model: {}", task.maybe_model.as_deref().unwrap_or("?")); + println!(" progress: {:?}", task.maybe_progress); + println!(" created_at: {:?}", task.maybe_created_at); + println!(" completed_at: {:?}", task.maybe_completed_at); + println!(" video_url: {}", task.maybe_video_url.as_deref().unwrap_or("(none)")); + + if task.status.is_failure() { + match probe_video_failure_reason(ProbeVideoFailureReasonArgs { api_key: &api_key, task_id }).await { + Ok(Some(reason)) => { + println!(" failure reason (via /content):"); + println!(" raw message: {}", reason.raw_message); + println!(" underlying status: {}", reason.maybe_underlying_status.as_deref().unwrap_or("(unparsed)")); + println!(" content violation: {}", reason.is_content_violation()); + } + Ok(None) => println!(" failure probe: content unexpectedly downloadable"), + Err(err) => println!(" failure probe error: {err}"), + } + } + println!(); + } + } } diff --git a/crates/api_clients/comet_api_client/src/requests/mod.rs b/crates/api_clients/comet_api_client/src/requests/mod.rs index f61434b8c1..bebda1551b 100644 --- a/crates/api_clients/comet_api_client/src/requests/mod.rs +++ b/crates/api_clients/comet_api_client/src/requests/mod.rs @@ -1,4 +1,5 @@ pub mod comet_host; pub mod create_video; +pub mod get_video_content; pub mod get_video_task; pub mod video_task_status;