fix(cleanup): resolve 9 low-priority issues (P34-P42)
Check Cross-Plugin Imports / check (push) Has been cancelled
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:
@@ -205,17 +205,12 @@ class PluginService:
|
||||
async def get_plugin_config(self, db: AsyncSession, name: str) -> dict[str, Any]:
|
||||
"""Get the configuration for a plugin.
|
||||
|
||||
Returns the plugin's config field parsed from JSON string.
|
||||
Returns the plugin's config field (JSONB, already parsed by SQLAlchemy).
|
||||
"""
|
||||
record = await self._registry._get_plugin_record(db, name)
|
||||
if record is None:
|
||||
raise ValueError(f"Plugin '{name}' is not installed")
|
||||
import json
|
||||
config_str = getattr(record, "config", None) or "{}"
|
||||
try:
|
||||
return json.loads(config_str) if isinstance(config_str, str) else config_str or {}
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
return {}
|
||||
return getattr(record, "config", None) or {}
|
||||
|
||||
async def update_plugin_config(
|
||||
self,
|
||||
@@ -227,15 +222,13 @@ class PluginService:
|
||||
) -> dict[str, Any]:
|
||||
"""Update the configuration for a plugin.
|
||||
|
||||
Stores the config as a JSON string in the plugin's config field.
|
||||
Stores the config directly as JSONB in the plugin's config field.
|
||||
"""
|
||||
import json
|
||||
|
||||
record = await self._registry._get_plugin_record(db, name)
|
||||
if record is None:
|
||||
raise ValueError(f"Plugin '{name}' is not installed")
|
||||
|
||||
record.config = json.dumps(config)
|
||||
record.config = config
|
||||
await db.flush()
|
||||
|
||||
if tenant_id and user_id:
|
||||
|
||||
Reference in New Issue
Block a user