fix: keep config bundles transport-only
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
use crate::catalog::{CreateWorkerRequest, WorkingDirectoryStatus};
|
use crate::catalog::{CreateWorkerRequest, WorkingDirectoryStatus};
|
||||||
use crate::config_bundle::{ConfigBundle, validate_config_bundle};
|
use crate::config_bundle::ConfigBundle;
|
||||||
use crate::diagnostics::{DiagnosticSeverity, RuntimeDiagnostic};
|
use crate::diagnostics::{DiagnosticSeverity, RuntimeDiagnostic};
|
||||||
use crate::error::RuntimeError;
|
use crate::error::RuntimeError;
|
||||||
use crate::identity::{WorkerId, WorkerRef};
|
use crate::identity::{WorkerId, WorkerRef};
|
||||||
@@ -245,7 +245,6 @@ pub(crate) struct PersistedRuntimeState {
|
|||||||
pub(crate) next_diagnostic_id: u64,
|
pub(crate) next_diagnostic_id: u64,
|
||||||
pub(crate) workers: BTreeMap<WorkerId, PersistedWorkerRecord>,
|
pub(crate) workers: BTreeMap<WorkerId, PersistedWorkerRecord>,
|
||||||
pub(crate) workspace_owners: BTreeMap<String, String>,
|
pub(crate) workspace_owners: BTreeMap<String, String>,
|
||||||
pub(crate) config_bundles: BTreeMap<String, ConfigBundle>,
|
|
||||||
pub(crate) diagnostics: Vec<RuntimeDiagnostic>,
|
pub(crate) diagnostics: Vec<RuntimeDiagnostic>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,7 +299,7 @@ impl RuntimeSnapshot {
|
|||||||
status: state.status,
|
status: state.status,
|
||||||
next_worker_sequence: state.next_worker_sequence,
|
next_worker_sequence: state.next_worker_sequence,
|
||||||
next_diagnostic_id: state.next_diagnostic_id,
|
next_diagnostic_id: state.next_diagnostic_id,
|
||||||
config_bundles: state.config_bundles.clone(),
|
config_bundles: BTreeMap::new(),
|
||||||
workspace_owners: state.workspace_owners.clone(),
|
workspace_owners: state.workspace_owners.clone(),
|
||||||
diagnostics: state.diagnostics.clone(),
|
diagnostics: state.diagnostics.clone(),
|
||||||
}
|
}
|
||||||
@@ -324,13 +323,6 @@ impl RuntimeSnapshot {
|
|||||||
message: format!("runtime snapshot backend is {:?}", self.backend),
|
message: format!("runtime snapshot backend is {:?}", self.backend),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for bundle in self.config_bundles.values() {
|
|
||||||
validate_config_bundle(bundle).map_err(|error| RuntimeError::StoreCorrupt {
|
|
||||||
operation: "read runtime snapshot",
|
|
||||||
path: path.to_path_buf(),
|
|
||||||
message: format!("invalid config bundle {}: {error}", bundle.metadata.id),
|
|
||||||
})?;
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +336,6 @@ impl RuntimeSnapshot {
|
|||||||
next_worker_sequence: self.next_worker_sequence,
|
next_worker_sequence: self.next_worker_sequence,
|
||||||
next_diagnostic_id: self.next_diagnostic_id,
|
next_diagnostic_id: self.next_diagnostic_id,
|
||||||
workers,
|
workers,
|
||||||
config_bundles: self.config_bundles,
|
|
||||||
workspace_owners: self.workspace_owners,
|
workspace_owners: self.workspace_owners,
|
||||||
diagnostics: self.diagnostics,
|
diagnostics: self.diagnostics,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1937,7 +1937,7 @@ impl RuntimeState {
|
|||||||
next_worker_sequence: persisted.next_worker_sequence,
|
next_worker_sequence: persisted.next_worker_sequence,
|
||||||
next_diagnostic_id,
|
next_diagnostic_id,
|
||||||
workers,
|
workers,
|
||||||
config_bundles: persisted.config_bundles,
|
config_bundles: BTreeMap::new(),
|
||||||
workspace_owners: persisted.workspace_owners,
|
workspace_owners: persisted.workspace_owners,
|
||||||
diagnostics,
|
diagnostics,
|
||||||
subscription_revision: 0,
|
subscription_revision: 0,
|
||||||
@@ -1965,7 +1965,6 @@ impl RuntimeState {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|(worker_id, worker)| (worker_id.clone(), worker.persisted_record()))
|
.map(|(worker_id, worker)| (worker_id.clone(), worker.persisted_record()))
|
||||||
.collect(),
|
.collect(),
|
||||||
config_bundles: self.config_bundles.clone(),
|
|
||||||
workspace_owners: self.workspace_owners.clone(),
|
workspace_owners: self.workspace_owners.clone(),
|
||||||
diagnostics: self.diagnostics.clone(),
|
diagnostics: self.diagnostics.clone(),
|
||||||
}
|
}
|
||||||
@@ -4133,7 +4132,10 @@ mod tests {
|
|||||||
runtime.summary().unwrap().backend,
|
runtime.summary().unwrap().backend,
|
||||||
RuntimeBackendKind::FsStore
|
RuntimeBackendKind::FsStore
|
||||||
);
|
);
|
||||||
runtime.store_config_bundle(test_bundle()).unwrap();
|
let transport_bundle = test_bundle();
|
||||||
|
runtime
|
||||||
|
.store_config_bundle(transport_bundle.clone())
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let worker = runtime.create_worker(task_request("persist me")).unwrap();
|
let worker = runtime.create_worker(task_request("persist me")).unwrap();
|
||||||
runtime
|
runtime
|
||||||
@@ -4167,6 +4169,13 @@ mod tests {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let restored_worker = restored.worker_detail(&worker.worker_ref).unwrap();
|
let restored_worker = restored.worker_detail(&worker.worker_ref).unwrap();
|
||||||
assert_eq!(restored_worker.status, WorkerStatus::Stopped);
|
assert_eq!(restored_worker.status, WorkerStatus::Stopped);
|
||||||
|
assert!(matches!(
|
||||||
|
restored.check_config_bundle(&ConfigBundleRef {
|
||||||
|
id: transport_bundle.metadata.id.clone(),
|
||||||
|
digest: transport_bundle.metadata.digest.clone(),
|
||||||
|
}),
|
||||||
|
Err(RuntimeError::ConfigBundleMissing { .. })
|
||||||
|
));
|
||||||
assert!(!root.join("events.jsonl").exists());
|
assert!(!root.join("events.jsonl").exists());
|
||||||
assert!(!worker_store_dir.join("observations.jsonl").exists());
|
assert!(!worker_store_dir.join("observations.jsonl").exists());
|
||||||
#[cfg(feature = "ws-server")]
|
#[cfg(feature = "ws-server")]
|
||||||
|
|||||||
Reference in New Issue
Block a user