Skip to content

Commit bbcaed2

Browse files
authored
refactor(proto): rename UpdateSettings to UpdateConfig for consistency with read path (#515)
1 parent 0dd3dbc commit bbcaed2

17 files changed

+82
-86
lines changed

crates/openshell-cli/src/run.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ use openshell_core::proto::{
2929
GetSandboxPolicyStatusRequest, GetSandboxRequest, HealthRequest, ListProvidersRequest,
3030
ListSandboxPoliciesRequest, ListSandboxesRequest, PolicyStatus, Provider,
3131
RejectDraftChunkRequest, Sandbox, SandboxPhase, SandboxPolicy, SandboxSpec, SandboxTemplate,
32-
SetClusterInferenceRequest, SettingScope, SettingValue, UpdateProviderRequest,
33-
UpdateSettingsRequest, WatchSandboxRequest, setting_value,
32+
SetClusterInferenceRequest, SettingScope, SettingValue, UpdateConfigRequest,
33+
UpdateProviderRequest, WatchSandboxRequest, setting_value,
3434
};
3535
use openshell_core::settings::{self, SettingValueKind};
3636
use openshell_providers::{
@@ -3906,7 +3906,7 @@ pub async fn sandbox_policy_set_global(
39063906

39073907
let mut client = grpc_client(server, tls).await?;
39083908
let response = client
3909-
.update_settings(UpdateSettingsRequest {
3909+
.update_config(UpdateConfigRequest {
39103910
name: String::new(),
39113911
policy: Some(policy),
39123912
setting_key: String::new(),
@@ -4105,7 +4105,7 @@ pub async fn gateway_setting_set(
41054105

41064106
let mut client = grpc_client(server, tls).await?;
41074107
let response = client
4108-
.update_settings(UpdateSettingsRequest {
4108+
.update_config(UpdateConfigRequest {
41094109
name: String::new(),
41104110
policy: None,
41114111
setting_key: key.to_string(),
@@ -4138,7 +4138,7 @@ pub async fn sandbox_setting_set(
41384138

41394139
let mut client = grpc_client(server, tls).await?;
41404140
let response = client
4141-
.update_settings(UpdateSettingsRequest {
4141+
.update_config(UpdateConfigRequest {
41424142
name: name.to_string(),
41434143
policy: None,
41444144
setting_key: key.to_string(),
@@ -4171,7 +4171,7 @@ pub async fn gateway_setting_delete(
41714171

41724172
let mut client = grpc_client(server, tls).await?;
41734173
let response = client
4174-
.update_settings(UpdateSettingsRequest {
4174+
.update_config(UpdateConfigRequest {
41754175
name: String::new(),
41764176
policy: None,
41774177
setting_key: key.to_string(),
@@ -4204,7 +4204,7 @@ pub async fn sandbox_setting_delete(
42044204
) -> Result<()> {
42054205
let mut client = grpc_client(server, tls).await?;
42064206
let response = client
4207-
.update_settings(UpdateSettingsRequest {
4207+
.update_config(UpdateConfigRequest {
42084208
name: name.to_string(),
42094209
policy: None,
42104210
setting_key: key.to_string(),
@@ -4261,7 +4261,7 @@ pub async fn sandbox_policy_set(
42614261
.map_or(0, |r| r.version);
42624262

42634263
let response = client
4264-
.update_settings(UpdateSettingsRequest {
4264+
.update_config(UpdateConfigRequest {
42654265
name: name.to_string(),
42664266
policy: Some(policy),
42674267
setting_key: String::new(),

crates/openshell-cli/tests/ensure_providers_integration.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,10 @@ impl OpenShell for TestOpenShell {
319319
)))
320320
}
321321

322-
async fn update_settings(
322+
async fn update_config(
323323
&self,
324-
_request: tonic::Request<openshell_core::proto::UpdateSettingsRequest>,
325-
) -> Result<Response<openshell_core::proto::UpdateSettingsResponse>, Status> {
324+
_request: tonic::Request<openshell_core::proto::UpdateConfigRequest>,
325+
) -> Result<Response<openshell_core::proto::UpdateConfigResponse>, Status> {
326326
Err(Status::unimplemented("not implemented in test"))
327327
}
328328

crates/openshell-cli/tests/mtls_integration.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ impl OpenShell for TestOpenShell {
221221
)))
222222
}
223223

224-
async fn update_settings(
224+
async fn update_config(
225225
&self,
226-
_request: tonic::Request<openshell_core::proto::UpdateSettingsRequest>,
227-
) -> Result<Response<openshell_core::proto::UpdateSettingsResponse>, Status> {
226+
_request: tonic::Request<openshell_core::proto::UpdateConfigRequest>,
227+
) -> Result<Response<openshell_core::proto::UpdateConfigResponse>, Status> {
228228
Err(Status::unimplemented("not implemented in test"))
229229
}
230230

crates/openshell-cli/tests/provider_commands_integration.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@ impl OpenShell for TestOpenShell {
273273
)))
274274
}
275275

276-
async fn update_settings(
276+
async fn update_config(
277277
&self,
278-
_request: tonic::Request<openshell_core::proto::UpdateSettingsRequest>,
279-
) -> Result<Response<openshell_core::proto::UpdateSettingsResponse>, Status> {
278+
_request: tonic::Request<openshell_core::proto::UpdateConfigRequest>,
279+
) -> Result<Response<openshell_core::proto::UpdateConfigResponse>, Status> {
280280
Err(Status::unimplemented("not implemented in test"))
281281
}
282282

crates/openshell-cli/tests/sandbox_create_lifecycle_integration.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ impl OpenShell for TestOpenShell {
299299
)))
300300
}
301301

302-
async fn update_settings(
302+
async fn update_config(
303303
&self,
304-
_request: tonic::Request<openshell_core::proto::UpdateSettingsRequest>,
305-
) -> Result<Response<openshell_core::proto::UpdateSettingsResponse>, Status> {
304+
_request: tonic::Request<openshell_core::proto::UpdateConfigRequest>,
305+
) -> Result<Response<openshell_core::proto::UpdateConfigResponse>, Status> {
306306
Err(Status::unimplemented("not implemented in test"))
307307
}
308308

crates/openshell-cli/tests/sandbox_name_fallback_integration.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ impl OpenShell for TestOpenShell {
231231
)))
232232
}
233233

234-
async fn update_settings(
234+
async fn update_config(
235235
&self,
236-
_request: tonic::Request<openshell_core::proto::UpdateSettingsRequest>,
237-
) -> Result<Response<openshell_core::proto::UpdateSettingsResponse>, Status> {
236+
_request: tonic::Request<openshell_core::proto::UpdateConfigRequest>,
237+
) -> Result<Response<openshell_core::proto::UpdateConfigResponse>, Status> {
238238
Err(Status::unimplemented("not implemented in test"))
239239
}
240240

crates/openshell-sandbox/src/grpc_client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use miette::{IntoDiagnostic, Result, WrapErr};
1111
use openshell_core::proto::{
1212
DenialSummary, GetInferenceBundleRequest, GetInferenceBundleResponse, GetSandboxConfigRequest,
1313
GetSandboxProviderEnvironmentRequest, PolicySource, PolicyStatus, ReportPolicyStatusRequest,
14-
SandboxPolicy as ProtoSandboxPolicy, SubmitPolicyAnalysisRequest, UpdateSettingsRequest,
14+
SandboxPolicy as ProtoSandboxPolicy, SubmitPolicyAnalysisRequest, UpdateConfigRequest,
1515
inference_client::InferenceClient, open_shell_client::OpenShellClient,
1616
};
1717
use tonic::transport::{Certificate, Channel, ClientTlsConfig, Endpoint, Identity};
@@ -126,7 +126,7 @@ async fn sync_policy_with_client(
126126
policy: &ProtoSandboxPolicy,
127127
) -> Result<()> {
128128
client
129-
.update_settings(UpdateSettingsRequest {
129+
.update_config(UpdateConfigRequest {
130130
name: sandbox.to_string(),
131131
policy: Some(policy.clone()),
132132
setting_key: String::new(),

crates/openshell-server/src/grpc.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use openshell_core::proto::{
3030
RevokeSshSessionRequest, RevokeSshSessionResponse, SandboxLogLine, SandboxPolicyRevision,
3131
SandboxResponse, SandboxStreamEvent, ServiceStatus, SettingScope, SettingValue, SshSession,
3232
SubmitPolicyAnalysisRequest, SubmitPolicyAnalysisResponse, UndoDraftChunkRequest,
33-
UndoDraftChunkResponse, UpdateProviderRequest, UpdateSettingsRequest, UpdateSettingsResponse,
33+
UndoDraftChunkResponse, UpdateConfigRequest, UpdateConfigResponse, UpdateProviderRequest,
3434
WatchSandboxRequest, open_shell_server::OpenShell,
3535
};
3636
use openshell_core::proto::{
@@ -1086,10 +1086,10 @@ impl OpenShell for OpenShellService {
10861086
// Policy update handlers
10871087
// -------------------------------------------------------------------
10881088

1089-
async fn update_settings(
1089+
async fn update_config(
10901090
&self,
1091-
request: Request<UpdateSettingsRequest>,
1092-
) -> Result<Response<UpdateSettingsResponse>, Status> {
1091+
request: Request<UpdateConfigRequest>,
1092+
) -> Result<Response<UpdateConfigResponse>, Status> {
10931093
let req = request.into_inner();
10941094
let key = req.setting_key.trim();
10951095
let has_policy = req.policy.is_some();
@@ -1158,7 +1158,7 @@ impl OpenShell for OpenShellService {
11581158
save_global_settings(self.state.store.as_ref(), &global_settings)
11591159
.await?;
11601160
}
1161-
return Ok(Response::new(UpdateSettingsResponse {
1161+
return Ok(Response::new(UpdateConfigResponse {
11621162
version: u32::try_from(current.version).unwrap_or(0),
11631163
policy_hash: hash,
11641164
settings_revision: global_settings.revision,
@@ -1221,7 +1221,7 @@ impl OpenShell for OpenShellService {
12211221
save_global_settings(self.state.store.as_ref(), &global_settings).await?;
12221222
}
12231223

1224-
return Ok(Response::new(UpdateSettingsResponse {
1224+
return Ok(Response::new(UpdateConfigResponse {
12251225
version: u32::try_from(next_version).unwrap_or(0),
12261226
policy_hash: hash,
12271227
settings_revision: global_settings.revision,
@@ -1273,7 +1273,7 @@ impl OpenShell for OpenShellService {
12731273
save_global_settings(self.state.store.as_ref(), &global_settings).await?;
12741274
}
12751275

1276-
return Ok(Response::new(UpdateSettingsResponse {
1276+
return Ok(Response::new(UpdateConfigResponse {
12771277
version: 0,
12781278
policy_hash: String::new(),
12791279
settings_revision: global_settings.revision,
@@ -1334,7 +1334,7 @@ impl OpenShell for OpenShellService {
13341334
.await?;
13351335
}
13361336

1337-
return Ok(Response::new(UpdateSettingsResponse {
1337+
return Ok(Response::new(UpdateConfigResponse {
13381338
version: 0,
13391339
policy_hash: String::new(),
13401340
settings_revision: sandbox_settings.revision,
@@ -1368,7 +1368,7 @@ impl OpenShell for OpenShellService {
13681368
.await?;
13691369
}
13701370

1371-
return Ok(Response::new(UpdateSettingsResponse {
1371+
return Ok(Response::new(UpdateConfigResponse {
13721372
version: 0,
13731373
policy_hash: String::new(),
13741374
settings_revision: sandbox_settings.revision,
@@ -1424,7 +1424,7 @@ impl OpenShell for OpenShellService {
14241424
.map_err(|e| Status::internal(format!("backfill spec.policy failed: {e}")))?;
14251425
info!(
14261426
sandbox_id = %sandbox_id,
1427-
"UpdateSettings: backfilled spec.policy from sandbox-discovered policy"
1427+
"UpdateConfig: backfilled spec.policy from sandbox-discovered policy"
14281428
);
14291429
}
14301430

@@ -1443,7 +1443,7 @@ impl OpenShell for OpenShellService {
14431443
if let Some(ref current) = latest
14441444
&& current.policy_hash == hash
14451445
{
1446-
return Ok(Response::new(UpdateSettingsResponse {
1446+
return Ok(Response::new(UpdateConfigResponse {
14471447
version: u32::try_from(current.version).unwrap_or(0),
14481448
policy_hash: hash,
14491449
settings_revision: 0,
@@ -1474,10 +1474,10 @@ impl OpenShell for OpenShellService {
14741474
sandbox_id = %sandbox_id,
14751475
version = next_version,
14761476
policy_hash = %hash,
1477-
"UpdateSettings: new policy version persisted"
1477+
"UpdateConfig: new policy version persisted"
14781478
);
14791479

1480-
Ok(Response::new(UpdateSettingsResponse {
1480+
Ok(Response::new(UpdateConfigResponse {
14811481
version: u32::try_from(next_version).unwrap_or(0),
14821482
policy_hash: hash,
14831483
settings_revision: 0,
@@ -2474,7 +2474,7 @@ fn draft_chunk_record_to_proto(record: &DraftChunkRecord) -> Result<PolicyChunk,
24742474
/// Merge a draft chunk's proposed rule into the current active sandbox policy.
24752475
///
24762476
/// Returns `(new_version, policy_hash)`. This reuses the same persistence
2477-
/// pattern as `update_settings`: compute hash, check for no-op,
2477+
/// pattern as `update_config`: compute hash, check for no-op,
24782478
/// persist a new revision, supersede older versions, and notify watchers.
24792479
/// Maximum number of optimistic retry attempts for policy version conflicts.
24802480
const MERGE_RETRY_LIMIT: usize = 5;
@@ -4908,7 +4908,7 @@ mod tests {
49084908
};
49094909
store.put_message(&sandbox).await.unwrap();
49104910

4911-
// Simulate what update_settings does when spec.policy is None:
4911+
// Simulate what update_config does when spec.policy is None:
49124912
// backfill spec.policy with the new policy.
49134913
let new_policy = ProtoSandboxPolicy {
49144914
version: 1,

crates/openshell-server/tests/auth_endpoint_integration.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,10 +549,10 @@ impl openshell_core::proto::open_shell_server::OpenShell for TestOpenShell {
549549
))
550550
}
551551

552-
async fn update_settings(
552+
async fn update_config(
553553
&self,
554-
_: tonic::Request<openshell_core::proto::UpdateSettingsRequest>,
555-
) -> Result<tonic::Response<openshell_core::proto::UpdateSettingsResponse>, tonic::Status> {
554+
_: tonic::Request<openshell_core::proto::UpdateConfigRequest>,
555+
) -> Result<tonic::Response<openshell_core::proto::UpdateConfigResponse>, tonic::Status> {
556556
Err(tonic::Status::unimplemented("test"))
557557
}
558558

crates/openshell-server/tests/edge_tunnel_auth.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ impl OpenShell for TestOpenShell {
203203
Ok(Response::new(ReceiverStream::new(rx)))
204204
}
205205

206-
async fn update_settings(
206+
async fn update_config(
207207
&self,
208-
_request: tonic::Request<openshell_core::proto::UpdateSettingsRequest>,
209-
) -> Result<Response<openshell_core::proto::UpdateSettingsResponse>, Status> {
208+
_request: tonic::Request<openshell_core::proto::UpdateConfigRequest>,
209+
) -> Result<Response<openshell_core::proto::UpdateConfigResponse>, Status> {
210210
Err(Status::unimplemented("not implemented in test"))
211211
}
212212

0 commit comments

Comments
 (0)