mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
e7039f9844
## Summary - Splits the monolithic `codex-cloud-config` implementation into focused modules. - Keeps behavior unchanged from the preceding config bundle runtime switch. ## Details This is the reviewability follow-up after the lineage-preserving migration PRs. The split separates backend transport, loader construction, cache handling, metrics, validation, service orchestration, and focused tests into named files. Verification: `just fmt`; `just test -p codex-cloud-config`.
35 lines
1.1 KiB
Rust
35 lines
1.1 KiB
Rust
use codex_config::AbsolutePathBuf;
|
|
use codex_config::CloudConfigBundle;
|
|
use codex_config::CloudConfigBundleLayers;
|
|
use codex_config::CloudConfigBundleLoadError;
|
|
use codex_config::CloudConfigBundleLoadErrorCode;
|
|
use codex_config::compose_requirements;
|
|
|
|
pub(crate) fn validate_bundle(
|
|
bundle: &CloudConfigBundle,
|
|
base_dir: &AbsolutePathBuf,
|
|
) -> Result<(), CloudConfigBundleLoadError> {
|
|
let bundle_layers =
|
|
CloudConfigBundleLayers::from_bundle(bundle.clone(), base_dir).map_err(|err| {
|
|
CloudConfigBundleLoadError::new(
|
|
CloudConfigBundleLoadErrorCode::InvalidBundle,
|
|
/*status_code*/ None,
|
|
format!("invalid cloud config bundle: {err}"),
|
|
)
|
|
})?;
|
|
let CloudConfigBundleLayers {
|
|
enterprise_managed_config: _,
|
|
enterprise_managed_requirements,
|
|
} = bundle_layers;
|
|
|
|
compose_requirements(enterprise_managed_requirements).map_err(|err| {
|
|
CloudConfigBundleLoadError::new(
|
|
CloudConfigBundleLoadErrorCode::InvalidBundle,
|
|
/*status_code*/ None,
|
|
format!("invalid cloud config bundle: {err}"),
|
|
)
|
|
})?;
|
|
|
|
Ok(())
|
|
}
|