fix(plugins): the kept-off notice names the plugins.disabled spelling it found

An unattended install's enable vetoes every alias of the plugin, a core-era key included
(platforms/weixin, weixin-platform, platforms/yuanbao), but kept_off_sentence always said
"plugins.disabled lists '<catalog name>'", which a home that disabled the old key does not hold.
It now quotes the entry the list actually holds; `hermes plugins enable <name>` still purges every alias.
Seen live on the Weixin disabled-legacy-name home (r18 leg D).
This commit is contained in:
Teknium
2026-11-27 12:38:28 -08:00
parent 606f338aea
commit cefa573b24
2 changed files with 9 additions and 3 deletions

View File

@@ -234,9 +234,14 @@ def _profile_command(command: str, home: Path) -> str:
def kept_off_sentence(name: str, home: Path) -> str:
"""Why an automatic install left *name* off in *home* (its ``plugins.disabled`` named it when the
enable ran, :func:`_install_into`), and the command that turns it on."""
enable ran, :func:`_install_into`), and the command that turns it on. Names the spelling the list holds:
the enable vetoes every alias, a core-era key (``platforms/weixin``) included, which the enable purges."""
from hermes_cli.plugins_cmd import _plugin_aliases
from pm.plugins_state import read_home_selection
disabled = ((read_home_selection(home) or {}).get("plugins") or {}).get("disabled") or ()
listed = next((str(n) for n in disabled if str(n) in _plugin_aliases(name, entries=[])), name)
enable = _install_command(name, home).replace(" plugins install ", " plugins enable ")
return f"plugins.disabled lists '{name}', so it is installed but off: run `{enable}` to turn it on."
return f"plugins.disabled lists '{listed}', so it is installed but off: run `{enable}` to turn it on."
def _install_pending(home: Path, name: str, *, install: Callable[[str], dict],

View File

@@ -176,4 +176,5 @@ def test_a_core_era_disable_keeps_weixin_off_through_both_installers(tmp_path, p
plugins = (yaml.safe_load((home / "config.yaml").read_text(encoding="utf-8")) or {}).get("plugins") or {}
assert plugins.get("disabled") == [name], f"the core-era disable was lifted: {plugins}"
assert "weixin" not in (plugins.get("enabled") or []), plugins
assert any("installed but off" in line and "plugins enable weixin`" in line for line in said), said
assert any(f"plugins.disabled lists '{name}', so it is installed but off" in line
and "plugins enable weixin`" in line for line in said), said