Upgrade Git marketplaces from merged configuration (#42149)

## Why

Configured Git marketplaces may be defined outside the user config, but those definitions could not download or update their snapshots.

## What changed

- Select marketplace source, ref, and sparse-path settings from the effective merged configuration for startup synchronization and explicit upgrades.
- Preserve the initiating operation's configuration loader and overrides when reloading before activation.
- Roll back activation if the marketplace definition changed or configuration can no longer be loaded, without copying settings into the user config.

## Testing

- Cover system-defined marketplaces, CLI overrides, startup fallback after invalid user configuration, and rollback after configuration changes.

GitOrigin-RevId: 53d1eecf68a91ce2aa8430e5749d78697bfcd821
This commit is contained in:
willwang-openai authored and copyberry committed 2026-09-01 22:37:26 +00:00
1 parent e576993911
commit 68c9556cdf
17 files changed
+387 -82

No files matched your search

+8 -2
View File
@@ -5313,8 +5313,14 @@ source = "{remote_repo_url}"
let manager = test_plugins_manager(tmp.path().to_path_buf());
let config = load_config(tmp.path(), tmp.path()).await;
let reload_stack = config.config_layer_stack.clone();
let reload_config: ConfigLayerReload = Arc::new(move || Ok(reload_stack.clone()));
let initial_upgrade = manager
.upgrade_configured_marketplaces_for_config(&config, /*marketplace_name*/ None)
.upgrade_configured_marketplaces_for_config(
&config,
/*marketplace_name*/ None,
&reload_config,
)
.expect("initial marketplace install should succeed");
assert_eq!(initial_upgrade.errors, Vec::new());
assert_eq!(initial_upgrade.upgraded_roots.len(), 1);
@@ -5350,7 +5356,7 @@ source = "{remote_repo_url}"
run_git(&remote_repo, &["add", "."]);
run_git(&remote_repo, &["commit", "-m", "update plugin"]);
let upgrade = manager
.upgrade_configured_marketplaces_for_config(&config, Some("debug"))
.upgrade_configured_marketplaces_for_config(&config, Some("debug"), &reload_config)
.expect("marketplace upgrade should succeed");
assert_eq!(upgrade.errors, Vec::new());
assert_eq!(upgrade.upgraded_roots.len(), 1);