refactor: remove worker capability summary flags
This commit is contained in:
@@ -5,7 +5,6 @@ pub use server_api::{
|
||||
CreateWorkspaceWorkerRequest as BackendCreateWorkerRequest, Diagnostic as BackendDiagnostic,
|
||||
DiagnosticSeverity as BackendDiagnosticSeverity, ListResponse as BackendRuntimeListResponse,
|
||||
RuntimeSummary as BackendRuntimeSummary,
|
||||
WorkerCapabilitySummary as BackendWorkerCapabilitySummary,
|
||||
WorkerImplementationSummary as BackendWorkerImplementationSummary,
|
||||
WorkerLaunchOptionsResponse as BackendWorkerLaunchOptions,
|
||||
WorkerLaunchProfileCandidate as BackendWorkerLaunchProfileCandidate,
|
||||
@@ -869,7 +868,6 @@ mod tests {
|
||||
"pinned": false,
|
||||
"retention_state": "resident",
|
||||
"implementation": {"kind": "embedded", "display_hint": "Embedded"},
|
||||
"capabilities": {"can_stop": true, "can_spawn_followup": false},
|
||||
"diagnostics": []
|
||||
},
|
||||
"diagnostics": []
|
||||
@@ -952,10 +950,11 @@ mod tests {
|
||||
"label": "Coder",
|
||||
"workspace": {"visibility": "workspace", "identity": "workspace"},
|
||||
"state": "idle",
|
||||
"availability": "observed",
|
||||
"implementation": {"kind": "worker", "display_hint": "Coder"},
|
||||
"capabilities": {"can_stop": true, "can_spawn_followup": false},
|
||||
"workdir_attachments": [{
|
||||
"alias": "checkout",
|
||||
"effective_permissions": {"read": true, "write": true, "command": true},
|
||||
"working_directory": {
|
||||
"working_directory_id": "wd-1",
|
||||
"source": {"kind": "repository", "repository_key": "main"},
|
||||
|
||||
@@ -24,7 +24,7 @@ pub use backend_runtime::{
|
||||
BackendCreateWorkerRequest, BackendCreateWorkerResponse, BackendDiagnostic,
|
||||
BackendDiagnosticSeverity, BackendRuntimeClientError, BackendRuntimeListResponse,
|
||||
BackendRuntimeListTarget, BackendRuntimeSummary, BackendRuntimeTarget,
|
||||
BackendWorkerCapabilitySummary, BackendWorkerImplementationSummary, BackendWorkerLaunchOptions,
|
||||
BackendWorkerImplementationSummary, BackendWorkerLaunchOptions,
|
||||
BackendWorkerLaunchProfileCandidate, BackendWorkerLaunchRuntimeOption,
|
||||
BackendWorkerLaunchTarget, BackendWorkerOperationState, BackendWorkerRestoreResponse,
|
||||
BackendWorkerRestoreResult, BackendWorkerRestoreState, BackendWorkerSummary,
|
||||
|
||||
@@ -1029,7 +1029,7 @@ mod tests {
|
||||
),
|
||||
(
|
||||
"200 OK",
|
||||
r#"{"workspace_id":"workspace-a","runtime_id":"embedded","worker_id":"worker-1","console_href":"/w/workspace-a/workers/worker-1","worker":{"runtime_id":"embedded","worker_id":"worker-1","host_id":"embedded","display_name":"Intake","label":"worker-1","profile":"builtin:intake","singleton_key":null,"tags":[],"workspace":{"visibility":"workspace","identity":"workspace-a","workspace_id":"workspace-a"},"state":"idle","last_seen_at":null,"pinned":false,"retention_state":"active","implementation":{"kind":"runtime","display_hint":"Runtime Worker"},"capabilities":{"can_stop":true,"can_spawn_followup":false},"diagnostics":[]},"diagnostics":[]}"#,
|
||||
r#"{"workspace_id":"workspace-a","runtime_id":"embedded","worker_id":"worker-1","console_href":"/w/workspace-a/workers/worker-1","worker":{"runtime_id":"embedded","worker_id":"worker-1","host_id":"embedded","display_name":"Intake","label":"worker-1","profile":"builtin:intake","singleton_key":null,"tags":[],"workspace":{"visibility":"workspace","identity":"workspace-a","workspace_id":"workspace-a"},"state":"idle","last_seen_at":null,"pinned":false,"retention_state":"active","implementation":{"kind":"runtime","display_hint":"Runtime Worker"},"diagnostics":[]},"diagnostics":[]}"#,
|
||||
),
|
||||
]);
|
||||
let client = BackendWorkspaceProductClient::new_with_access_token(
|
||||
@@ -1057,7 +1057,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn workspace_orchestrator_launch_uses_scoped_backend_route() {
|
||||
let body = r#"{"workspace_id":"workspace-a","online":true,"disposition":"created","worker":{"runtime_id":"embedded","worker_id":"worker-2","host_id":"embedded","display_name":"Orchestrator","label":"worker-2","profile":"builtin:orchestrator","singleton_key":"workspace-orchestrator","tags":[],"workspace":{"visibility":"workspace","identity":"workspace-a","workspace_id":"workspace-a"},"state":"idle","last_seen_at":null,"pinned":true,"retention_state":"active","implementation":{"kind":"runtime","display_hint":"Runtime Worker"},"capabilities":{"can_stop":true,"can_spawn_followup":false},"diagnostics":[]},"diagnostics":[]}"#;
|
||||
let body = r#"{"workspace_id":"workspace-a","online":true,"disposition":"created","worker":{"runtime_id":"embedded","worker_id":"worker-2","host_id":"embedded","display_name":"Orchestrator","label":"worker-2","profile":"builtin:orchestrator","singleton_key":"workspace-orchestrator","tags":[],"workspace":{"visibility":"workspace","identity":"workspace-a","workspace_id":"workspace-a"},"state":"idle","last_seen_at":null,"pinned":true,"retention_state":"active","implementation":{"kind":"runtime","display_hint":"Runtime Worker"},"diagnostics":[]},"diagnostics":[]}"#;
|
||||
let (base_url, request, handle) = one_response_server("200 OK", body);
|
||||
let client = BackendWorkspaceProductClient::new_with_access_token(
|
||||
base_url,
|
||||
|
||||
@@ -6892,7 +6892,6 @@ pub struct RuntimeWorkerSummary {
|
||||
#[serde(default)]
|
||||
pub retention_state: String,
|
||||
pub implementation: WorkerImplementationSummary,
|
||||
pub capabilities: WorkerCapabilitySummary,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub workdir_attachments: Vec<serde_json::Value>,
|
||||
#[serde(default)]
|
||||
@@ -7888,13 +7887,6 @@ pub struct WorkerImplementationSummary {
|
||||
pub display_hint: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
|
||||
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
|
||||
pub struct WorkerCapabilitySummary {
|
||||
pub can_stop: bool,
|
||||
pub can_spawn_followup: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
|
||||
#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
|
||||
#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
|
||||
@@ -8120,7 +8112,6 @@ pub struct WorkerSummary {
|
||||
#[serde(default)]
|
||||
pub retention_state: String,
|
||||
pub implementation: WorkerImplementationSummary,
|
||||
pub capabilities: WorkerCapabilitySummary,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub workdir_attachments: Vec<WorkerWorkdirAttachmentSummary>,
|
||||
#[serde(default)]
|
||||
@@ -8163,7 +8154,6 @@ pub struct WorkerLaunchWorkerSummary {
|
||||
pub pinned: bool,
|
||||
pub retention_state: String,
|
||||
pub implementation: WorkerImplementationSummary,
|
||||
pub capabilities: WorkerCapabilitySummary,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub workdir_attachments: Vec<RuntimeWorkerWorkdirAttachmentSummary>,
|
||||
#[serde(default)]
|
||||
@@ -9339,7 +9329,6 @@ pub fn worker_launch_api_typescript() -> String {
|
||||
WorkingDirectorySummary::decl(&config),
|
||||
WorkerWorkspaceSummary::decl(&config),
|
||||
WorkerImplementationSummary::decl(&config),
|
||||
WorkerCapabilitySummary::decl(&config),
|
||||
RuntimeWorkerWorkdirAttachmentSummary::decl(&config),
|
||||
WorkerLaunchWorkerSummary::decl(&config),
|
||||
WorkerLaunchRuntimeOption::decl(&config),
|
||||
@@ -10308,10 +10297,6 @@ mod tests {
|
||||
kind: "runtime".to_string(),
|
||||
display_hint: "Runtime Worker".to_string(),
|
||||
},
|
||||
capabilities: WorkerCapabilitySummary {
|
||||
can_stop: true,
|
||||
can_spawn_followup: false,
|
||||
},
|
||||
workdir_attachments: Vec::new(),
|
||||
diagnostics: Vec::new(),
|
||||
}
|
||||
@@ -10791,7 +10776,6 @@ mod tests {
|
||||
},
|
||||
"state": "idle",
|
||||
"implementation": {"kind": "worker", "display_hint": "Coder"},
|
||||
"capabilities": {"can_stop": true, "can_spawn_followup": false}
|
||||
});
|
||||
|
||||
assert!(serde_json::from_value::<WorkerSummary>(payload).is_err());
|
||||
|
||||
@@ -552,9 +552,8 @@ fn working_directory_text(worker: &BackendWorkerSummary) -> String {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use client::{
|
||||
BackendDiagnostic, BackendDiagnosticSeverity, BackendWorkerCapabilitySummary,
|
||||
BackendWorkerImplementationSummary, BackendWorkerRestoreResult,
|
||||
BackendWorkerWorkspaceSummary,
|
||||
BackendDiagnostic, BackendDiagnosticSeverity, BackendWorkerImplementationSummary,
|
||||
BackendWorkerRestoreResult, BackendWorkerWorkspaceSummary,
|
||||
};
|
||||
|
||||
fn worker(runtime_id: &str, worker_id: &str, profile: Option<&str>) -> BackendWorkerSummary {
|
||||
@@ -588,10 +587,6 @@ mod tests {
|
||||
kind: "embedded".to_string(),
|
||||
display_hint: "embedded".to_string(),
|
||||
},
|
||||
capabilities: BackendWorkerCapabilitySummary {
|
||||
can_stop: true,
|
||||
can_spawn_followup: false,
|
||||
},
|
||||
workdir_attachments: Vec::new(),
|
||||
diagnostics: Vec::new(),
|
||||
}
|
||||
|
||||
@@ -1298,7 +1298,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn runtime_owned_workspace_client_has_no_fixed_request_timeout() {
|
||||
let (base_url, server) = delayed_workspace_response(Duration::from_millis(75));
|
||||
// This must exceed reqwest::blocking::Client's default 30-second timeout.
|
||||
// A short delay only checks our Option field, not the effective HTTP deadline.
|
||||
let (base_url, server) = delayed_workspace_response(Duration::from_secs(31));
|
||||
let client =
|
||||
RuntimeOwnedWorkspaceClient::new("workspace-a", base_url, "runtime-a", "worker-a");
|
||||
assert_eq!(client.request_timeout, None);
|
||||
|
||||
@@ -240,12 +240,6 @@ pub struct InternalWorkerImplementationSummary {
|
||||
pub display_hint: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct InternalWorkerCapabilitySummary {
|
||||
pub can_stop: bool,
|
||||
pub can_spawn_followup: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct InternalWorkerSummary {
|
||||
#[serde(flatten)]
|
||||
@@ -273,7 +267,6 @@ pub struct InternalWorkerSummary {
|
||||
#[serde(default)]
|
||||
pub retention_state: String,
|
||||
pub implementation: InternalWorkerImplementationSummary,
|
||||
pub capabilities: InternalWorkerCapabilitySummary,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub workdir_attachments: Vec<WorkingDirectoryAttachmentStatus>,
|
||||
pub diagnostics: Vec<RuntimeDiagnostic>,
|
||||
@@ -384,10 +377,6 @@ pub(crate) fn workspace_worker_summary(
|
||||
kind: summary.implementation.kind,
|
||||
display_hint: summary.implementation.display_hint,
|
||||
},
|
||||
capabilities: server_api::WorkerCapabilitySummary {
|
||||
can_stop: summary.capabilities.can_stop,
|
||||
can_spawn_followup: summary.capabilities.can_spawn_followup,
|
||||
},
|
||||
workdir_attachments,
|
||||
diagnostics: summary.diagnostics.into_iter().map(Into::into).collect(),
|
||||
}
|
||||
@@ -2231,10 +2220,6 @@ impl EmbeddedWorkerRuntime {
|
||||
Some(EmbeddedWorkerRef::new(EmbeddedWorkerId::parse(worker_id)?))
|
||||
}
|
||||
|
||||
fn can_stop_embedded_worker(&self, status: EmbeddedWorkerStatus) -> bool {
|
||||
runtime_worker_can_stop(self.execution_enabled, status)
|
||||
}
|
||||
|
||||
fn map_worker_summary(
|
||||
&self,
|
||||
summary: worker_runtime::catalog::WorkerSummary,
|
||||
@@ -2274,11 +2259,6 @@ impl EmbeddedWorkerRuntime {
|
||||
kind: "embedded_worker_runtime".to_string(),
|
||||
display_hint: "backend-internal worker-runtime Worker".to_string(),
|
||||
},
|
||||
capabilities: InternalWorkerCapabilitySummary {
|
||||
can_stop: summary.execution_metadata_available
|
||||
&& self.can_stop_embedded_worker(summary.status),
|
||||
can_spawn_followup: false,
|
||||
},
|
||||
workdir_attachments: summary.workdir_attachments,
|
||||
diagnostics: embedded_worker_projection_diagnostics(
|
||||
summary.execution_metadata_available,
|
||||
@@ -2319,11 +2299,6 @@ impl EmbeddedWorkerRuntime {
|
||||
kind: "embedded_worker_runtime".to_string(),
|
||||
display_hint: "backend-internal worker-runtime Worker".to_string(),
|
||||
},
|
||||
capabilities: InternalWorkerCapabilitySummary {
|
||||
can_stop: detail.execution_metadata_available
|
||||
&& self.can_stop_embedded_worker(detail.status),
|
||||
can_spawn_followup: false,
|
||||
},
|
||||
workdir_attachments: detail.workdir_attachments,
|
||||
diagnostics: embedded_worker_projection_diagnostics(
|
||||
detail.execution_metadata_available,
|
||||
@@ -4127,11 +4102,6 @@ impl RemoteWorkerRuntime {
|
||||
kind: "remote_worker_runtime".to_string(),
|
||||
display_hint: "Backend-proxied remote worker-runtime Worker".to_string(),
|
||||
},
|
||||
capabilities: InternalWorkerCapabilitySummary {
|
||||
can_stop: summary.execution_metadata_available
|
||||
&& runtime_worker_can_stop(true, summary.status),
|
||||
can_spawn_followup: false,
|
||||
},
|
||||
workdir_attachments: summary.workdir_attachments,
|
||||
diagnostics: remote_worker_projection_diagnostics(summary.execution_metadata_available),
|
||||
}
|
||||
@@ -4170,11 +4140,6 @@ impl RemoteWorkerRuntime {
|
||||
kind: "remote_worker_runtime".to_string(),
|
||||
display_hint: "Backend-proxied remote worker-runtime Worker".to_string(),
|
||||
},
|
||||
capabilities: InternalWorkerCapabilitySummary {
|
||||
can_stop: detail.execution_metadata_available
|
||||
&& runtime_worker_can_stop(true, detail.status),
|
||||
can_spawn_followup: false,
|
||||
},
|
||||
workdir_attachments: detail.workdir_attachments,
|
||||
diagnostics: remote_worker_projection_diagnostics(detail.execution_metadata_available),
|
||||
}
|
||||
@@ -5152,10 +5117,6 @@ fn embedded_runtime_status_label(status: RuntimeStatus) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
fn runtime_worker_can_stop(execution_enabled: bool, status: EmbeddedWorkerStatus) -> bool {
|
||||
execution_enabled && status.is_active()
|
||||
}
|
||||
|
||||
fn embedded_worker_status_label(status: EmbeddedWorkerStatus) -> &'static str {
|
||||
match status {
|
||||
EmbeddedWorkerStatus::Idle => "idle",
|
||||
@@ -5963,10 +5924,6 @@ pub fn placeholder_worker(host_id: impl Into<String>) -> InternalWorkerSummary {
|
||||
kind: "placeholder".to_string(),
|
||||
display_hint: "unsupported".to_string(),
|
||||
},
|
||||
capabilities: InternalWorkerCapabilitySummary {
|
||||
can_stop: false,
|
||||
can_spawn_followup: false,
|
||||
},
|
||||
workdir_attachments: Vec::new(),
|
||||
diagnostics: vec![diagnostic(
|
||||
"runtime_capability_unsupported",
|
||||
@@ -6621,10 +6578,6 @@ mod tests {
|
||||
kind: "fixture".to_string(),
|
||||
display_hint: "test fixture".to_string(),
|
||||
},
|
||||
capabilities: InternalWorkerCapabilitySummary {
|
||||
can_stop: false,
|
||||
can_spawn_followup: false,
|
||||
},
|
||||
workdir_attachments: Vec::new(),
|
||||
diagnostics: Vec::new(),
|
||||
}],
|
||||
@@ -7123,7 +7076,12 @@ mod tests {
|
||||
let spawned = runtime.spawn_worker(test_create_binding(), embedded_spawn_request());
|
||||
assert_eq!(spawned.state, InternalWorkerOperationState::Accepted);
|
||||
let worker = spawned.worker.expect("created embedded worker");
|
||||
assert!(worker.capabilities.can_stop);
|
||||
assert!(
|
||||
serde_json::to_value(&worker)
|
||||
.unwrap()
|
||||
.get("capabilities")
|
||||
.is_none()
|
||||
);
|
||||
|
||||
let input = runtime.send_input(
|
||||
&worker.worker.worker_id,
|
||||
@@ -7496,7 +7454,12 @@ mod tests {
|
||||
workers.items[0].workspace.identity,
|
||||
"runtime_registry_worker"
|
||||
);
|
||||
assert!(workers.items[0].capabilities.can_stop);
|
||||
assert!(
|
||||
serde_json::to_value(&workers.items[0])
|
||||
.unwrap()
|
||||
.get("capabilities")
|
||||
.is_none()
|
||||
);
|
||||
|
||||
let input = registry
|
||||
.send_input(
|
||||
@@ -7581,11 +7544,14 @@ mod tests {
|
||||
|
||||
let workers = registry.list_workers(10);
|
||||
assert_eq!(workers.items.len(), 5);
|
||||
assert!(!workers.items[0].capabilities.can_stop);
|
||||
assert!(workers.items[1].capabilities.can_stop);
|
||||
assert!(workers.items[2].capabilities.can_stop);
|
||||
assert!(workers.items[3].capabilities.can_stop);
|
||||
assert!(!workers.items[4].capabilities.can_stop);
|
||||
for worker in &workers.items {
|
||||
assert!(
|
||||
serde_json::to_value(worker)
|
||||
.unwrap()
|
||||
.get("capabilities")
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
assert_eq!(workers.items[0].state, "stopped");
|
||||
assert_eq!(workers.items[1].state, "running");
|
||||
assert_eq!(workers.items[2].state, "paused");
|
||||
@@ -7601,7 +7567,12 @@ mod tests {
|
||||
let stopped_detail = registry
|
||||
.worker(&RuntimeWorkerRef::new("remote:primary", &worker_id))
|
||||
.unwrap();
|
||||
assert!(!stopped_detail.capabilities.can_stop);
|
||||
assert!(
|
||||
serde_json::to_value(&stopped_detail)
|
||||
.unwrap()
|
||||
.get("capabilities")
|
||||
.is_none()
|
||||
);
|
||||
assert_eq!(stopped_detail.state, "stopped");
|
||||
|
||||
server.join().expect("mock remote server finished");
|
||||
|
||||
@@ -152,17 +152,16 @@ use crate::companion::{
|
||||
use crate::config_source::ConfigCommitRequest;
|
||||
use crate::hosts::{
|
||||
EMBEDDED_RUNTIME_ID, EmbeddedWorkerRuntime, HostDiagnosticSeverity, InternalHostSummary,
|
||||
InternalWorkerCapabilitySummary, InternalWorkerImplementationSummary,
|
||||
InternalWorkerOperationState, InternalWorkerRestoreResult, InternalWorkerSummary,
|
||||
InternalWorkerWorkspaceSummary, RemoteRuntimeConfig, RemoteWorkerRuntime, RuntimeDiagnostic,
|
||||
RuntimePingFailureKind, RuntimeRegistry, RuntimeRegistryError, RuntimeRegistryUnregisterResult,
|
||||
TicketWorkerRole, WorkerCompletionsRequest, WorkerCompletionsResult, WorkerControlOperation,
|
||||
WorkerCreateBinding, WorkerInputKind, WorkerInputRequest, WorkerInputResult,
|
||||
WorkerLifecycleRequest, WorkerLifecycleResult, WorkerSpawnAcceptanceRequirement,
|
||||
WorkerSpawnIntent, WorkerSpawnRequest, WorkerSpawnResult, WorkerSpawnWorkingDirectoryRequest,
|
||||
WorkerTicketAssignmentRequest, WorkspaceRuntimeAuthorization,
|
||||
is_disallowed_remote_runtime_address, is_loopback_runtime_origin,
|
||||
worker_spawn_create_fingerprint, workspace_worker_summary,
|
||||
InternalWorkerImplementationSummary, InternalWorkerOperationState, InternalWorkerRestoreResult,
|
||||
InternalWorkerSummary, InternalWorkerWorkspaceSummary, RemoteRuntimeConfig,
|
||||
RemoteWorkerRuntime, RuntimeDiagnostic, RuntimePingFailureKind, RuntimeRegistry,
|
||||
RuntimeRegistryError, RuntimeRegistryUnregisterResult, TicketWorkerRole,
|
||||
WorkerCompletionsRequest, WorkerCompletionsResult, WorkerControlOperation, WorkerCreateBinding,
|
||||
WorkerInputKind, WorkerInputRequest, WorkerInputResult, WorkerLifecycleRequest,
|
||||
WorkerLifecycleResult, WorkerSpawnAcceptanceRequirement, WorkerSpawnIntent, WorkerSpawnRequest,
|
||||
WorkerSpawnResult, WorkerSpawnWorkingDirectoryRequest, WorkerTicketAssignmentRequest,
|
||||
WorkspaceRuntimeAuthorization, is_disallowed_remote_runtime_address,
|
||||
is_loopback_runtime_origin, worker_spawn_create_fingerprint, workspace_worker_summary,
|
||||
};
|
||||
use crate::memory_backend::execute_memory_backend_operation_with_authority;
|
||||
use crate::memory_staging::{
|
||||
@@ -5175,10 +5174,6 @@ fn runtime_worker_summary_to_api(
|
||||
kind: worker.implementation.kind,
|
||||
display_hint: worker.implementation.display_hint,
|
||||
},
|
||||
capabilities: server_api::WorkerCapabilitySummary {
|
||||
can_stop: worker.capabilities.can_stop,
|
||||
can_spawn_followup: worker.capabilities.can_spawn_followup,
|
||||
},
|
||||
workdir_attachments: worker
|
||||
.workdir_attachments
|
||||
.into_iter()
|
||||
@@ -16956,10 +16951,6 @@ fn worker_launch_worker_summary(worker: InternalWorkerSummary) -> WorkerLaunchWo
|
||||
kind: worker.implementation.kind,
|
||||
display_hint: worker.implementation.display_hint,
|
||||
},
|
||||
capabilities: server_api::WorkerCapabilitySummary {
|
||||
can_stop: worker.capabilities.can_stop,
|
||||
can_spawn_followup: worker.capabilities.can_spawn_followup,
|
||||
},
|
||||
workdir_attachments: worker
|
||||
.workdir_attachments
|
||||
.into_iter()
|
||||
@@ -24806,10 +24797,6 @@ fn worker_summary_from_registry(record: &WorkerRegistryRecord) -> InternalWorker
|
||||
last_seen_at: Some(record.updated_at.clone()),
|
||||
pinned: record.retention_state == "pinned",
|
||||
retention_state: record.retention_state.clone(),
|
||||
capabilities: InternalWorkerCapabilitySummary {
|
||||
can_stop: false,
|
||||
can_spawn_followup: false,
|
||||
},
|
||||
workspace: InternalWorkerWorkspaceSummary {
|
||||
visibility: "backend_registry".to_string(),
|
||||
identity: record.workspace_id.clone(),
|
||||
@@ -24855,8 +24842,6 @@ fn worker_summary_from_projection(
|
||||
.then(|| observation.worker.worker_state.clone())
|
||||
.flatten();
|
||||
summary.last_seen_at = Some(observation.observed_at.clone());
|
||||
summary.capabilities.can_stop = observed
|
||||
&& observation.worker.state != protocol::subscription::SubscriptionWorkerState::Stopped;
|
||||
summary.implementation.display_hint = if observed {
|
||||
"Runtime-backed Worker".to_string()
|
||||
} else {
|
||||
@@ -26709,7 +26694,12 @@ mod tests {
|
||||
assert_eq!(unavailable.availability, availability);
|
||||
assert_eq!(unavailable.state, "unavailable");
|
||||
assert_eq!(unavailable.worker_state, None);
|
||||
assert!(!unavailable.capabilities.can_stop);
|
||||
assert!(
|
||||
serde_json::to_value(&unavailable)
|
||||
.unwrap()
|
||||
.get("capabilities")
|
||||
.is_none()
|
||||
);
|
||||
|
||||
let mut observed_stopped = projection;
|
||||
let observation = observed_stopped.observation.as_mut().unwrap();
|
||||
@@ -28645,10 +28635,6 @@ mod tests {
|
||||
kind: "fixture".to_string(),
|
||||
display_hint: "Workdirless fixture".to_string(),
|
||||
},
|
||||
capabilities: InternalWorkerCapabilitySummary {
|
||||
can_stop: true,
|
||||
can_spawn_followup: false,
|
||||
},
|
||||
workdir_attachments: Vec::new(),
|
||||
diagnostics: Vec::new(),
|
||||
}
|
||||
@@ -40983,10 +40969,6 @@ mod tests {
|
||||
kind: "remote".to_string(),
|
||||
display_hint: "remote".to_string(),
|
||||
},
|
||||
capabilities: server_api::WorkerCapabilitySummary {
|
||||
can_stop: true,
|
||||
can_spawn_followup: false,
|
||||
},
|
||||
workdir_attachments: Vec::new(),
|
||||
diagnostics: Vec::new(),
|
||||
}
|
||||
@@ -41081,10 +41063,6 @@ mod tests {
|
||||
kind: "remote".to_string(),
|
||||
display_hint: "remote".to_string(),
|
||||
},
|
||||
capabilities: server_api::WorkerCapabilitySummary {
|
||||
can_stop: true,
|
||||
can_spawn_followup: false,
|
||||
},
|
||||
workdir_attachments: Vec::new(),
|
||||
diagnostics: Vec::new(),
|
||||
}],
|
||||
@@ -43445,7 +43423,12 @@ mod tests {
|
||||
// catalog remains controllable while its failed execution is represented in
|
||||
// `worker_state` rather than by removing the catalog Worker.
|
||||
assert_eq!(restored_worker.state, "idle");
|
||||
assert!(restored_worker.capabilities.can_stop);
|
||||
assert!(
|
||||
serde_json::to_value(&restored_worker)
|
||||
.unwrap()
|
||||
.get("capabilities")
|
||||
.is_none()
|
||||
);
|
||||
|
||||
let bundles = restored
|
||||
.runtime
|
||||
|
||||
Reference in New Issue
Block a user