mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
TUI Plugin Sharing 4 - cover remote plugin catalog flows (#26704)
Remote plugin catalogs now span workspace, shared, and local sources, so their TUI behavior needs focused regression coverage across loading, navigation, actions, and refreshes. This PR: - Covers product labels and rendered loading/error states for Workspace, Shared with me, Shared with me (link), and Local tabs, including tab persistence across refresh and detail navigation. - Covers remote/local deduplication, Installed-tab remote detail routing, marketplace load-error handling, and disabled install/uninstall navigation. - Adds a full detail snapshot for local shared-plugin metadata plus focused snapshots for marketplace labels and admin-disabled status. - Verifies shared plugins remain eligible for mentions and successful uninstalls trigger a catalog refresh.
This commit is contained in:
1 parent
97dc6abb11
commit
fbd575ab4a
13 files changed
+643
-82
No files matched your search
@@ -90,12 +90,15 @@ mod tests {
|
||||
use codex_app_server_protocol::PluginInstallPolicy;
|
||||
use codex_app_server_protocol::PluginListResponse;
|
||||
use codex_app_server_protocol::PluginMarketplaceEntry;
|
||||
use codex_app_server_protocol::PluginShareContext;
|
||||
use codex_app_server_protocol::PluginShareDiscoverability;
|
||||
use codex_app_server_protocol::PluginSource;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn plugin_mentions_use_plugin_list_summaries_and_gui_eligibility() {
|
||||
let active = plugin_summary("active");
|
||||
let active_shared = shared_plugin_summary("active-shared");
|
||||
let mut disabled_by_admin = plugin_summary("disabled-by-admin");
|
||||
disabled_by_admin.availability = PluginAvailability::DisabledByAdmin;
|
||||
let mut disabled = plugin_summary("disabled");
|
||||
@@ -108,7 +111,13 @@ mod tests {
|
||||
name: "server-marketplace".to_string(),
|
||||
path: None,
|
||||
interface: None,
|
||||
plugins: vec![active, disabled_by_admin, disabled, uninstalled],
|
||||
plugins: vec![
|
||||
active,
|
||||
active_shared,
|
||||
disabled_by_admin,
|
||||
disabled,
|
||||
uninstalled,
|
||||
],
|
||||
}],
|
||||
marketplace_load_errors: Vec::new(),
|
||||
featured_plugin_ids: Vec::new(),
|
||||
@@ -116,17 +125,42 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
plugin_mentions_from_list_response(response),
|
||||
vec![PluginCapabilitySummary {
|
||||
config_name: "active@server-marketplace".to_string(),
|
||||
display_name: "active".to_string(),
|
||||
description: Some("server-marketplace".to_string()),
|
||||
has_skills: false,
|
||||
mcp_server_names: Vec::new(),
|
||||
app_connector_ids: Vec::new(),
|
||||
}]
|
||||
vec![
|
||||
PluginCapabilitySummary {
|
||||
config_name: "active@server-marketplace".to_string(),
|
||||
display_name: "active".to_string(),
|
||||
description: Some("server-marketplace".to_string()),
|
||||
has_skills: false,
|
||||
mcp_server_names: Vec::new(),
|
||||
app_connector_ids: Vec::new(),
|
||||
},
|
||||
PluginCapabilitySummary {
|
||||
config_name: "active-shared@server-marketplace".to_string(),
|
||||
display_name: "active-shared".to_string(),
|
||||
description: Some("server-marketplace".to_string()),
|
||||
has_skills: false,
|
||||
mcp_server_names: Vec::new(),
|
||||
app_connector_ids: Vec::new(),
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
fn shared_plugin_summary(name: &str) -> PluginSummary {
|
||||
PluginSummary {
|
||||
share_context: Some(PluginShareContext {
|
||||
remote_plugin_id: format!("plugins~{name}"),
|
||||
remote_version: Some("7".to_string()),
|
||||
discoverability: Some(PluginShareDiscoverability::Private),
|
||||
share_url: Some(format!("https://chatgpt.com/codex/plugins/share/{name}")),
|
||||
creator_account_user_id: None,
|
||||
creator_name: Some("Test User".to_string()),
|
||||
share_principals: None,
|
||||
}),
|
||||
..plugin_summary(name)
|
||||
}
|
||||
}
|
||||
|
||||
fn plugin_summary(name: &str) -> PluginSummary {
|
||||
PluginSummary {
|
||||
id: format!("{name}@server-marketplace"),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//! App-level orchestration tests for the TUI.
|
||||
|
||||
mod model_catalog;
|
||||
mod plugin_catalog;
|
||||
mod session_summary;
|
||||
mod startup;
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use codex_app_server_protocol::PluginUninstallResponse;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
||||
async fn successful_plugin_uninstall_dispatches_plugin_list_refresh() -> Result<()> {
|
||||
let (mut app, mut app_event_rx, _op_rx) = make_test_app_with_channels().await;
|
||||
let cwd = app.chat_widget.config_ref().cwd.to_path_buf();
|
||||
while app_event_rx.try_recv().is_ok() {}
|
||||
|
||||
let mut tui = crate::tui::test_support::make_test_tui()?;
|
||||
let mut app_server = Box::pin(crate::start_embedded_app_server_for_picker(
|
||||
app.chat_widget.config_ref(),
|
||||
))
|
||||
.await?;
|
||||
let control = Box::pin(app.handle_event(
|
||||
&mut tui,
|
||||
&mut app_server,
|
||||
AppEvent::PluginUninstallLoaded {
|
||||
cwd: cwd.clone(),
|
||||
plugin_id: "plugin-docs".to_string(),
|
||||
plugin_display_name: "Docs".to_string(),
|
||||
result: Ok(PluginUninstallResponse {}),
|
||||
},
|
||||
))
|
||||
.await?;
|
||||
assert!(matches!(control, AppRunControl::Continue));
|
||||
|
||||
let refresh_result = tokio::time::timeout(Duration::from_secs(5), async {
|
||||
loop {
|
||||
match app_event_rx.recv().await {
|
||||
Some(AppEvent::PluginsLoaded {
|
||||
cwd: event_cwd,
|
||||
result,
|
||||
}) if event_cwd == cwd => break result,
|
||||
Some(_) => {}
|
||||
None => panic!("app event channel closed before plugin refresh completed"),
|
||||
}
|
||||
}
|
||||
})
|
||||
.await
|
||||
.expect("dispatcher should initiate a plugin list refresh");
|
||||
refresh_result.expect("plugin list refresh should succeed");
|
||||
|
||||
app_server.shutdown().await?;
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user