Files
codex/codex-rs/core-plugin-common/src/plugin_id_tests.rs
T
Anthony Tafoya ab7439231c Add executor capability discovery V2 infrastructure (#47683)
## What changed

- Define `capabilities/discoverV2` request and inventory types and advertise `capabilityDiscoveryV2` in executor metadata.
- Prewarm installed plugin and global skill locations at server startup, with nonfatal scan failures.
- Add sandbox-scoped discovery caching with file watcher invalidation and request-time reloads when watching is unavailable.
- Batch metadata reads through the filesystem sandbox helper and bound discovery responses to 4 MiB and 2,048 capabilities.
- Share plugin identity and installed-version selection in `codex-core-plugin-common`, and fall back to `.app.json` when a plugin does not declare an apps configuration.

The V2 discovery manager is not yet wired into RPC request dispatch.

## Testing

Add coverage for inventory metadata, sandbox cache isolation, watcher invalidation, startup scan failures, response limits, and compatibility with older executor metadata.

GitOrigin-RevId: a223a5bc15fdf251023c0c71f468fd92c3b2d847
2026-09-23 22:20:34 +00:00

35 lines
1.1 KiB
Rust

use super::PluginId;
#[test]
fn accepts_dotted_plugin_names() {
let plugin_id =
PluginId::new("acme.tools".to_string(), "marketplace".to_string()).expect("plugin id");
assert_eq!(plugin_id.as_key(), "acme.tools@marketplace");
}
#[test]
fn marketplace_names_preserve_legacy_character_set() {
PluginId::new("acme".to_string(), "marketplace_name-1".to_string()).expect("marketplace name");
let err = PluginId::new("acme".to_string(), "market.place".to_string())
.expect_err("dotted marketplace name");
assert_eq!(
err.to_string(),
"invalid marketplace name: only ASCII letters, digits, `_`, and `-` are allowed"
);
}
#[test]
fn rejects_dot_path_segments() {
assert!(PluginId::new(".".to_string(), "marketplace".to_string()).is_err());
assert!(PluginId::new("plugin".to_string(), "..".to_string()).is_err());
}
#[test]
fn rejects_dots_that_can_alias_path_segments() {
for plugin_name in [".plugin", "plugin.", "plugin..name"] {
assert!(PluginId::new(plugin_name.to_string(), "marketplace".to_string()).is_err());
}
}