diff --git a/api-coverage-report.md b/api-coverage-report.md index ac93867..a116bfd 100644 --- a/api-coverage-report.md +++ b/api-coverage-report.md @@ -22,8 +22,8 @@ and update `reviewed_at`. | First-class CLI operations | 131 | | Reviewed gaps | 68 | | Client operations | 155 | -| Published request fields on covered operations | 475 | -| Request fields modeled by the CLI | 474 | +| Published request fields on covered operations | 477 | +| Request fields modeled by the CLI | 476 | | Reviewed request-field gaps | 1 | | Published header and query parameters on covered operations | 196 | | Parameters the CLI can send | 144 | diff --git a/api-coverage.toml b/api-coverage.toml index 18f55a3..3363ec5 100644 --- a/api-coverage.toml +++ b/api-coverage.toml @@ -11,11 +11,11 @@ [snapshot] catalog_url = "https://api.coval.dev/v1/openapi" -reviewed_at = "2026-11-06" +reviewed_at = "2026-11-16" published_operations = 199 cli_supported_operations = 131 -published_request_fields = 475 -cli_modeled_request_fields = 474 +published_request_fields = 477 +cli_modeled_request_fields = 476 published_parameters = 196 cli_supported_parameters = 144 diff --git a/src/client/models/review_project.rs b/src/client/models/review_project.rs index aabc26b..03547fc 100644 --- a/src/client/models/review_project.rs +++ b/src/client/models/review_project.rs @@ -55,6 +55,19 @@ pub enum BatchAssignmentMode { ManagerAssigned, } +#[derive(Debug, Clone, Copy, Serialize, Deserialize, ValueEnum)] +pub enum BatchAllocationOrder { + #[serde(rename = "LIST_ORDER")] + #[value(name = "LIST_ORDER")] + ListOrder, + #[serde(rename = "LATEST_ADDED_FIRST")] + #[value(name = "LATEST_ADDED_FIRST")] + LatestAddedFirst, + #[serde(rename = "RANDOM")] + #[value(name = "RANDOM")] + Random, +} + #[derive(Debug, Serialize, Deserialize)] pub struct CreateReviewProjectRequest { pub display_name: String, @@ -88,6 +101,12 @@ pub struct CreateReviewProjectRequest { skip_serializing_if = "Option::is_none" )] pub batch_size: Option>, + #[serde( + default, + deserialize_with = "super::explicit_option", + skip_serializing_if = "Option::is_none" + )] + pub batch_allocation_order: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub allow_metric_skipping: Option, #[serde( @@ -152,6 +171,12 @@ pub struct UpdateReviewProjectRequest { skip_serializing_if = "Option::is_none" )] pub batch_size: Option>, + #[serde( + default, + deserialize_with = "super::explicit_option", + skip_serializing_if = "Option::is_none" + )] + pub batch_allocation_order: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub allow_metric_skipping: Option, #[serde( diff --git a/src/commands/review_projects.rs b/src/commands/review_projects.rs index c1401fd..7b1ca09 100644 --- a/src/commands/review_projects.rs +++ b/src/commands/review_projects.rs @@ -2,7 +2,7 @@ use anyhow::Result; use clap::{Args, Subcommand}; use crate::client::models::{ - BatchAssignmentMode, CreateReviewProjectRequest, ListParams, ProjectType, + BatchAllocationOrder, BatchAssignmentMode, CreateReviewProjectRequest, ListParams, ProjectType, UpdateReviewProjectRequest, }; use crate::client::CovalClient; @@ -100,6 +100,12 @@ pub struct CreateArgs { batch_assignment_mode: Option, #[arg(long, value_parser = clap::value_parser!(u8).range(1..=50), help = "Conversations per reviewer batch (1-50)")] batch_size: Option, + #[arg( + long, + value_enum, + help = "Which free conversations a new reviewer batch takes" + )] + batch_allocation_order: Option, } #[derive(Args)] @@ -165,6 +171,12 @@ pub struct UpdateArgs { batch_assignment_mode: Option, #[arg(long, value_parser = clap::value_parser!(u8).range(1..=50), help = "Conversations per reviewer batch (1-50)")] batch_size: Option, + #[arg( + long, + value_enum, + help = "Which free conversations a new reviewer batch takes" + )] + batch_allocation_order: Option, } #[derive(Args)] @@ -251,6 +263,11 @@ pub async fn execute( args.batch_assignment_mode, )?; input_json::insert(&mut input, "batch_size", args.batch_size)?; + input_json::insert( + &mut input, + "batch_allocation_order", + args.batch_allocation_order, + )?; let req: CreateReviewProjectRequest = input_json::finish(input)?; let project = client.review_projects().create(req).await?; emit_one_with_actions( @@ -318,6 +335,11 @@ pub async fn execute( args.batch_assignment_mode, )?; input_json::insert(&mut input, "batch_size", args.batch_size)?; + input_json::insert( + &mut input, + "batch_allocation_order", + args.batch_allocation_order, + )?; let req: UpdateReviewProjectRequest = input_json::finish(input)?; let project = client .review_projects() diff --git a/tests/cli_tests.rs b/tests/cli_tests.rs index 309545d..69c78af 100644 --- a/tests/cli_tests.rs +++ b/tests/cli_tests.rs @@ -8703,9 +8703,10 @@ async fn test_november_parity_review_batch_settings_preserve_null_and_omission() ("PATCH", "update", "/v1/review-projects/proj456"), ] { for settings in [ - json!({"batch_assignment_mode": "SELF", "batch_size": 1}), - json!({"batch_assignment_mode": "MANAGER", "batch_size": 50}), - json!({"batch_assignment_mode": null, "batch_size": null}), + json!({"batch_assignment_mode": "SELF", "batch_size": 1, "batch_allocation_order": "LIST_ORDER"}), + json!({"batch_assignment_mode": "MANAGER", "batch_size": 50, "batch_allocation_order": "LATEST_ADDED_FIRST"}), + json!({"batch_assignment_mode": null, "batch_size": null, "batch_allocation_order": "RANDOM"}), + json!({"batch_assignment_mode": null, "batch_size": null, "batch_allocation_order": null}), json!({}), ] { let server = MockServer::start().await; @@ -8734,7 +8735,11 @@ async fn test_november_parity_review_batch_settings_preserve_null_and_omission() .assert() .success(); let body = capture.take(); - for field in ["batch_assignment_mode", "batch_size"] { + for field in [ + "batch_assignment_mode", + "batch_size", + "batch_allocation_order", + ] { assert_eq!(body.get(field), settings.get(field)); } } @@ -8751,16 +8756,19 @@ async fn test_november_parity_review_batch_flags_override_json() { "update", "proj456", "--input-json", - r#"{"batch_assignment_mode":null,"batch_size":null}"#, + r#"{"batch_assignment_mode":null,"batch_size":null,"batch_allocation_order":null}"#, "--batch-assignment-mode", "MANAGER", "--batch-size", "7", + "--batch-allocation-order", + "RANDOM", ], ) .await; assert_eq!(body["batch_assignment_mode"], "MANAGER"); assert_eq!(body["batch_size"], 7); + assert_eq!(body["batch_allocation_order"], "RANDOM"); } fn november_uploaded_response() -> Value { @@ -8926,6 +8934,17 @@ async fn test_november_parity_rejects_invalid_batch_mode_and_flag_ranges() { .assert() .failure() .stderr(predicate::str::contains("unknown variant")); + coval_with_api(&server) + .args([ + "review-projects", + "update", + "proj456", + "--input-json", + r#"{"batch_allocation_order":"OTHER"}"#, + ]) + .assert() + .failure() + .stderr(predicate::str::contains("unknown variant")); for value in ["0", "51"] { coval_with_api(&server) .args([