fix(cleanup): resolve 9 low-priority issues (P34-P42)
Check Cross-Plugin Imports / check (push) Has been cancelled

P34: Remove test_sample plugin from production code
P35: Remove CompanyContact=None dead code from contact.py
P36: Change Plugin.config from Text to JSONB (model + migration 0117 + service)
P37: Add AI comment about workspace overengineering in workspace.py
P38: Add container resource limits to docker-compose.yaml
P39: Guest TTL 1800 not found — already migrated to regular users
P40: Add AI comment about missing IP/Device binding in session.py
P41: Fix Redis healthcheck to use auth password
P42: RLS migration history comment already present in alembic/env.py
This commit is contained in:
Agent Zero
2026-08-06 13:43:47 +02:00
parent 0eb6d7621e
commit 20288da567
10 changed files with 63 additions and 119 deletions
@@ -1,56 +0,0 @@
"""Test sample plugin for LeoCRM plugin system testing."""
from __future__ import annotations
from typing import Any
from app.plugins.base import BasePlugin
from app.plugins.manifest import PluginManifest
class TestSamplePlugin(BasePlugin):
"""A sample plugin for testing the plugin lifecycle."""
__test__ = False
manifest = PluginManifest(
name="test_sample",
version="1.0.0",
display_name="Test Sample Plugin",
description="A sample plugin for testing install/activate/deactivate/uninstall lifecycle.",
dependencies=[],
routes=[],
events=["contact.created"],
migrations=["0001_test_plugin.sql"],
permissions=[],
author="LeoCRM Team",
min_app_version="1.0.0",
contract_version="1.0.0")
def __init__(self) -> None:
super().__init__()
self.install_called = False
self.activate_called = False
self.deactivate_called = False
self.uninstall_called = False
self.event_log: list[dict[str, Any]] = []
async def on_install(self, db, service_container) -> None:
self.install_called = True
async def on_activate(self, db, service_container, event_bus) -> None:
self.activate_called = True
await super().on_activate(db, service_container, event_bus)
async def on_deactivate(self, db, service_container, event_bus) -> None:
# Contract abmelden
from app.plugins.builtins.contracts import get_contract_registry
get_contract_registry().unregister(self.manifest.name)
self.deactivate_called = True
await super().on_deactivate(db, service_container, event_bus)
async def on_uninstall(self, db, service_container) -> None:
self.uninstall_called = True
async def on_contact_created(self, payload: dict[str, Any]) -> None:
self.event_log.append({"event": "contact.created", "payload": payload})
@@ -1,38 +0,0 @@
"""Public contract for the test_sample plugin.
Exposes only the symbols that other builtins plugins need.
Importers should use::
from app.plugins.builtins.contracts import get_contract
ts = get_contract("test_sample")
if ts:
# use ts.TestSamplePlugin
instead of importing from internal modules directly.
"""
from __future__ import annotations
from app.plugins.builtins.contracts import get_contract_registry
from app.plugins.builtins.test_sample import TestSamplePlugin
class TestSampleContract:
"""Public API surface for the test_sample plugin."""
contract_name = "test_sample"
# ─── plugin class ───
TestSamplePlugin = TestSamplePlugin
# ─── self-registration ───
_contract = TestSampleContract()
get_contract_registry().register("test_sample", _contract)
__all__ = [
"TestSampleContract",
"TestSamplePlugin",
]
@@ -1,9 +0,0 @@
-- Test sample plugin migration: creates a test table with tenant_id
CREATE TABLE IF NOT EXISTS test_sample_items (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id UUID NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
name VARCHAR(100) NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS ix_test_sample_items_tenant ON test_sample_items(tenant_id);