fix(plugins): complete steward rename across bundled plugins; clear lint debt
The fabledscryer->steward rename had only ever reached host_agent. The other five bundled plugins (http, snmp, traefik, unifi, docker) still imported `from fabledscryer.*` (package no longer exists) and read FABLEDSCRYER_* env vars — so every one of them was broken at import since the original rebrand. CI stayed green only because none are enabled by default and migrations don't import plugin modules. Now that they version in-tree, complete the rename: - fabledscryer.* -> steward.* imports across all five plugins - FABLEDSCRYER_* -> STEWARD_* in plugin migration env.py files - author/repository/homepage + user-facing 'Fabled Scryer' strings -> Steward - snmp/scheduler.py: also drop dead `now`/datetime; record_metric from steward Adds tests/test_no_legacy_names.py — fails if 'scryer'/'roundtable' ever reappear in shipped code (the drift bit twice; this stops a third time). Also clears pre-existing ruff lint debt (unused imports, semicolon statements, mid-file import) surfaced by the new lint lane. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from pathlib import Path
|
||||
import textwrap
|
||||
from steward.app import create_app
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import urllib.error
|
||||
from unittest.mock import patch
|
||||
from plugins.host_agent import agent as a
|
||||
|
||||
@@ -55,10 +56,6 @@ def test_build_payload_wraps_samples():
|
||||
assert payload["samples"][0]["cpu_pct"] == 5.0
|
||||
|
||||
|
||||
import urllib.error
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
|
||||
def test_post_payload_success():
|
||||
from plugins.host_agent import agent as a
|
||||
captured = {}
|
||||
|
||||
@@ -3,7 +3,9 @@ from plugins.host_agent.agent import RingBuffer
|
||||
|
||||
def test_ring_buffer_preserves_order():
|
||||
rb = RingBuffer(maxlen=3)
|
||||
rb.push(1); rb.push(2); rb.push(3)
|
||||
rb.push(1)
|
||||
rb.push(2)
|
||||
rb.push(3)
|
||||
assert list(rb.drain()) == [1, 2, 3]
|
||||
assert len(rb) == 0
|
||||
|
||||
@@ -17,7 +19,8 @@ def test_ring_buffer_drops_oldest_when_full():
|
||||
|
||||
def test_ring_buffer_drain_clears_and_is_atomic():
|
||||
rb = RingBuffer(maxlen=5)
|
||||
rb.push("a"); rb.push("b")
|
||||
rb.push("a")
|
||||
rb.push("b")
|
||||
out = list(rb.drain())
|
||||
rb.push("c")
|
||||
assert out == ["a", "b"]
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
from plugins.host_agent.routes import _agent_version, AGENT_SOURCE_PATH
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import os
|
||||
import textwrap
|
||||
import pytest
|
||||
from steward.config import load_bootstrap
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import pytest
|
||||
from steward.models.users import User, UserRole
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
"""Regression guard: shipped code must not reference old project names.
|
||||
|
||||
The FabledScryer -> Roundtable -> Steward renames repeatedly left stale package
|
||||
imports behind in the (then separate) plugins (e.g. `from fabledscryer.models...`),
|
||||
silently breaking every non-host_agent plugin. Now that plugins are folded in-tree
|
||||
and version with core, this test fails loudly if either legacy name reappears in
|
||||
the shipped Python / templates / plugin manifests.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
_ROOT = Path(__file__).resolve().parent.parent
|
||||
_TREES = [_ROOT / "steward", _ROOT / "plugins"]
|
||||
_EXTENSIONS = {".py", ".yaml", ".yml", ".html", ".j2"}
|
||||
_FORBIDDEN = ("scryer", "roundtable") # case-insensitive; old project names
|
||||
|
||||
|
||||
def _shipped_files():
|
||||
for tree in _TREES:
|
||||
for path in tree.rglob("*"):
|
||||
if path.suffix in _EXTENSIONS and "__pycache__" not in path.parts:
|
||||
yield path
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name", _FORBIDDEN)
|
||||
def test_no_legacy_project_name(name):
|
||||
offenders = [
|
||||
str(p.relative_to(_ROOT))
|
||||
for p in _shipped_files()
|
||||
if name in p.read_text(encoding="utf-8", errors="ignore").lower()
|
||||
]
|
||||
assert not offenders, f"legacy name {name!r} found in shipped code: {offenders}"
|
||||
Reference in New Issue
Block a user