aKode fase 5: test e snapshot adeguati alla rinomina, 429 distinto (ProviderRateLimited), cargo fmt dopo il cambio dei prefissi

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-11 12:47:01 +01:00
parent 8b73331037
commit ad43f9281a
919 changed files with 2358 additions and 2430 deletions

View File

@@ -222,7 +222,10 @@ fn invalid_application_policy_is_rejected_before_layer_overrides() {
#[test]
fn system_application_network_uses_managed_precedence() {
let mut layers = vec![RequirementsLayerEntry::from_toml(system_source(), WORKSPACE)];
let mut layers = vec![RequirementsLayerEntry::from_toml(
system_source(),
WORKSPACE,
)];
layers.push(RequirementsLayerEntry::from_toml(
managed_source(),
INSTALLATION,

View File

@@ -11,20 +11,18 @@ impl ManagedAuthPolicy {
/// Narrows the managed workspace allowlist by locally forced workspace IDs, so the
/// non-API login method is disabled when no permitted workspace remains.
pub fn with_forced_chatgpt_workspaces(mut self, forced_workspaces: Option<&[String]>) -> Self {
self.allowed_chatgpt_workspaces = match (
forced_workspaces,
self.allowed_chatgpt_workspaces.take(),
) {
(Some(forced), Some(allowed)) => Some(
forced
.iter()
.filter(|workspace| allowed.contains(workspace))
.cloned()
.collect(),
),
(Some(forced), None) => Some(forced.to_vec()),
(None, allowed) => allowed,
};
self.allowed_chatgpt_workspaces =
match (forced_workspaces, self.allowed_chatgpt_workspaces.take()) {
(Some(forced), Some(allowed)) => Some(
forced
.iter()
.filter(|workspace| allowed.contains(workspace))
.cloned()
.collect(),
),
(Some(forced), None) => Some(forced.to_vec()),
(None, allowed) => allowed,
};
self
}

View File

@@ -2521,13 +2521,13 @@ mod tests {
use crate::McpServerCommandMatcher;
use crate::McpServerIdentity;
use crate::McpServerValueMatcher;
use anyhow::Result;
use akode_execpolicy::Decision;
use akode_execpolicy::Evaluation;
use akode_execpolicy::RuleMatch;
use akode_protocol::permissions::NetworkSandboxPolicy;
use akode_utils_absolute_path::AbsolutePathBuf;
use akode_utils_absolute_path::AbsolutePathBufGuard;
use anyhow::Result;
use pretty_assertions::assert_eq;
use toml::from_str;

View File

@@ -50,6 +50,17 @@ pub mod types;
pub const CONFIG_TOML_FILE: &str = "config.toml";
pub use akode_execpolicy::RequirementsExecPolicy;
pub use akode_protocol::config_types::ProfileV2Name;
pub use akode_protocol::config_types::ProfileV2NameParseError;
pub use akode_protocol::config_types::ToolExposureSurface;
pub use akode_protocol::mcp_policy::McpServerCommandMatcher;
pub use akode_protocol::mcp_policy::McpServerIdentity;
pub use akode_protocol::mcp_policy::McpServerRequirement;
pub use akode_protocol::mcp_policy::McpServerValueMatcher;
pub use akode_protocol::mcp_policy::PluginMcpRequirements as PluginRequirementsToml;
pub use akode_utils_absolute_path::AbsolutePathBuf;
pub use akode_utils_absolute_path::AbsolutePathBufGuard;
pub use application_requirements::ApplicationNetworkRequirementsToml;
pub use application_requirements::ApplicationRequirementsToml;
pub use application_storage_requirements::ApplicationStorageRequirementsToml;
@@ -66,19 +77,8 @@ pub use browser_computer_use_requirements::ComputerUseWindowsRequirementsToml;
pub use browser_computer_use_requirements::RequestHeaderToml;
pub use browser_use::BrowserUseConfigToml;
pub use browser_use::BrowserUseOriginPolicyConfigToml;
pub use akode_execpolicy::RequirementsExecPolicy;
#[cfg(target_os = "macos")]
pub use codex_home_symlink::allowed_symlinked_codex_home;
pub use akode_protocol::config_types::ProfileV2Name;
pub use akode_protocol::config_types::ProfileV2NameParseError;
pub use akode_protocol::config_types::ToolExposureSurface;
pub use akode_protocol::mcp_policy::McpServerCommandMatcher;
pub use akode_protocol::mcp_policy::McpServerIdentity;
pub use akode_protocol::mcp_policy::McpServerRequirement;
pub use akode_protocol::mcp_policy::McpServerValueMatcher;
pub use akode_protocol::mcp_policy::PluginMcpRequirements as PluginRequirementsToml;
pub use akode_utils_absolute_path::AbsolutePathBuf;
pub use akode_utils_absolute_path::AbsolutePathBufGuard;
pub use computer_use::ComputerUseConfigToml;
pub use computer_use::ComputerUseMacosConfigToml;
pub use computer_use::ComputerUseWindowsConfigToml;

View File

@@ -10,9 +10,9 @@ use crate::diagnostics::ConfigDiagnosticSource;
use crate::diagnostics::config_error_from_toml_for_source;
use crate::diagnostics::io_error_from_config_error;
use crate::strict_config::config_error_from_ignored_toml_value_fields_for_source_name;
use akode_utils_absolute_path::AbsolutePathBufGuard;
use base64::Engine;
use base64::prelude::BASE64_STANDARD;
use akode_utils_absolute_path::AbsolutePathBufGuard;
use core_foundation::base::Boolean;
use core_foundation::base::CFType;
use core_foundation::base::TCFType;

View File

@@ -186,7 +186,9 @@ pub async fn load_config_layers_state(
let config = toml::from_str(raw_toml).map_err(|error| {
io::Error::new(
io::ErrorKind::InvalidData,
format!("invalid embedded packaged defaults; this is an aKode build error: {error}"),
format!(
"invalid embedded packaged defaults; this is an aKode build error: {error}"
),
)
})?;
ConfigLayerEntry::new_with_raw_toml(

View File

@@ -6,11 +6,11 @@ use std::fmt;
use std::num::NonZeroUsize;
use std::time::Duration;
use base64::Engine;
use base64::engine::general_purpose::URL_SAFE_NO_PAD;
use akode_protocol::config_types::ToolExposureSurface;
use akode_utils_path_uri::LegacyAppPathString;
use akode_utils_redacted_string::RedactedString;
use base64::Engine;
use base64::engine::general_purpose::URL_SAFE_NO_PAD;
use schemars::JsonSchema;
use serde::Deserialize;
use serde::Deserializer;

View File

@@ -275,7 +275,7 @@ include_view_image_tool = false
.unwrap();
assert_eq!(
ignored_config_warning(&config, &[]).unwrap(),
"Codex is ignoring 3 unrecognized configuration settings. Check for typos or deprecated settings.\n MDM (Defaults:cfg): `model_providers.custom.unknown_timeout` is ignored.\n session-flags: `model_providers.custom.unknown_timeout` is ignored.\n session-flags: `profiles.work.features.include_view_image_tool` is ignored. Use [features].view_image to configure the image tool."
"aKode is ignoring 3 unrecognized configuration settings. Check for typos or deprecated settings.\n MDM (Defaults:cfg): `model_providers.custom.unknown_timeout` is ignored.\n session-flags: `model_providers.custom.unknown_timeout` is ignored.\n session-flags: `profiles.work.features.include_view_image_tool` is ignored. Use [features].view_image to configure the image tool."
);
}
@@ -292,7 +292,7 @@ fn removed_private_desktop_setting_has_migration_hint() {
.unwrap();
assert_eq!(
ignored_config_warning(&config, &[]).unwrap(),
"Codex is ignoring 1 unrecognized configuration setting. Check for typos or deprecated settings.\n session-flags: `windows.sandbox_private_desktop` is ignored. Remove windows.sandbox_private_desktop; legacy Windows sandboxes always use a private desktop."
"aKode is ignoring 1 unrecognized configuration setting. Check for typos or deprecated settings.\n session-flags: `windows.sandbox_private_desktop` is ignored. Remove windows.sandbox_private_desktop; legacy Windows sandboxes always use a private desktop."
);
}
@@ -320,7 +320,7 @@ fn managed_network_unknown_fields_are_reported_for_each_spelling() {
assert_eq!(
ignored_config_warning(&config, &[requirements]),
Some(format!(
"Codex is ignoring 2 unrecognized configuration settings. Check for typos or deprecated settings.\n requirements (<unspecified>): `{table}.enabld` is ignored.\n requirements (<unspecified>): `{table}.header_injections.0.unknown` is ignored."
"aKode is ignoring 2 unrecognized configuration settings. Check for typos or deprecated settings.\n requirements (<unspecified>): `{table}.enabld` is ignored.\n requirements (<unspecified>): `{table}.header_injections.0.unknown` is ignored."
)),
"{table}"
);