fix: keep config bundles transport-only
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
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::error::RuntimeError;
|
||||
use crate::identity::{WorkerId, WorkerRef};
|
||||
@@ -245,7 +245,6 @@ pub(crate) struct PersistedRuntimeState {
|
||||
pub(crate) next_diagnostic_id: u64,
|
||||
pub(crate) workers: BTreeMap<WorkerId, PersistedWorkerRecord>,
|
||||
pub(crate) workspace_owners: BTreeMap<String, String>,
|
||||
pub(crate) config_bundles: BTreeMap<String, ConfigBundle>,
|
||||
pub(crate) diagnostics: Vec<RuntimeDiagnostic>,
|
||||
}
|
||||
|
||||
@@ -300,7 +299,7 @@ impl RuntimeSnapshot {
|
||||
status: state.status,
|
||||
next_worker_sequence: state.next_worker_sequence,
|
||||
next_diagnostic_id: state.next_diagnostic_id,
|
||||
config_bundles: state.config_bundles.clone(),
|
||||
config_bundles: BTreeMap::new(),
|
||||
workspace_owners: state.workspace_owners.clone(),
|
||||
diagnostics: state.diagnostics.clone(),
|
||||
}
|
||||
@@ -324,13 +323,6 @@ impl RuntimeSnapshot {
|
||||
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(())
|
||||
}
|
||||
|
||||
@@ -344,7 +336,6 @@ impl RuntimeSnapshot {
|
||||
next_worker_sequence: self.next_worker_sequence,
|
||||
next_diagnostic_id: self.next_diagnostic_id,
|
||||
workers,
|
||||
config_bundles: self.config_bundles,
|
||||
workspace_owners: self.workspace_owners,
|
||||
diagnostics: self.diagnostics,
|
||||
}
|
||||
|
||||
@@ -1937,7 +1937,7 @@ impl RuntimeState {
|
||||
next_worker_sequence: persisted.next_worker_sequence,
|
||||
next_diagnostic_id,
|
||||
workers,
|
||||
config_bundles: persisted.config_bundles,
|
||||
config_bundles: BTreeMap::new(),
|
||||
workspace_owners: persisted.workspace_owners,
|
||||
diagnostics,
|
||||
subscription_revision: 0,
|
||||
@@ -1965,7 +1965,6 @@ impl RuntimeState {
|
||||
.iter()
|
||||
.map(|(worker_id, worker)| (worker_id.clone(), worker.persisted_record()))
|
||||
.collect(),
|
||||
config_bundles: self.config_bundles.clone(),
|
||||
workspace_owners: self.workspace_owners.clone(),
|
||||
diagnostics: self.diagnostics.clone(),
|
||||
}
|
||||
@@ -4133,7 +4132,10 @@ mod tests {
|
||||
runtime.summary().unwrap().backend,
|
||||
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();
|
||||
runtime
|
||||
@@ -4167,6 +4169,13 @@ mod tests {
|
||||
.unwrap();
|
||||
let restored_worker = restored.worker_detail(&worker.worker_ref).unwrap();
|
||||
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!(!worker_store_dir.join("observations.jsonl").exists());
|
||||
#[cfg(feature = "ws-server")]
|
||||
|
||||
Reference in New Issue
Block a user