align plugin storage deps naming

This commit is contained in:
starr-openai
2026-06-03 10:54:33 -07:00
parent 15efda4129
commit 1b9ef15a1c
3 changed files with 23 additions and 12 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ pub use manager::PluginRemoteSyncError;
pub use manager::PluginUninstallError;
pub use manager::PluginsConfigInput;
pub use manager::PluginsManager;
pub use manager::PluginsManagerDeps;
pub use manager::PluginsManagerStorageDeps;
pub use manager::RemotePluginSyncResult;
pub use marketplace_upgrade::ConfiguredMarketplaceUpgradeError as PluginMarketplaceUpgradeError;
pub use marketplace_upgrade::ConfiguredMarketplaceUpgradeOutcome as PluginMarketplaceUpgradeOutcome;
+20 -9
View File
@@ -414,11 +414,11 @@ pub struct PluginsManager {
/// Dependencies owned by one plugins manager.
#[derive(Clone)]
pub struct PluginsManagerDeps {
pub struct PluginsManagerStorageDeps {
data_store: Arc<dyn PluginDataStore>,
}
impl PluginsManagerDeps {
impl PluginsManagerStorageDeps {
/// Creates dependencies backed by the local Codex Home layout.
pub fn from_codex_home(codex_home: PathBuf) -> Result<Self, PluginStoreError> {
Ok(Self::new(Arc::new(LocalPluginDataStore::from_codex_home(
@@ -444,23 +444,34 @@ impl PluginsManager {
}
/// Creates a plugins manager with injected dependencies.
pub fn new_with_deps(codex_home: PathBuf, deps: PluginsManagerDeps) -> Self {
Self::new_with_restriction_product_and_deps(codex_home, Some(Product::Codex), deps)
pub fn new_with_storage_deps(
codex_home: PathBuf,
storage_deps: PluginsManagerStorageDeps,
) -> Self {
Self::new_with_restriction_product_and_storage_deps(
codex_home,
Some(Product::Codex),
storage_deps,
)
}
pub fn new_with_restriction_product(
codex_home: PathBuf,
restriction_product: Option<Product>,
) -> Self {
let deps = PluginsManagerDeps::from_codex_home(codex_home.clone())
let storage_deps = PluginsManagerStorageDeps::from_codex_home(codex_home.clone())
.unwrap_or_else(|err| panic!("plugin data root should be absolute: {err}"));
Self::new_with_restriction_product_and_deps(codex_home, restriction_product, deps)
Self::new_with_restriction_product_and_storage_deps(
codex_home,
restriction_product,
storage_deps,
)
}
fn new_with_restriction_product_and_deps(
fn new_with_restriction_product_and_storage_deps(
codex_home: PathBuf,
restriction_product: Option<Product>,
deps: PluginsManagerDeps,
storage_deps: PluginsManagerStorageDeps,
) -> Self {
// Product restrictions are enforced at marketplace admission time for a given CODEX_HOME:
// listing, install, and curated refresh all consult this restriction context before new
@@ -472,7 +483,7 @@ impl PluginsManager {
Self {
codex_home: codex_home.clone(),
store: PluginStore::new(codex_home),
data_store: deps.data_store,
data_store: storage_deps.data_store,
featured_plugin_ids_cache: RwLock::new(None),
configured_marketplace_upgrade_state: RwLock::new(
ConfiguredMarketplaceUpgradeState::default(),
+2 -2
View File
@@ -3915,9 +3915,9 @@ async fn plugins_for_layer_stack_uses_injected_plugin_data_store() {
/*remote_plugin_enabled*/ false,
"https://chatgpt.com/backend-api/".to_string(),
);
let outcome = PluginsManager::new_with_deps(
let outcome = PluginsManager::new_with_storage_deps(
codex_home.path().to_path_buf(),
PluginsManagerDeps::new(Arc::new(FakePluginDataStore {
PluginsManagerStorageDeps::new(Arc::new(FakePluginDataStore {
root: data_root.clone(),
})),
)