fix(cli): add missing ar locale + pin the toggle's unchanged contract

Review follow-up: ar.ts was the one locale of 17 missing
toggleTakesEffectAfterRestart (silent English fallback); add the Arabic
string. Pin dashboard_set_agent_plugin_enabled's contract — every ok
return carries an explicit `unchanged` boolean — with a parametrized
test over all four toggle paths, and document at the endpoint that a
missing key errs toward prompting a restart.
This commit is contained in:
chris-young
2026-08-18 08:53:56 -07:00
committed by Teknium
parent 2dc4451458
commit c032ee2726
2 changed files with 38 additions and 0 deletions

View File

@@ -90,3 +90,39 @@ def test_failed_toggle_has_no_restart_field(loopback_client, monkeypatch):
)
resp = loopback_client.post("/api/dashboard/agent-plugins/nope/disable")
assert resp.status_code == 400
@pytest.mark.parametrize(
("enabled_now", "toggle_to", "expect_unchanged"),
[
(True, True, True), # already enabled → no-op
(False, True, False), # actually enables
(False, False, True), # already disabled → no-op
(True, False, False), # actually disables
],
)
def test_real_toggle_always_reports_unchanged(
monkeypatch, enabled_now, toggle_to, expect_unchanged
):
"""Pin the ``unchanged`` contract of the REAL toggle the endpoint's
``restart_required`` derivation depends on: every ``ok: True`` return
carries an explicit ``unchanged`` boolean. If a future refactor drops the
key on some path, the endpoint would misreport a no-op as
"restart required" — this test fails first."""
name = "web/exa"
en = {name} if enabled_now else set()
dis = set() if enabled_now else {name}
monkeypatch.setattr(plugins_cmd, "_resolve_plugin_key", lambda _n: _n)
monkeypatch.setattr(plugins_cmd, "_get_enabled_set", lambda: set(en))
monkeypatch.setattr(plugins_cmd, "_get_disabled_set", lambda: set(dis))
monkeypatch.setattr(plugins_cmd, "_set_plugin_enabled", lambda _n, enable: None)
monkeypatch.setattr(
plugins_cmd, "_toggle_plugin_toolset", lambda _n, enable: None
)
result = plugins_cmd.dashboard_set_agent_plugin_enabled(
name, enabled=toggle_to
)
assert result["ok"] is True
assert result["unchanged"] is expect_unchanged

View File

@@ -269,6 +269,8 @@ export const ar = defineLocale({
disableRuntime: "تعطيل",
enableAfterInstall: "تفعيل بعد التثبيت",
enableRuntime: "تفعيل",
toggleTakesEffectAfterRestart:
"تم الحفظ — أعد تشغيل البوابة لتطبيق التغيير.",
forceReinstall: "إعادة تثبيت إجباري (حذف المجلد الموجود أولاً)",
headline:
"اكتشف وثبِّت وفعِّل وحدِّث مكوِّنات Hermes الإضافية (مطابقة `hermes plugins`).",