Skip to content

The agent that grows with you

fix(migration): tell a stamped Camofox home without the plugin where Camofox went

Teknium368fcc6baecc
diff --git a/hermes_cli/left_core_migration.py b/hermes_cli/left_core_migration.py
index ae932611f75..81a03f3b888 100644
--- a/hermes_cli/left_core_migration.py
+++ b/hermes_cli/left_core_migration.py
@@ -555,7 +555,10 @@ def _pending(home: Path, *, say: Callable[[str], None], process_env: bool = Fals
for feature in LEFT_CORE:
if _marked(_read_config(home), _INSTALLED_KEY, feature):
continue
- if not _predates_split(home, feature) or not feature.in_use(home, process_env=process_env):
+ if not feature.in_use(home, process_env=process_env):
+ continue
+ if not _predates_split(home, feature):
+ _say_post_split(home, feature, say=say, backoff=backoff)
continue
present = plugin_present(feature.plugin, home)
try:
@@ -581,6 +584,17 @@ def _pending(home: Path, *, say: Callable[[str], None], process_env: bool = Fals
return out
+def _say_post_split(home: Path, feature: LeftCoreFeature, *, say: Callable[[str], None], backoff: bool) -> None:
+ """*home* uses *feature* while its stamp says it never ran it in core (a newer home, or a Nix-managed
+ config.yaml stamped at activation): nothing is converted or installed, but a home without the plugin is
+ told where the feature went. Starts repeat it on the install backoff (``_note_failure``)."""
+ if plugin_present(feature.plugin, home) or (backoff and _failed_recently(home, feature.plugin)):
+ return
+ _note_failure(home, feature.plugin)
+ say(f" ⚠ {feature.label} moved out of core into the '{feature.plugin}' plugin, which this profile does not "
+ f"have, so it is off. Run `{_install_command(feature.plugin, home)}`.")
+
+
def _install_into(home: Path, *, consent: Optional[bool] = None) -> Callable[[str], dict]:
def _install(name: str) -> dict:
from hermes_cli.plugins_cmd import dashboard_install_plugin
diff --git a/tests/hermes_cli/test_left_core_camofox.py b/tests/hermes_cli/test_left_core_camofox.py
index 3a160c5e58c..8be28194fa1 100644
--- a/tests/hermes_cli/test_left_core_camofox.py
+++ b/tests/hermes_cli/test_left_core_camofox.py
@@ -274,6 +274,23 @@ def test_a_plain_save_stamping_an_unversioned_camofox_home_keeps_its_conversion(
assert _config(home)["platform_toolsets"]["cli"] == ["terminal", "file", "camofox"]
+def test_a_stamped_camofox_home_without_the_plugin_is_told_where_it_went(tmp_path, monkeypatch):
+ """A Nix-managed config.yaml carries the package's stamp (52) from activation, so neither the stamp nor
+ the v52 step shows this home ran core's Camofox. It is told where Camofox went (once per backoff window
+ at start) and nothing about it changes."""
+ monkeypatch.setenv("HERMES_HOME", str(tmp_path / "launch"))
+ home = _home(tmp_path, env=_SPLIT_ENV, config={"_config_version": 52, "platform_toolsets": _SPLIT_TOOLSETS})
+ before = (home / "config.yaml").read_bytes()
+ said = []
+ assert lcm.migrate_home(home, install=lambda name: pytest.fail("nothing is installed"), say=said.append) == []
+ assert len(said) == 1
+ assert "Camofox browser backend moved out of core" in said[0] and "hermes plugins install camofox" in said[0]
+ assert (home / "config.yaml").read_bytes() == before
+
+ assert lcm._pending(home, say=said.append, backoff=True) == []
+ assert len(said) == 1, "a start inside the backoff window repeats nothing"
+
+
def test_catalog_miss_names_the_install_command(tmp_path, _fresh):
(_fresh / "camofox.yaml").unlink()
home = _home(tmp_path, env="CAMOFOX_URL=http://localhost:9377\n", config={"_config_version": 51})