mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Use AbsolutePathBuf in skill loading and codex_home (#17407)
Helps with FS migration later
This commit is contained in:
committed by
GitHub
Unverified
parent
d25a9822a7
commit
ac82443d07
@@ -17,6 +17,7 @@ use codex_app_server_protocol::ConfigLayerSource;
|
||||
use codex_config::types::McpServerTransportConfig;
|
||||
use codex_login::CodexAuth;
|
||||
use codex_protocol::protocol::Product;
|
||||
use codex_utils_absolute_path::test_support::PathBufExt;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::fs;
|
||||
use tempfile::TempDir;
|
||||
@@ -164,7 +165,7 @@ fn load_plugins_loads_default_skills_and_mcp_servers() {
|
||||
),
|
||||
root: AbsolutePathBuf::try_from(plugin_root.clone()).unwrap(),
|
||||
enabled: true,
|
||||
skill_roots: vec![plugin_root.join("skills")],
|
||||
skill_roots: vec![plugin_root.join("skills").abs()],
|
||||
disabled_skill_paths: HashSet::new(),
|
||||
has_enabled_skills: true,
|
||||
mcp_servers: HashMap::from([(
|
||||
@@ -205,7 +206,7 @@ fn load_plugins_loads_default_skills_and_mcp_servers() {
|
||||
);
|
||||
assert_eq!(
|
||||
outcome.effective_skill_roots(),
|
||||
vec![plugin_root.join("skills")]
|
||||
vec![plugin_root.join("skills").abs()]
|
||||
);
|
||||
assert_eq!(outcome.effective_mcp_servers().len(), 1);
|
||||
assert_eq!(
|
||||
@@ -243,7 +244,9 @@ enabled = false
|
||||
enabled = true
|
||||
"#;
|
||||
let outcome = load_plugins_from_config(config_toml, codex_home.path());
|
||||
let skill_path = dunce::canonicalize(skill_path).expect("skill path should canonicalize");
|
||||
let skill_path = dunce::canonicalize(skill_path)
|
||||
.expect("skill path should canonicalize")
|
||||
.abs();
|
||||
|
||||
assert_eq!(
|
||||
outcome.plugins()[0].disabled_skill_paths,
|
||||
@@ -325,7 +328,7 @@ fn plugin_telemetry_metadata_uses_default_mcp_config_path() {
|
||||
|
||||
let metadata = plugin_telemetry_metadata_from_root(
|
||||
&PluginId::parse("sample@test").expect("plugin id should parse"),
|
||||
&plugin_root,
|
||||
&plugin_root.abs(),
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
@@ -490,8 +493,8 @@ fn load_plugins_uses_manifest_configured_component_paths() {
|
||||
assert_eq!(
|
||||
outcome.plugins()[0].skill_roots,
|
||||
vec![
|
||||
plugin_root.join("custom-skills"),
|
||||
plugin_root.join("skills")
|
||||
plugin_root.join("custom-skills").abs(),
|
||||
plugin_root.join("skills").abs()
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -599,7 +602,7 @@ fn load_plugins_ignores_manifest_component_paths_without_dot_slash() {
|
||||
|
||||
assert_eq!(
|
||||
outcome.plugins()[0].skill_roots,
|
||||
vec![plugin_root.join("skills")]
|
||||
vec![plugin_root.join("skills").abs()]
|
||||
);
|
||||
assert_eq!(
|
||||
outcome.plugins()[0].mcp_servers,
|
||||
@@ -799,7 +802,7 @@ fn capability_index_filters_inactive_and_zero_capability_plugins() {
|
||||
};
|
||||
let outcome = PluginLoadOutcome::from_plugins(vec![
|
||||
LoadedPlugin {
|
||||
skill_roots: vec![codex_home.path().join("skills-plugin/skills")],
|
||||
skill_roots: vec![codex_home.path().join("skills-plugin/skills").abs()],
|
||||
has_enabled_skills: true,
|
||||
..plugin("skills@test", "skills-plugin", "skills-plugin")
|
||||
},
|
||||
@@ -816,7 +819,7 @@ fn capability_index_filters_inactive_and_zero_capability_plugins() {
|
||||
plugin("empty@test", "empty-plugin", "empty-plugin"),
|
||||
LoadedPlugin {
|
||||
enabled: false,
|
||||
skill_roots: vec![codex_home.path().join("disabled-plugin/skills")],
|
||||
skill_roots: vec![codex_home.path().join("disabled-plugin/skills").abs()],
|
||||
apps: vec![connector("connector_hidden")],
|
||||
..plugin("disabled@test", "disabled-plugin", "disabled-plugin")
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user