@@ -54,7 +54,7 @@ use openshell_core::proto::{
5454 AddAllowRules as ProtoAddAllowRules, AddDenyRules as ProtoAddDenyRules,
5555 ApproveAllDraftChunksRequest, ApproveAllDraftChunksResponse, ApproveDraftChunkRequest,
5656 ApproveDraftChunkResponse, ClearDraftChunksRequest, ClearDraftChunksResponse,
57- ConfigUpdateConsistency , DraftHistoryEntry, EditDraftChunkRequest, EditDraftChunkResponse,
57+ ConfigUpdateWaitMode , DraftHistoryEntry, EditDraftChunkRequest, EditDraftChunkResponse,
5858 EffectiveSetting, GetConfigUpdateOperationRequest, GetConfigUpdateOperationResponse,
5959 GetDraftHistoryRequest, GetDraftHistoryResponse, GetDraftPolicyRequest, GetDraftPolicyResponse,
6060 GetGatewayConfigRequest, GetGatewayConfigResponse, GetSandboxConfigRequest,
@@ -150,14 +150,14 @@ pub(super) fn config_wait_timeout(
150150async fn finish_config_update_operation(
151151 state: &Arc<ServerState>,
152152 operation_id: &str,
153- consistency: ConfigUpdateConsistency ,
153+ wait_mode: ConfigUpdateWaitMode ,
154154 timeout: std::time::Duration,
155155) -> Result<Response<UpdateConfigResponse>, Status> {
156156 // Boxed so the many call sites in the update handler stay small.
157157 Box::pin(finish_config_update_operation_inner(
158158 state,
159159 operation_id,
160- consistency ,
160+ wait_mode ,
161161 timeout,
162162 ))
163163 .await
@@ -166,7 +166,7 @@ async fn finish_config_update_operation(
166166async fn finish_config_update_operation_inner(
167167 state: &Arc<ServerState>,
168168 operation_id: &str,
169- consistency: ConfigUpdateConsistency ,
169+ wait_mode: ConfigUpdateWaitMode ,
170170 timeout: std::time::Duration,
171171) -> Result<Response<UpdateConfigResponse>, Status> {
172172 if !crate::config_delivery::push_enabled(state) {
@@ -181,7 +181,7 @@ async fn finish_config_update_operation_inner(
181181 return Ok(Response::new(response));
182182 }
183183 config_update_operation::reconcile_one(state, operation_id).await?;
184- if consistency == ConfigUpdateConsistency ::WaitForCompletion {
184+ if wait_mode == ConfigUpdateWaitMode ::WaitForCompletion {
185185 config_update_operation::wait_for_terminal(state, operation_id, timeout).await?;
186186 }
187187 let record = config_update_operation::get_record(state, operation_id)
@@ -205,7 +205,7 @@ async fn finish_unchanged_config_update(
205205 workspace: &str,
206206 identity: ConfigOperationIdentity<'_>,
207207 response: Response<UpdateConfigResponse>,
208- consistency: ConfigUpdateConsistency ,
208+ wait_mode: ConfigUpdateWaitMode ,
209209 timeout: std::time::Duration,
210210) -> Result<Response<UpdateConfigResponse>, Status> {
211211 let response = response.into_inner();
@@ -235,7 +235,7 @@ async fn finish_unchanged_config_update(
235235 super::persistence_error_to_status(error, "persist unchanged update operation")
236236 })?;
237237 let operation_id = config_update_operation::public_operation(&record)?.operation_id;
238- finish_config_update_operation(state, &operation_id, consistency , timeout).await
238+ finish_config_update_operation(state, &operation_id, wait_mode , timeout).await
239239}
240240
241241// Private wire-only compatibility types for policy history written before
@@ -3990,9 +3990,9 @@ pub(super) async fn handle_update_config_commit(
39903990 mut request: Request<UpdateConfigRequest>,
39913991) -> Result<Response<UpdateConfigResponse>, Status> {
39923992 if !request.get_ref().global
3993- && request.get_ref().consistency == ConfigUpdateConsistency ::WaitForCompletion as i32
3993+ && request.get_ref().wait_mode == ConfigUpdateWaitMode ::WaitForCompletion as i32
39943994 {
3995- request.get_mut().consistency = ConfigUpdateConsistency ::CommitOnly as i32;
3995+ request.get_mut().wait_mode = ConfigUpdateWaitMode ::CommitOnly as i32;
39963996 }
39973997 handle_update_config(state, request).await
39983998}
@@ -4050,12 +4050,12 @@ async fn handle_update_config_inner(
40504050 let replay_facts = super::mutation_replay::ordinary::Facts::from_request(&request);
40514051 let req = request.into_inner();
40524052 let wait_timeout = config_wait_timeout(req.wait_timeout.as_ref())?;
4053- let consistency = ConfigUpdateConsistency ::try_from(req.consistency )
4054- .map_err(|_| Status::invalid_argument("unknown update consistency "))?;
4055- let consistency = if consistency == ConfigUpdateConsistency ::Unspecified {
4056- ConfigUpdateConsistency ::CommitOnly
4053+ let wait_mode = ConfigUpdateWaitMode ::try_from(req.wait_mode )
4054+ .map_err(|_| Status::invalid_argument("unknown configuration update wait mode "))?;
4055+ let wait_mode = if wait_mode == ConfigUpdateWaitMode ::Unspecified {
4056+ ConfigUpdateWaitMode ::CommitOnly
40574057 } else {
4058- consistency
4058+ wait_mode
40594059 };
40604060 if req.idempotency_key.len() > MAX_IDEMPOTENCY_KEY_BYTES {
40614061 return Err(Status::invalid_argument(format!(
@@ -4120,7 +4120,7 @@ async fn handle_update_config_inner(
41204120 ));
41214121 }
41224122 if req.global {
4123- if consistency == ConfigUpdateConsistency ::WaitForCompletion {
4123+ if wait_mode == ConfigUpdateWaitMode ::WaitForCompletion {
41244124 return Err(Status::invalid_argument(
41254125 "WAIT_FOR_COMPLETION is only supported for sandbox-scoped updates",
41264126 ));
@@ -4351,7 +4351,7 @@ async fn handle_update_config_inner(
43514351 return finish_config_update_operation(
43524352 state,
43534353 &operation.operation_id,
4354- consistency ,
4354+ wait_mode ,
43554355 wait_timeout,
43564356 )
43574357 .await;
@@ -4442,7 +4442,7 @@ async fn handle_update_config_inner(
44424442 return finish_config_update_operation(
44434443 state,
44444444 &operation_id,
4445- consistency ,
4445+ wait_mode ,
44464446 wait_timeout,
44474447 )
44484448 .await;
@@ -4471,7 +4471,7 @@ async fn handle_update_config_inner(
44714471 removed,
44724472 response_annotations,
44734473 ),
4474- consistency ,
4474+ wait_mode ,
44754475 wait_timeout,
44764476 ))
44774477 .await;
@@ -4526,7 +4526,7 @@ async fn handle_update_config_inner(
45264526
45274527 drop(config_guard);
45284528 if let Some(operation_id) = operation_id {
4529- return finish_config_update_operation(state, &operation_id, consistency , wait_timeout)
4529+ return finish_config_update_operation(state, &operation_id, wait_mode , wait_timeout)
45304530 .await;
45314531 }
45324532 response_annotations = persist_update_config_annotations(
@@ -4553,7 +4553,7 @@ async fn handle_update_config_inner(
45534553 false,
45544554 response_annotations,
45554555 ),
4556- consistency ,
4556+ wait_mode ,
45574557 wait_timeout,
45584558 ))
45594559 .await;
@@ -4654,7 +4654,7 @@ async fn handle_update_config_inner(
46544654 emit_config_update_policy_success(sandbox_caller);
46554655
46564656 if let Some(operation_id) = operation_id {
4657- return finish_config_update_operation(state, &operation_id, consistency , wait_timeout)
4657+ return finish_config_update_operation(state, &operation_id, wait_mode , wait_timeout)
46584658 .await;
46594659 }
46604660 return Box::pin(finish_unchanged_config_update(
@@ -4673,7 +4673,7 @@ async fn handle_update_config_inner(
46734673 false,
46744674 response_annotations,
46754675 ),
4676- consistency ,
4676+ wait_mode ,
46774677 wait_timeout,
46784678 ))
46794679 .await;
@@ -4804,7 +4804,7 @@ async fn handle_update_config_inner(
48044804 false,
48054805 response_annotations,
48064806 ),
4807- consistency ,
4807+ wait_mode ,
48084808 wait_timeout,
48094809 ))
48104810 .await;
@@ -4901,7 +4901,7 @@ async fn handle_update_config_inner(
49014901 spawn_pending_chunk_refresh(state, &workspace, &sandbox);
49024902 emit_full_policy_update_success(sandbox_caller, next_version);
49034903
4904- finish_config_update_operation(state, &operation_id, consistency , wait_timeout).await
4904+ finish_config_update_operation(state, &operation_id, wait_mode , wait_timeout).await
49054905}
49064906
49074907// ---------------------------------------------------------------------------
@@ -13321,7 +13321,7 @@ mod tests {
1332113321 value: Some(setting_value::Value::BoolValue(true)),
1332213322 }),
1332313323 workspace_scope: Some(openshell_core::proto::workspace_selector("default")),
13324- consistency: ConfigUpdateConsistency ::WaitForCompletion.into(),
13324+ wait_mode: ConfigUpdateWaitMode ::WaitForCompletion.into(),
1332513325 idempotency_key: "poll-wait".to_string(),
1332613326 ..Default::default()
1332713327 })),
@@ -13351,7 +13351,7 @@ mod tests {
1335113351 value: Some(setting_value::Value::BoolValue(true)),
1335213352 }),
1335313353 workspace_scope: Some(openshell_core::proto::workspace_selector("default")),
13354- consistency: ConfigUpdateConsistency ::WaitForCompletion.into(),
13354+ wait_mode: ConfigUpdateWaitMode ::WaitForCompletion.into(),
1335513355 wait_timeout: openshell_core::time::duration_from_std(std::time::Duration::from_secs(
1335613356 5,
1335713357 ))
@@ -13396,7 +13396,7 @@ mod tests {
1339613396 );
1339713397 state.store.put_message(&sandbox).await.unwrap();
1339813398 // A supervisor without snapshot support is never registered with the
13399- // delivery scheduler .
13399+ // delivery queue .
1340013400 let (tx, _rx) = tokio::sync::mpsc::channel(1);
1340113401 state.supervisor_sessions.register(
1340213402 "sb-legacy-operation".into(),
@@ -13456,7 +13456,7 @@ mod tests {
1345613456 value: Some(setting_value::Value::BoolValue(true)),
1345713457 }),
1345813458 workspace_scope: Some(openshell_core::proto::workspace_selector("default")),
13459- consistency: ConfigUpdateConsistency ::WaitForCompletion.into(),
13459+ wait_mode: ConfigUpdateWaitMode ::WaitForCompletion.into(),
1346013460 wait_timeout: openshell_core::time::duration_from_std(
1346113461 std::time::Duration::from_secs(5),
1346213462 )
@@ -23153,7 +23153,7 @@ mod tests {
2315323153 expected_resource_version: current_version,
2315423154 annotations: HashMap::new(),
2315523155
23156- consistency: ConfigUpdateConsistency ::CommitOnly.into(),
23156+ wait_mode: ConfigUpdateWaitMode ::CommitOnly.into(),
2315723157 idempotency_key: String::new(),
2315823158 wait_timeout: None,
2315923159 }),
@@ -23256,7 +23256,7 @@ mod tests {
2325623256 expected_resource_version: current_version,
2325723257 annotations: annotations.clone(),
2325823258
23259- consistency: ConfigUpdateConsistency ::CommitOnly.into(),
23259+ wait_mode: ConfigUpdateWaitMode ::CommitOnly.into(),
2326023260 idempotency_key: String::new(),
2326123261 wait_timeout: None,
2326223262 }),
@@ -24314,7 +24314,7 @@ mod tests {
2431424314 expected_resource_version: 99, // stale version
2431524315 annotations: HashMap::new(),
2431624316
24317- consistency: ConfigUpdateConsistency ::CommitOnly.into(),
24317+ wait_mode: ConfigUpdateWaitMode ::CommitOnly.into(),
2431824318 idempotency_key: String::new(),
2431924319 wait_timeout: None,
2432024320 }),
@@ -24420,7 +24420,7 @@ mod tests {
2442024420 expected_resource_version: initial_version,
2442124421 annotations: HashMap::new(),
2442224422
24423- consistency: ConfigUpdateConsistency ::CommitOnly.into(),
24423+ wait_mode: ConfigUpdateWaitMode ::CommitOnly.into(),
2442424424 idempotency_key: String::new(),
2442524425 wait_timeout: None,
2442624426 }),
@@ -24822,7 +24822,7 @@ mod tests {
2482224822 value: Some(setting_value::Value::BoolValue(true)),
2482324823 }),
2482424824 workspace_scope: Some(openshell_core::proto::workspace_selector("default")),
24825- consistency: ConfigUpdateConsistency ::WaitForCompletion.into(),
24825+ wait_mode: ConfigUpdateWaitMode ::WaitForCompletion.into(),
2482624826 idempotency_key: "inactive-setting-1".to_string(),
2482724827 expected_resource_version: 0,
2482824828 annotations: HashMap::from([("change-ticket".to_string(), "1234".to_string())]),
@@ -24928,7 +24928,7 @@ mod tests {
2492824928 value: Some(setting_value::Value::BoolValue(true)),
2492924929 }),
2493024930 workspace_scope: Some(openshell_core::proto::workspace_selector("default")),
24931- consistency: ConfigUpdateConsistency ::CommitOnly.into(),
24931+ wait_mode: ConfigUpdateWaitMode ::CommitOnly.into(),
2493224932 idempotency_key: "wake-local-waiter".to_string(),
2493324933 ..Default::default()
2493424934 })),
@@ -25021,7 +25021,7 @@ mod tests {
2502125021 value: Some(setting_value::Value::BoolValue(true)),
2502225022 }),
2502325023 workspace_scope: Some(openshell_core::proto::workspace_selector("default")),
25024- consistency: ConfigUpdateConsistency ::CommitOnly.into(),
25024+ wait_mode: ConfigUpdateWaitMode ::CommitOnly.into(),
2502525025 idempotency_key: "poll-missed-notification".to_string(),
2502625026 ..Default::default()
2502725027 })),
0 commit comments