mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
config: own layer provenance types (#29722)
## Why Config layer provenance describes how effective configuration was assembled, so it belongs with the config loader rather than in app-server's serialized API types. ## What changed - Moved `ConfigLayerSource`, `ConfigLayerMetadata`, and `ConfigLayer` ownership into `codex-config`. - Kept app-server's wire payloads unchanged and added explicit conversions at the app boundary. - Removed lower-level app-server-protocol dependencies from config consumers. ## Stack This is PR 3 of 6, stacked on [PR #29721](https://github.com/openai/codex/pull/29721). Review only the delta from `codex/split-auth-domain-types`. Next: [PR #29723](https://github.com/openai/codex/pull/29723). ## Validation - `codex-config` coverage passed. - App-server config-manager and config RPC coverage passed.
This commit is contained in:
1 parent
4fe02f4fcf
commit
1d65ccabd5
36 files changed
+206
-72
No files matched your search
@@ -1,8 +1,8 @@
|
||||
use crate::config_layer::config_layer_metadata_to_api;
|
||||
use crate::config_layer::config_layer_to_api;
|
||||
use crate::config_manager::ConfigManager;
|
||||
use codex_app_server_protocol::Config as ApiConfig;
|
||||
use codex_app_server_protocol::ConfigBatchWriteParams;
|
||||
use codex_app_server_protocol::ConfigLayerMetadata;
|
||||
use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_app_server_protocol::ConfigReadParams;
|
||||
use codex_app_server_protocol::ConfigReadResponse;
|
||||
use codex_app_server_protocol::ConfigValueWriteParams;
|
||||
@@ -13,6 +13,8 @@ use codex_app_server_protocol::OverriddenMetadata;
|
||||
use codex_app_server_protocol::WriteStatus;
|
||||
use codex_config::CONFIG_TOML_FILE;
|
||||
use codex_config::ConfigLayerEntry;
|
||||
use codex_config::ConfigLayerMetadata;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::ConfigLayerStack;
|
||||
use codex_config::ConfigLayerStackOrdering;
|
||||
use codex_config::ConfigRequirementsToml;
|
||||
@@ -136,7 +138,11 @@ impl ConfigManager {
|
||||
|
||||
Ok(ConfigReadResponse {
|
||||
config,
|
||||
origins: layers.origins(),
|
||||
origins: layers
|
||||
.origins()
|
||||
.into_iter()
|
||||
.map(|(path, metadata)| (path, config_layer_metadata_to_api(metadata)))
|
||||
.collect(),
|
||||
layers: params.include_layers.then(|| {
|
||||
layers
|
||||
.get_layers(
|
||||
@@ -144,7 +150,7 @@ impl ConfigManager {
|
||||
/*include_disabled*/ true,
|
||||
)
|
||||
.iter()
|
||||
.map(|layer| layer.as_layer())
|
||||
.map(|layer| config_layer_to_api(layer.as_layer()))
|
||||
.collect()
|
||||
}),
|
||||
})
|
||||
@@ -671,7 +677,7 @@ fn compute_override_metadata(
|
||||
|
||||
Some(OverriddenMetadata {
|
||||
message,
|
||||
overriding_layer,
|
||||
overriding_layer: config_layer_metadata_to_api(overriding_layer),
|
||||
effective_value: effective_value
|
||||
.and_then(|value| serde_json::to_value(value).ok())
|
||||
.unwrap_or(JsonValue::Null),
|
||||
|
||||
Reference in new issue
Block a user