Use AbsolutePathBuf in skill loading and codex_home (#17407)

Helps with FS migration later
This commit is contained in:
pakrym-oai authored and GitHub committed 2026-04-13 10:26:51 -07:00
1 parent d25a9822a7
commit ac82443d07
86 files changed
+850 -625

No files matched your search

@@ -4008,6 +4008,8 @@ impl ChatComposer {
#[cfg(test)]
mod tests {
use super::*;
use crate::test_support::PathBufExt;
use crate::test_support::test_path_buf;
use image::ImageBuffer;
use image::Rgba;
use pretty_assertions::assert_eq;
@@ -5053,6 +5055,7 @@ mod tests {
#[test]
fn mention_items_show_plugin_owned_skill_and_app_duplicates() {
let skill_path = test_path_buf("/tmp/repo/google-calendar/SKILL.md").abs();
let (tx, _rx) = unbounded_channel::<AppEvent>();
let sender = AppEventSender::new(tx);
let mut composer = ChatComposer::new(
@@ -5078,7 +5081,7 @@ mod tests {
}),
dependencies: None,
policy: None,
path_to_skills_md: PathBuf::from("/tmp/repo/google-calendar/SKILL.md"),
path_to_skills_md: skill_path.clone(),
scope: codex_protocol::protocol::SkillScope::Repo,
}]));
composer.set_plugin_mentions(Some(vec![PluginCapabilitySummary {
@@ -5115,10 +5118,7 @@ mod tests {
let mentions = composer.mention_items();
assert_eq!(mentions.len(), 3);
assert_eq!(mentions[0].category_tag, Some("[Skill]".to_string()));
assert_eq!(
mentions[0].path,
Some("/tmp/repo/google-calendar/SKILL.md".to_string())
);
assert_eq!(mentions[0].path, Some(skill_path.display().to_string()));
assert_eq!(mentions[0].display_name, "Google Calendar".to_string());
assert_eq!(mentions[1].category_tag, Some("[Plugin]".to_string()));
assert_eq!(
@@ -5176,7 +5176,7 @@ mod tests {
}),
dependencies: None,
policy: None,
path_to_skills_md: PathBuf::from("/tmp/repo/google-calendar/SKILL.md"),
path_to_skills_md: test_path_buf("/tmp/repo/google-calendar/SKILL.md").abs(),
scope: codex_protocol::protocol::SkillScope::Repo,
}]));
composer.set_plugin_mentions(Some(vec![PluginCapabilitySummary {
+3 -2
View File
@@ -1242,6 +1242,8 @@ mod tests {
use crate::app_event::AppEvent;
use crate::status_indicator_widget::STATUS_DETAILS_DEFAULT_MAX_LINES;
use crate::status_indicator_widget::StatusDetailsCapitalization;
use crate::test_support::PathBufExt;
use crate::test_support::test_path_buf;
use codex_protocol::protocol::Op;
use codex_protocol::protocol::SkillScope;
use crossterm::event::KeyEventKind;
@@ -1250,7 +1252,6 @@ mod tests {
use ratatui::buffer::Buffer;
use ratatui::layout::Rect;
use std::cell::Cell;
use std::path::PathBuf;
use std::rc::Rc;
use tokio::sync::mpsc::unbounded_channel;
@@ -1719,7 +1720,7 @@ mod tests {
interface: None,
dependencies: None,
policy: None,
path_to_skills_md: PathBuf::from("test-skill"),
path_to_skills_md: test_path_buf("/tmp/test-skill/SKILL.md").abs(),
scope: SkillScope::User,
}]),
});
@@ -1,5 +1,4 @@
use std::path::PathBuf;
use codex_utils_absolute_path::AbsolutePathBuf;
use crossterm::event::KeyCode;
use crossterm::event::KeyEvent;
use crossterm::event::KeyModifiers;
@@ -38,7 +37,7 @@ pub(crate) struct SkillsToggleItem {
pub skill_name: String,
pub description: String,
pub enabled: bool,
pub path: PathBuf,
pub path: AbsolutePathBuf,
}
pub(crate) struct SkillsToggleView {
@@ -381,6 +380,8 @@ fn skills_toggle_hint_line() -> Line<'static> {
mod tests {
use super::*;
use crate::app_event::AppEvent;
use crate::test_support::PathBufExt;
use crate::test_support::test_path_buf;
use insta::assert_snapshot;
use ratatui::layout::Rect;
use tokio::sync::mpsc::unbounded_channel;
@@ -418,14 +419,14 @@ mod tests {
skill_name: "repo_scout".to_string(),
description: "Summarize the repo layout".to_string(),
enabled: true,
path: PathBuf::from("/tmp/skills/repo_scout.toml"),
path: test_path_buf("/tmp/skills/repo_scout.toml").abs(),
},
SkillsToggleItem {
name: "Changelog Writer".to_string(),
skill_name: "changelog_writer".to_string(),
description: "Draft release notes".to_string(),
enabled: false,
path: PathBuf::from("/tmp/skills/changelog_writer.toml"),
path: test_path_buf("/tmp/skills/changelog_writer.toml").abs(),
},
];
let view = SkillsToggleView::new(items, tx);