fix(M5): automation-MiniApp-Registrierung — Legacy-Doppelregistrierung entfernt (#363)
Check Cross-Plugin Imports / check (push) Has been cancelled

- on_activate re-registrierte Manifest-MiniApps OHNE component/permission und
  ueberschrieb die korrekte M1-Registrierung aus super().on_activate()
  (live gemessen: automation_status comp=no/perm=- auf Produktion)
- Regressionstest sichert das Entfernen (test_automation_legacy_reregistration_removed)
- Regression: M5 8/8 + lifecycle + registry 26/26
This commit is contained in:
Agent Zero
2026-08-31 00:15:44 +02:00
parent 7ed5349e86
commit cd34bab3a8
2 changed files with 22 additions and 16 deletions
+4 -16
View File
@@ -244,22 +244,10 @@ class AutomationPlugin(BasePlugin):
self._register_workflow_agent_tools()
except Exception:
logger.exception("Failed to register workflow agent tools")
# Register MiniApps from manifest
try:
from app.plugins.builtins.kommunikation.contracts import get_miniapp_registry
registry = get_miniapp_registry()
for miniapp in self.manifest.miniapps:
registry.register(
app_id=miniapp.app_id,
name=miniapp.name,
icon=miniapp.icon,
description=miniapp.description,
plugin_name=self.manifest.name,
render_schema=miniapp.render_schema,
)
logger.info("Registered MiniApp '%s' from manifest", miniapp.app_id)
except Exception:
logger.exception("Failed to register MiniApps from manifest")
# NOTE: Manifest MiniApps are registered by super().on_activate()
# (BasePlugin, Phase M1) WITH all fields (permission, component,
# settings_schema). The legacy re-registration here dropped those
# fields and overwrote the correct entries — removed (M5 fix).
# Register own cron jobs from manifest
try:
await self.register_plugin_contributions(db, self.manifest.name, self.manifest)
+18
View File
@@ -84,3 +84,21 @@ class TestPluginMiniAppContributions:
assert any(f["name"] == "max_items" for f in fields), (
f"{app_id}: max_items missing in settings_schema"
)
def test_automation_legacy_reregistration_removed():
"""M5 fix: automation's on_activate used to re-register manifest
miniapps with only a subset of fields AFTER super().on_activate(),
overwriting the correct M1 registration (component/permission lost —
measured live on production 2026-08-30: automation_status comp=no).
The legacy block must stay removed; super() owns the registration.
"""
import inspect
from app.plugins.builtins.automation.plugin import AutomationPlugin
src = inspect.getsource(AutomationPlugin.on_activate)
assert "for miniapp in self.manifest.miniapps" not in src, (
"legacy miniapp re-registration re-introduced"
)
assert "kommunikation.contracts import get_miniapp_registry" not in src