Unique marketplace name change

This commit is contained in:
canvrno-oai
2026-04-14 15:15:55 -07:00
parent 3872873f9f
commit 445547f80a
2 changed files with 61 additions and 1 deletions

View File

@@ -1127,7 +1127,7 @@ fn sort_plugin_entries(entries: &mut [(&PluginMarketplaceEntry, &PluginSummary,
}
fn marketplace_tab_id(marketplace: &PluginMarketplaceEntry) -> String {
format!("marketplace:{}", marketplace.name)
format!("marketplace:{}", marketplace.path.display())
}
fn disambiguate_duplicate_tab_labels(labels: Vec<String>) -> Vec<String> {

View File

@@ -535,6 +535,66 @@ async fn plugins_popup_openai_curated_tab_omits_marketplace_in_rows() {
);
}
#[tokio::test]
async fn plugins_popup_refresh_preserves_duplicate_marketplace_tab_by_path() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
chat.set_feature_enabled(Feature::Plugins, /*enabled*/ true);
let response = plugins_test_response(vec![
PluginMarketplaceEntry {
name: "duplicate".to_string(),
path: plugins_test_absolute_path("marketplaces/home/marketplace.json"),
interface: Some(MarketplaceInterface {
display_name: Some("Duplicate Marketplace".to_string()),
}),
plugins: vec![plugins_test_summary(
"plugin-home",
"home",
Some("Home Plugin"),
Some("Home marketplace plugin."),
/*installed*/ false,
/*enabled*/ true,
PluginInstallPolicy::Available,
)],
},
PluginMarketplaceEntry {
name: "duplicate".to_string(),
path: plugins_test_absolute_path("marketplaces/repo/marketplace.json"),
interface: Some(MarketplaceInterface {
display_name: Some("Duplicate Marketplace".to_string()),
}),
plugins: vec![plugins_test_summary(
"plugin-repo",
"repo",
Some("Repo Plugin"),
Some("Repo marketplace plugin."),
/*installed*/ false,
/*enabled*/ true,
PluginInstallPolicy::Available,
)],
},
]);
let cwd = chat.config.cwd.to_path_buf();
chat.on_plugins_loaded(cwd.clone(), Ok(response.clone()));
chat.add_plugins_output();
for _ in 0..4 {
chat.handle_key_event(KeyEvent::from(KeyCode::Right));
}
chat.on_plugins_loaded(cwd, Ok(response));
let popup = render_bottom_popup(&chat, /*width*/ 100);
assert!(
popup.contains("Duplicate Marketplace (2/2)."),
"expected refresh to preserve the second duplicate marketplace tab, got:\n{popup}"
);
assert!(
popup.contains("Repo Plugin") && !popup.contains("Home Plugin"),
"expected second duplicate marketplace rows after refresh, got:\n{popup}"
);
}
#[tokio::test]
async fn plugins_popup_search_no_matches_and_backspace_restores_results() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;