fix(M5): automation-MiniApp-Registrierung — Legacy-Doppelregistrierung entfernt (#363)
Check Cross-Plugin Imports / check (push) Has been cancelled
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:
@@ -244,22 +244,10 @@ class AutomationPlugin(BasePlugin):
|
|||||||
self._register_workflow_agent_tools()
|
self._register_workflow_agent_tools()
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("Failed to register workflow agent tools")
|
logger.exception("Failed to register workflow agent tools")
|
||||||
# Register MiniApps from manifest
|
# NOTE: Manifest MiniApps are registered by super().on_activate()
|
||||||
try:
|
# (BasePlugin, Phase M1) WITH all fields (permission, component,
|
||||||
from app.plugins.builtins.kommunikation.contracts import get_miniapp_registry
|
# settings_schema). The legacy re-registration here dropped those
|
||||||
registry = get_miniapp_registry()
|
# fields and overwrote the correct entries — removed (M5 fix).
|
||||||
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")
|
|
||||||
# Register own cron jobs from manifest
|
# Register own cron jobs from manifest
|
||||||
try:
|
try:
|
||||||
await self.register_plugin_contributions(db, self.manifest.name, self.manifest)
|
await self.register_plugin_contributions(db, self.manifest.name, self.manifest)
|
||||||
|
|||||||
@@ -84,3 +84,21 @@ class TestPluginMiniAppContributions:
|
|||||||
assert any(f["name"] == "max_items" for f in fields), (
|
assert any(f["name"] == "max_items" for f in fields), (
|
||||||
f"{app_id}: max_items missing in settings_schema"
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user