mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-11 01:26:37 +00:00
fix(config): drop retired skin/skin_options keys instead of validating them
A config.json written while the skin system existed can carry skin and skin_options in any plugin section, and most plugin schemas set additionalProperties: false. They are no longer core plugin properties; RETIRED_PLUGIN_KEYS in schema_manager lists them and drop_retired_plugin_keys removes them (unless the plugin's own schema declares the name) in prepare_plugin_config, which loading, hot reload, GET /plugins/config and both web saves already share, and in validate_config_against_schema for callers that validate a raw section. POST /plugins/config and /config/main also drop them from the stored section they merge into, so they leave config.json on the next save. Tests cover the load path (real PluginManager.load_plugin: no schema warning, not degraded), raw and prepared validation, validate_all_plugin_configs, and the JSON, form and /config/main saves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1276,9 +1276,8 @@ def _enhance_schema_with_core_properties(schema):
|
||||
"""
|
||||
Enhance schema with the core-owned per-plugin properties.
|
||||
|
||||
``enabled``, ``display_duration``, ``live_priority``, ``skin``,
|
||||
``skin_options`` and the ``vegas_*`` tuning keys are system-managed and
|
||||
always allowed, even when the plugin's schema doesn't declare them. The
|
||||
``enabled``, ``display_duration``, ``live_priority`` and the ``vegas_*``
|
||||
tuning keys are system-managed and always allowed, even when the plugin's schema doesn't declare them. The
|
||||
list is ``schema_manager.CORE_PLUGIN_PROPERTIES``, the one validation uses,
|
||||
so the save filter keeps exactly what validation accepts.
|
||||
|
||||
|
||||
@@ -1052,10 +1052,14 @@ def save_main_config():
|
||||
if error:
|
||||
return error
|
||||
|
||||
# Deep merge regular config into main config
|
||||
# Deep merge regular config into main config, dropping
|
||||
# retired core keys (skin, skin_options) from the stored section
|
||||
from src.plugin_system.schema_manager import drop_retired_plugin_keys
|
||||
stored_section = current_config.get(plugin_id)
|
||||
current_config[plugin_id] = deep_merge(
|
||||
stored_section if isinstance(stored_section, dict) else {}, regular_config)
|
||||
drop_retired_plugin_keys(
|
||||
stored_section if isinstance(stored_section, dict) else {}, schema),
|
||||
regular_config)
|
||||
if secrets_config:
|
||||
plugin_secrets_updates[plugin_id] = secrets_config
|
||||
|
||||
|
||||
@@ -2190,7 +2190,10 @@ def save_plugin_config():
|
||||
if plugin_id not in current_config:
|
||||
current_config[plugin_id] = {}
|
||||
|
||||
current_config[plugin_id] = deep_merge(current_config[plugin_id], regular_config)
|
||||
# Retired core keys (skin, skin_options) leave the stored section here
|
||||
from src.plugin_system.schema_manager import drop_retired_plugin_keys
|
||||
current_config[plugin_id] = deep_merge(
|
||||
drop_retired_plugin_keys(current_config[plugin_id], schema), regular_config)
|
||||
|
||||
# Deep merge plugin secrets in secrets config
|
||||
if secrets_config:
|
||||
|
||||
Reference in New Issue
Block a user