mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-06 23:35:08 +00:00
chore: remove dead code, deprecate unused plugin APIs (over-engineering audit)
Whole-tree audit. Every symbol was checked against core, the plugin monorepo and all eight third-party plugins in plugins.json first. - Deprecate (removal 3.10.0) plugin-facing methods nothing calls: LogoDownloader bulk download, ConfigManager backup/secret wrappers, APIHelper extras, BackgroundDataService poll API, PluginManager / PluginStateManager info readers, and a few CacheManager, FontManager, BaseOddsManager, DynamicTeamResolver methods and PluginTestCase. plugin_api_usage.py learns their receiver names; DEPRECATIONS doc regenerated. - Remove core-internal dead code: CacheMetrics, Vegas status/stats plumbing, sync "new cycle" message (followers ignore unknown types), unused operation types, test-only PluginCatalog readers, IPC to_dict and ping, _parse_form_value, CacheStrategyProtocol, ErrorAggregator callbacks, duplicate web response helpers. - Web UI: drop never-mounted json-file-manager.js, the example widget, utils/error_handler.js, four uncalled PluginAPI methods, and 29 escapeHtml shims (call window.LEDEscape directly). Public globals, BaseWidget and widget names unchanged. - Remove six one-off scripts (owner decision) and the unused markupsafe and pytest-mock pins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
"""
|
||||
Tests for src/vegas_mode/config.py
|
||||
|
||||
Covers VegasModeConfig: from_config, to_dict, get_frame_interval,
|
||||
Covers VegasModeConfig: from_config, get_frame_interval,
|
||||
get_ordered_plugins, validate.
|
||||
"""
|
||||
|
||||
import dataclasses
|
||||
|
||||
import pytest
|
||||
from src.vegas_mode.config import VegasModeConfig
|
||||
|
||||
@@ -49,7 +51,8 @@ class TestVegasModeConfigDefaults:
|
||||
(Path(__file__).resolve().parent.parent / "config"
|
||||
/ "config.template.json").read_text(encoding="utf-8"))
|
||||
shipped = template["display"]["vegas_scroll"]
|
||||
defaults = VegasModeConfig().to_dict()
|
||||
defaults = dataclasses.asdict(VegasModeConfig())
|
||||
defaults["excluded_plugins"] = sorted(defaults["excluded_plugins"])
|
||||
mismatched = {k: (v, defaults[k]) for k, v in shipped.items()
|
||||
if k in defaults and defaults[k] != v}
|
||||
assert not mismatched, f"template vs code default: {mismatched}"
|
||||
@@ -57,9 +60,9 @@ class TestVegasModeConfigDefaults:
|
||||
def test_missing_keys_read_the_field_defaults(self):
|
||||
# from_config used to repeat every default; with no keys set it must
|
||||
# produce exactly the dataclass defaults.
|
||||
assert VegasModeConfig.from_config({}).to_dict() == VegasModeConfig().to_dict()
|
||||
assert (VegasModeConfig.from_config({"display": {"vegas_scroll": {}}}).to_dict()
|
||||
== VegasModeConfig().to_dict())
|
||||
assert VegasModeConfig.from_config({}) == VegasModeConfig()
|
||||
assert (VegasModeConfig.from_config({"display": {"vegas_scroll": {}}})
|
||||
== VegasModeConfig())
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -114,42 +117,6 @@ class TestFromConfig:
|
||||
assert cfg.frame_based_scrolling is False
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# to_dict
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestToDict:
|
||||
def test_roundtrip(self):
|
||||
original = VegasModeConfig(
|
||||
enabled=True,
|
||||
scroll_speed=75.0,
|
||||
separator_width=24,
|
||||
plugin_order=["a", "b"],
|
||||
excluded_plugins={"z"},
|
||||
target_fps=100,
|
||||
)
|
||||
d = original.to_dict()
|
||||
assert d["enabled"] is True
|
||||
assert d["scroll_speed"] == 75.0
|
||||
assert d["separator_width"] == 24
|
||||
assert d["plugin_order"] == ["a", "b"]
|
||||
assert "z" in d["excluded_plugins"]
|
||||
assert d["target_fps"] == 100
|
||||
|
||||
def test_excluded_plugins_is_list(self):
|
||||
cfg = VegasModeConfig(excluded_plugins={"x"})
|
||||
d = cfg.to_dict()
|
||||
assert isinstance(d["excluded_plugins"], list)
|
||||
|
||||
def test_all_keys_present(self):
|
||||
d = VegasModeConfig().to_dict()
|
||||
for key in ("enabled", "scroll_speed", "separator_width", "plugin_order",
|
||||
"excluded_plugins", "target_fps", "buffer_ahead",
|
||||
"frame_based_scrolling", "scroll_delay",
|
||||
"dynamic_duration_enabled", "min_cycle_duration", "max_cycle_duration"):
|
||||
assert key in d
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# get_frame_interval
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user