mirror of
https://github.com/openai/codex.git
synced 2026-11-18 23:02:23 +00:00
Expose plugin installation interstitial requirements (#33896)
## What changed - Add nullable `mustShowInstallationInterstitial` metadata to app-server `PluginSummary` responses. - Preserve the remote service value through catalog, installed-plugin cache, list, read, and share-list paths. - Return `null` for local plugins and remote responses that omit the field so clients can fail closed when the policy is unavailable. ## Testing - Cover `true`, `false`, and missing values across remote summary paths and app-server plugin endpoints. GitOrigin-RevId: db79702ee2bfa800a9910d64d933bcabecb3ce70
This commit is contained in:
1 parent
7bd44085e1
commit
bc5c9161b4
20 files changed
+161
-3
No files matched your search
@@ -81,6 +81,64 @@ fn installation_policy_source_is_preserved_across_remote_summary_paths() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn installation_interstitial_requirement_is_preserved_across_remote_summary_paths() {
|
||||
let mut directory_plugin = directory_plugin("plugin-linear", "linear");
|
||||
directory_plugin.must_show_installation_interstitial = Some(true);
|
||||
let marketplace = build_remote_marketplace(
|
||||
REMOTE_GLOBAL_MARKETPLACE_NAME,
|
||||
REMOTE_GLOBAL_MARKETPLACE_DISPLAY_NAME,
|
||||
vec![directory_plugin.clone()],
|
||||
Vec::new(),
|
||||
/*include_installed_only*/ false,
|
||||
)
|
||||
.expect("marketplace should be valid")
|
||||
.expect("marketplace should not be empty");
|
||||
assert_eq!(
|
||||
marketplace
|
||||
.plugins
|
||||
.into_iter()
|
||||
.map(|plugin| plugin.must_show_installation_interstitial)
|
||||
.collect::<Vec<_>>(),
|
||||
vec![Some(true)]
|
||||
);
|
||||
|
||||
directory_plugin.must_show_installation_interstitial = Some(false);
|
||||
let installed_plugin = remote_installed_plugin_to_cache_entry(&RemotePluginInstalledItem {
|
||||
plugin: directory_plugin,
|
||||
enabled: true,
|
||||
disabled_skill_names: Vec::new(),
|
||||
})
|
||||
.expect("installed plugin should be valid");
|
||||
let marketplaces = group_remote_installed_plugins_by_marketplaces(
|
||||
&[installed_plugin],
|
||||
&[REMOTE_GLOBAL_MARKETPLACE_NAME],
|
||||
);
|
||||
assert_eq!(
|
||||
marketplaces
|
||||
.into_iter()
|
||||
.flat_map(|marketplace| marketplace.plugins)
|
||||
.map(|plugin| plugin.must_show_installation_interstitial)
|
||||
.collect::<Vec<_>>(),
|
||||
vec![Some(false)]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_installation_interstitial_requirement_deserializes_to_none() {
|
||||
let plugin = directory_plugin("plugin-linear", "linear");
|
||||
let mut plugin_json = serde_json::to_value(plugin).expect("plugin should serialize");
|
||||
plugin_json
|
||||
.as_object_mut()
|
||||
.expect("plugin should serialize to an object")
|
||||
.remove("must_show_installation_interstitial");
|
||||
|
||||
let plugin: RemotePluginDirectoryItem =
|
||||
serde_json::from_value(plugin_json).expect("missing requirement should deserialize");
|
||||
|
||||
assert_eq!(plugin.must_show_installation_interstitial, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unknown_installation_policy_source_maps_to_none() {
|
||||
let plugin = directory_plugin("plugin-linear", "linear");
|
||||
@@ -126,6 +184,7 @@ fn directory_plugin(id: &str, name: &str) -> RemotePluginDirectoryItem {
|
||||
share_principals: None,
|
||||
installation_policy: PluginInstallPolicy::Available,
|
||||
installation_policy_source: None,
|
||||
must_show_installation_interstitial: None,
|
||||
authentication_policy: PluginAuthPolicy::OnUse,
|
||||
availability: PluginAvailability::Available,
|
||||
release: RemotePluginReleaseResponse {
|
||||
|
||||
Reference in new issue
Block a user