Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
139
akode-rs/core/src/windows_sandbox_tests.rs
Normal file
139
akode-rs/core/src/windows_sandbox_tests.rs
Normal file
@@ -0,0 +1,139 @@
|
||||
use super::*;
|
||||
use akode_features::Features;
|
||||
use akode_features::FeaturesToml;
|
||||
use akode_network_proxy::NetworkProxyConfig;
|
||||
use akode_protocol::models::PermissionProfile;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
#[test]
|
||||
fn elevated_flag_works_by_itself() {
|
||||
let mut features = Features::with_defaults();
|
||||
features.enable(Feature::WindowsSandboxElevated);
|
||||
|
||||
assert_eq!(
|
||||
WindowsSandboxLevel::from_features(&features),
|
||||
WindowsSandboxLevel::Elevated
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn restricted_token_flag_works_by_itself() {
|
||||
let mut features = Features::with_defaults();
|
||||
features.enable(Feature::WindowsSandbox);
|
||||
|
||||
assert_eq!(
|
||||
WindowsSandboxLevel::from_features(&features),
|
||||
WindowsSandboxLevel::RestrictedToken
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_flags_means_no_sandbox() {
|
||||
let features = Features::with_defaults();
|
||||
|
||||
assert_eq!(
|
||||
WindowsSandboxLevel::from_features(&features),
|
||||
WindowsSandboxLevel::Disabled
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn elevated_wins_when_both_flags_are_enabled() {
|
||||
let mut features = Features::with_defaults();
|
||||
features.enable(Feature::WindowsSandbox);
|
||||
features.enable(Feature::WindowsSandboxElevated);
|
||||
|
||||
assert_eq!(
|
||||
WindowsSandboxLevel::from_features(&features),
|
||||
WindowsSandboxLevel::Elevated
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_mode_prefers_elevated() {
|
||||
let mut entries = BTreeMap::new();
|
||||
entries.insert(
|
||||
"experimental_windows_sandbox".to_string(),
|
||||
/*value*/ true,
|
||||
);
|
||||
entries.insert("elevated_windows_sandbox".to_string(), /*value*/ true);
|
||||
|
||||
assert_eq!(
|
||||
legacy_windows_sandbox_mode_from_entries(&entries),
|
||||
Some(WindowsSandboxModeToml::Elevated)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_mode_supports_alias_key() {
|
||||
let mut entries = BTreeMap::new();
|
||||
entries.insert(
|
||||
"enable_experimental_windows_sandbox".to_string(),
|
||||
/*value*/ true,
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
legacy_windows_sandbox_mode_from_entries(&entries),
|
||||
Some(WindowsSandboxModeToml::Unelevated)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_windows_sandbox_mode_falls_back_to_legacy_keys() {
|
||||
let mut entries = BTreeMap::new();
|
||||
entries.insert(
|
||||
"experimental_windows_sandbox".to_string(),
|
||||
/*value*/ true,
|
||||
);
|
||||
let cfg = ConfigToml {
|
||||
features: Some(FeaturesToml::from(entries)),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
resolve_windows_sandbox_mode(&cfg),
|
||||
Some(WindowsSandboxModeToml::Unelevated)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn provisioning_settings_omit_the_disabled_socks_proxy() {
|
||||
let config = NetworkProxyConfig {
|
||||
enabled: true,
|
||||
proxy_url: "http://127.0.0.1:43128".to_string(),
|
||||
enable_socks5: false,
|
||||
socks_url: "socks5h://127.0.0.1:48081".to_string(),
|
||||
allow_local_binding: Some(true),
|
||||
..Default::default()
|
||||
};
|
||||
let spec = crate::config::NetworkProxySpec::from_config_and_constraints(
|
||||
config,
|
||||
/*requirements*/ None,
|
||||
&PermissionProfile::workspace_write(),
|
||||
)
|
||||
.expect("managed proxy config should resolve");
|
||||
|
||||
assert_eq!(
|
||||
provisioning_settings(Some(&spec)).expect("provisioning settings should resolve"),
|
||||
akode_windows_sandbox::WindowsSandboxProvisioningSettings {
|
||||
proxy_ports: vec![43128],
|
||||
allow_local_binding: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn provisioning_settings_are_empty_when_managed_network_is_disabled() {
|
||||
let spec = crate::config::NetworkProxySpec::from_config_and_constraints(
|
||||
NetworkProxyConfig::default(),
|
||||
/*requirements*/ None,
|
||||
&PermissionProfile::workspace_write(),
|
||||
)
|
||||
.expect("managed proxy config should resolve");
|
||||
|
||||
assert_eq!(
|
||||
provisioning_settings(Some(&spec)).expect("provisioning settings should resolve"),
|
||||
akode_windows_sandbox::WindowsSandboxProvisioningSettings::default()
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user