Merge branch 'dev/winston/credentialed-routes-backend-adapter-review-20260618' into dev/winston/credentialed-routes-context-final-20260618

This commit is contained in:
Winston Howes
2026-06-18 16:54:19 -07:00
3 changed files with 12 additions and 10 deletions
@@ -4,7 +4,7 @@ use pretty_assertions::assert_eq;
#[tokio::test]
async fn load_without_codex_backend_auth_returns_no_routes() {
assert_eq!(
load_for_session("https://example.invalid", None).await,
load_for_session("https://example.invalid", /*auth*/ None).await,
CredentialedRoutesConfig::default()
);
}
-9
View File
@@ -729,11 +729,6 @@ mod tests {
use std::net::IpAddr;
use std::net::Ipv4Addr;
use std::sync::Arc;
use std::sync::Mutex;
// Managed MITM CA files live under the shared test CODEX_HOME, so MITM-enabled config state
// must be materialized one test at a time.
static MITM_CONFIG_STATE_LOCK: Mutex<()> = Mutex::new(());
#[derive(Clone)]
struct StaticReloader {
@@ -756,10 +751,6 @@ mod tests {
fn state_for_settings(network: NetworkProxySettings) -> Arc<NetworkProxyState> {
let config = NetworkProxyConfig { network };
let _mitm_config_state_guard = config
.network
.mitm
.then(|| MITM_CONFIG_STATE_LOCK.lock().unwrap());
let state = build_config_state(config, NetworkProxyConstraints::default()).unwrap();
let reloader = Arc::new(StaticReloader {
state: state.clone(),
+11
View File
@@ -15,6 +15,8 @@ use crate::runtime::ConfigState;
use serde::Deserialize;
use std::collections::HashSet;
use std::sync::Arc;
#[cfg(test)]
use std::sync::Mutex;
pub use crate::runtime::BlockedRequest;
pub use crate::runtime::BlockedRequestArgs;
@@ -23,6 +25,10 @@ pub use crate::runtime::NetworkProxyState;
#[cfg(test)]
pub(crate) use crate::runtime::network_proxy_state_for_policy;
// Managed MITM CA files live under the shared test CODEX_HOME.
#[cfg(test)]
static MITM_CONFIG_STATE_LOCK: Mutex<()> = Mutex::new(());
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct NetworkProxyConstraints {
pub enabled: Option<bool>,
@@ -65,6 +71,11 @@ pub fn build_config_state(
config: NetworkProxyConfig,
constraints: NetworkProxyConstraints,
) -> anyhow::Result<ConfigState> {
#[cfg(test)]
let _mitm_config_state_guard = config
.network
.mitm
.then(|| MITM_CONFIG_STATE_LOCK.lock().unwrap());
crate::config::validate_unix_socket_allowlist_paths(&config)?;
let allowed_domains = config.network.allowed_domains().unwrap_or_default();
let denied_domains = config.network.denied_domains().unwrap_or_default();