Marketplace: derive the plugin slug from the id only (final review M4)
The slug (plugin marketplace "triple-c-<slug>", plugin tree
"plugins/<slug>/") was built from the editable display name. After a
rename the next sync registered the new marketplace, skipped the plugin
install because the state's commit matched, then removed the old
marketplace: the plugin was gone while the report said nothing changed.
marketplace_slug now takes the id only ("mp-<id8>"). With plugin state
kept per slug (I1), containers synced with the old "<name>-<id8>" slugs
move over on their next sync: plugins are installed under the new name,
the old copies uninstalled and the old registration dropped. A sync
script test covers that migration (it fails on the pre-I1 script).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1024,3 +1024,36 @@ fn a_deselected_legacy_plugin_record_is_still_uninstalled() {
|
||||
);
|
||||
assert_eq!(read_json(&state_path)["items"], json!({}));
|
||||
}
|
||||
|
||||
/// Final review M4: slugs moved from "<name>-<id8>" to "mp-<id8>". The first
|
||||
/// sync after that installs under the new name, uninstalls the old copy and
|
||||
/// drops the old registration; later syncs are quiet.
|
||||
#[test]
|
||||
fn a_slug_change_reinstalls_under_the_new_name_and_retires_the_old() {
|
||||
let Some(env) = env() else { return };
|
||||
shared_plugin_payload(&env, &[(SLUG, C1)]);
|
||||
assert_eq!(run(&env).installed, vec!["plugin:p"]);
|
||||
|
||||
fs::remove_file(&env.log).unwrap();
|
||||
shared_plugin_payload(&env, &[(SLUG_A, C1)]);
|
||||
let r = run(&env);
|
||||
assert_eq!(r.installed, vec!["plugin:p"], "{r:?}");
|
||||
assert_eq!(r.removed, vec!["plugin:p"], "{r:?}");
|
||||
assert!(r.errors.is_empty(), "{r:?}");
|
||||
let tree = env.home.join(".claude/triple-c/plugins");
|
||||
assert_eq!(
|
||||
claude_log(&env),
|
||||
vec![
|
||||
format!("plugin marketplace add {}", tree.join(SLUG_A).display()),
|
||||
format!("plugin install p@triple-c-{SLUG_A}"),
|
||||
format!("plugin uninstall p@triple-c-{SLUG}"),
|
||||
format!("plugin marketplace remove triple-c-{SLUG}"),
|
||||
]
|
||||
);
|
||||
assert!(!tree.join(SLUG).exists());
|
||||
|
||||
fs::remove_file(&env.log).unwrap();
|
||||
shared_plugin_payload(&env, &[(SLUG_A, C1)]);
|
||||
let r = run(&env);
|
||||
assert!(nothing_reported(&r), "{r:?}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user