fix: finish worker wording cleanup

This commit is contained in:
Keisuke Hirata 2026-06-29 04:54:33 +09:00
parent 17a9488a4a
commit c46e880b50
No known key found for this signature in database
3 changed files with 14 additions and 14 deletions

View File

@ -1,4 +1,4 @@
//! Error type for mutating pod-worker allocation operations. //! Error type for mutating Worker allocation operations.
use std::io; use std::io;
use std::path::PathBuf; use std::path::PathBuf;
@ -6,14 +6,14 @@ use std::path::PathBuf;
use manifest::{ScopeError, ScopeRule}; use manifest::{ScopeError, ScopeRule};
use session_store::SegmentId; use session_store::SegmentId;
/// Errors raised by the mutating pod-worker allocation operations. /// Errors raised by the mutating Worker allocation operations.
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
pub enum ScopeLockError { pub enum ScopeLockError {
#[error("I/O error on workers.json: {0}")] #[error("I/O error on workers.json: {0}")]
Io(#[from] io::Error), Io(#[from] io::Error),
#[error("pod name `{0}` is already registered")] #[error("worker `{0}` is already allocated")]
DuplicateWorkerName(String), DuplicateWorkerName(String),
#[error("requested scope `{}` conflicts with pod `{competitor}` rule `{}`", .rule.target.display(), .competitor_rule.target.display())] #[error("requested scope `{}` conflicts with worker allocation `{competitor}` rule `{}`", .rule.target.display(), .competitor_rule.target.display())]
WriteConflict { WriteConflict {
competitor: String, competitor: String,
rule: ScopeRule, rule: ScopeRule,
@ -26,10 +26,10 @@ pub enum ScopeLockError {
NotSubset { spawner: String, rule: ScopeRule }, NotSubset { spawner: String, rule: ScopeRule },
#[error("invalid delegation scope: {source}")] #[error("invalid delegation scope: {source}")]
InvalidScope { source: ScopeError }, InvalidScope { source: ScopeError },
#[error("pod `{0}` is not registered")] #[error("worker `{0}` is not allocated")]
UnknownWorker(String), UnknownWorker(String),
#[error( #[error(
"session {segment_id} is already held by pod `{worker_name}` at {}", "session {segment_id} is already allocated to worker `{worker_name}` at {}",
.socket.display() .socket.display()
)] )]
SegmentConflict { SegmentConflict {

View File

@ -239,7 +239,7 @@ async fn run_delete(
let Some(metadata) = metadata else { let Some(metadata) = metadata else {
return Ok(WorkerCleanupCliOutput { return Ok(WorkerCleanupCliOutput {
stdout: format!( stdout: format!(
"yoi worker delete\nstatus: refused\npod: {}\nreason: worker metadata is missing\n", "yoi worker delete\nstatus: refused\nworker: {}\nreason: worker metadata is missing\n",
options.name options.name
), ),
status: WorkerCleanupCliStatus::Failure, status: WorkerCleanupCliStatus::Failure,
@ -250,7 +250,7 @@ async fn run_delete(
if let Some(reason) = probe.refusal_reason() { if let Some(reason) = probe.refusal_reason() {
return Ok(WorkerCleanupCliOutput { return Ok(WorkerCleanupCliOutput {
stdout: format!( stdout: format!(
"yoi worker delete\nstatus: refused\npod: {}\nreason: {}\nsocket: {}\n", "yoi worker delete\nstatus: refused\nworker: {}\nreason: {}\nsocket: {}\n",
options.name, options.name,
reason, reason,
probe.socket_path.display() probe.socket_path.display()

View File

@ -1350,8 +1350,8 @@ impl FixtureWorkspace {
}; };
fixture.write_fixture_metadata("created", None)?; fixture.write_fixture_metadata("created", None)?;
write_blocking_pod_metadata(&fixture.xdg_data_home, "workspace")?; write_blocking_worker_metadata(&fixture.xdg_data_home, "workspace")?;
write_blocking_pod_metadata(&fixture.xdg_data_home, "workspace-orchestrator")?; write_blocking_worker_metadata(&fixture.xdg_data_home, "workspace-orchestrator")?;
run_yoi( run_yoi(
binary, binary,
&fixture.workspace, &fixture.workspace,
@ -1621,8 +1621,8 @@ impl FixtureWorkspace {
"host_runtime_inherited": false, "host_runtime_inherited": false,
"host_xdg_runtime_dir_present": std::env::var_os("XDG_RUNTIME_DIR").is_some(), "host_xdg_runtime_dir_present": std::env::var_os("XDG_RUNTIME_DIR").is_some(),
"tested_yoi_runtime_source": "fixture XDG_RUNTIME_DIR", "tested_yoi_runtime_source": "fixture XDG_RUNTIME_DIR",
"tested_yoi_pod_registry": self.xdg_runtime_dir.join("yoi").join("pods.json"), "tested_yoi_worker_allocation": self.xdg_runtime_dir.join("yoi").join("workers.json"),
"fixture_pod_metadata_root": self.xdg_data_home.join("yoi").join("pods") "fixture_worker_metadata_root": self.xdg_data_home.join("yoi").join("workers")
}, },
"tested_yoi_env_policy": tested_yoi_env_policy_overview(), "tested_yoi_env_policy": tested_yoi_env_policy_overview(),
"cleanup": cleanup, "cleanup": cleanup,
@ -1997,8 +1997,8 @@ fn copy_dir_recursive(source: &Path, destination: &Path) -> Result<()> {
Ok(()) Ok(())
} }
fn write_blocking_pod_metadata(data_home: &Path, worker_name: &str) -> Result<()> { fn write_blocking_worker_metadata(data_home: &Path, worker_name: &str) -> Result<()> {
let dir = data_home.join("yoi").join("pods").join(worker_name); let dir = data_home.join("yoi").join("workers").join(worker_name);
fs::create_dir_all(&dir)?; fs::create_dir_all(&dir)?;
fs::write(dir.join("metadata.json"), b"not valid metadata for e2e\n")?; fs::write(dir.join("metadata.json"), b"not valid metadata for e2e\n")?;
Ok(()) Ok(())