refactor: update imports fabledscryer → roundtable

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-13 17:13:55 -04:00
parent 8aad2ab43d
commit 94a35da86e
45 changed files with 147 additions and 147 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING
from sqlalchemy import and_, or_, select
from sqlalchemy.ext.asyncio import AsyncSession
from fabledscryer.models.alerts import (
from roundtable.models.alerts import (
AlertEvent,
AlertOperator,
AlertRule,
@@ -16,7 +16,7 @@ from fabledscryer.models.alerts import (
AlertStateEnum,
MaintenanceWindow,
)
from fabledscryer.models.metrics import PluginMetric
from roundtable.models.metrics import PluginMetric
if TYPE_CHECKING:
from quart import Quart
@@ -226,7 +226,7 @@ async def _dispatch_notification(
event_id: str,
) -> None:
"""Run after the transaction commits. Sends notifications and updates the event row."""
from fabledscryer.core.notifications import dispatch_notifications
from roundtable.core.notifications import dispatch_notifications
alert_data = {
"rule_name": rule.name,
+2 -2
View File
@@ -1,4 +1,4 @@
"""fabledscryer/core/audit.py
"""roundtable/core/audit.py
Helpers for writing audit log entries. Each call opens its own DB
session so audit events are committed independently of the calling
@@ -23,7 +23,7 @@ async def log_audit(
detail: dict | None = None,
) -> None:
"""Write one audit event. Never raises — failures are logged and swallowed."""
from fabledscryer.models.audit import AuditEvent
from roundtable.models.audit import AuditEvent
try:
async with app.db_sessionmaker() as db:
async with db.begin():
+3 -3
View File
@@ -5,9 +5,9 @@ from typing import TYPE_CHECKING
from sqlalchemy import delete
from fabledscryer.models.monitors import DnsResult, PingResult
from fabledscryer.models.metrics import PluginMetric
from fabledscryer.models.ansible import AnsibleRun
from roundtable.models.monitors import DnsResult, PingResult
from roundtable.models.metrics import PluginMetric
from roundtable.models.ansible import AnsibleRun
if TYPE_CHECKING:
from quart import Quart
+1 -1
View File
@@ -1,4 +1,4 @@
# fabledscryer/core/migration_runner.py
# roundtable/core/migration_runner.py
from __future__ import annotations
import logging
from pathlib import Path
+1 -1
View File
@@ -34,7 +34,7 @@ async def _send_email(cfg: dict, alert: dict) -> dict:
try:
msg = EmailMessage()
msg["Subject"] = f"[Fabled Scryer] {alert['state']}{alert['rule_name']}"
msg["From"] = cfg.get("username", "fabledscryer@localhost")
msg["From"] = cfg.get("username", "roundtable@localhost")
msg["To"] = ", ".join(cfg["recipients"])
msg.set_content(
f"Alert: {alert['state']}\n"
+1 -1
View File
@@ -1,4 +1,4 @@
# fabledscryer/core/plugin_index.py
# roundtable/core/plugin_index.py
"""Remote plugin catalog: fetch, parse, and cache the plugin index.yaml."""
from __future__ import annotations
import logging
+14 -14
View File
@@ -1,4 +1,4 @@
# fabledscryer/core/plugin_manager.py
# roundtable/core/plugin_manager.py
from __future__ import annotations
import hashlib
import importlib
@@ -41,7 +41,7 @@ def _import_plugin(name: str, plugin_path: Path):
"""
import importlib.util
module_key = f"_fabledscryer_plugin_{name}"
module_key = f"_roundtable_plugin_{name}"
if module_key in sys.modules:
return sys.modules[module_key]
@@ -78,7 +78,7 @@ def load_plugins(app: "Quart") -> None:
7. Register blueprint at /plugins/<name>/ if get_blueprint() exists
8. Append get_scheduled_tasks() results to app._task_registry
"""
import fabledscryer
import roundtable
plugin_dir = Path(app.config["PLUGIN_DIR"])
plugins_cfg: dict = app.config["PLUGINS"]
@@ -126,13 +126,13 @@ def load_plugins(app: "Quart") -> None:
min_ver = meta.get("min_app_version")
if min_ver:
try:
if Version(fabledscryer.__version__) < Version(min_ver):
if Version(roundtable.__version__) < Version(min_ver):
_FAILED_PLUGINS[name] = (
f"Requires fabledscryer>={min_ver}, running {fabledscryer.__version__}"
f"Requires roundtable>={min_ver}, running {roundtable.__version__}"
)
logger.error(
"Plugin %r: requires fabledscryer>=%s but running %s, skipping",
name, min_ver, fabledscryer.__version__,
"Plugin %r: requires roundtable>=%s but running %s, skipping",
name, min_ver, roundtable.__version__,
)
continue
except Exception as exc:
@@ -267,7 +267,7 @@ async def download_and_install_plugin(
# Detect a single top-level directory to strip. Handles:
# name/ (clean plugin zip)
# name-v1.0.0/ (GitHub release tag archive)
# fabledscryer-plugins-main/name/ (whole-repo archive)
# roundtable-plugins-main/name/ (whole-repo archive)
# Strategy: if there is exactly one top-level item and it is a
# directory whose name starts with the plugin name (case-insensitive),
# strip it. Otherwise extract flat into dest.
@@ -302,7 +302,7 @@ async def download_and_install_plugin(
try:
mdir = plugin_dir / name / "migrations"
if mdir.exists():
from fabledscryer.core.migration_runner import (
from roundtable.core.migration_runner import (
run_plugin_migrations,
discover_all_plugin_migration_dirs,
)
@@ -325,7 +325,7 @@ def hot_reload_plugin(app: "Quart", name: str) -> tuple[bool, str]:
Returns (success, message).
"""
import fabledscryer
import roundtable
if name in _LOADED_PLUGINS:
return False, "Plugin already loaded — restart required to apply updates"
@@ -352,10 +352,10 @@ def hot_reload_plugin(app: "Quart", name: str) -> tuple[bool, str]:
min_ver = meta.get("min_app_version")
if min_ver:
try:
if Version(fabledscryer.__version__) < Version(min_ver):
if Version(roundtable.__version__) < Version(min_ver):
return False, (
f"Plugin requires fabledscryer>={min_ver} "
f"but running {fabledscryer.__version__}"
f"Plugin requires roundtable>={min_ver} "
f"but running {roundtable.__version__}"
)
except Exception:
return False, f"Invalid min_app_version: {min_ver!r}"
@@ -381,7 +381,7 @@ def hot_reload_plugin(app: "Quart", name: str) -> tuple[bool, str]:
mdir = plugin_path / "migrations"
if mdir.exists():
try:
from fabledscryer.core.migration_runner import (
from roundtable.core.migration_runner import (
run_plugin_migrations,
discover_all_plugin_migration_dirs,
)
+8 -8
View File
@@ -1,4 +1,4 @@
"""fabledscryer/core/reports.py
"""roundtable/core/reports.py
Weekly digest report: uptime, active alerts, alert events, top metrics.
Called by the scheduler (hourly check) or triggered manually from Settings.
@@ -13,10 +13,10 @@ from email.message import EmailMessage
from sqlalchemy import and_, case, func, select
from fabledscryer.models.alerts import AlertRule, AlertState, AlertStateEnum, AlertEvent
from fabledscryer.models.hosts import Host
from fabledscryer.models.metrics import PluginMetric
from fabledscryer.models.monitors import PingResult, PingStatus
from roundtable.models.alerts import AlertRule, AlertState, AlertStateEnum, AlertEvent
from roundtable.models.hosts import Host
from roundtable.models.metrics import PluginMetric
from roundtable.models.monitors import PingResult, PingStatus
logger = logging.getLogger(__name__)
@@ -226,13 +226,13 @@ async def send_report(app) -> tuple[bool, str]:
msg = EmailMessage()
msg["Subject"] = subject
msg["From"] = smtp_cfg.get("username", "fabledscryer@localhost")
msg["From"] = smtp_cfg.get("username", "roundtable@localhost")
msg["To"] = ", ".join(smtp_cfg["recipients"])
msg.set_content(body)
try:
loop = asyncio.get_running_loop()
from fabledscryer.core.notifications import _smtp_send_sync
from roundtable.core.notifications import _smtp_send_sync
await loop.run_in_executor(None, _smtp_send_sync, smtp_cfg, msg)
logger.info("Weekly report sent to %s", smtp_cfg["recipients"])
return True, f"Report sent to {', '.join(smtp_cfg['recipients'])}."
@@ -243,7 +243,7 @@ async def send_report(app) -> tuple[bool, str]:
async def check_and_send(app) -> None:
"""Hourly scheduler hook: send if day/hour match and not sent recently."""
from fabledscryer.core.settings import get_setting, set_setting
from roundtable.core.settings import get_setting, set_setting
async with app.db_sessionmaker() as db:
enabled = await get_setting(db, "reports.enabled")
+4 -4
View File
@@ -1,15 +1,15 @@
# fabledscryer/core/settings.py
# roundtable/core/settings.py
"""DB-backed application settings.
Keys use dotted notation (e.g. "smtp.host").
Values are JSON-encoded in the DB.
Usage in create_app() (before event loop):
from fabledscryer.core.settings import load_settings_sync
from roundtable.core.settings import load_settings_sync
settings = load_settings_sync(db_url)
Usage at runtime (inside async handlers):
from fabledscryer.core.settings import get_setting, set_setting
from roundtable.core.settings import get_setting, set_setting
async with app.db_sessionmaker() as session:
value = await get_setting(session, "smtp.host")
await set_setting(session, "smtp.host", "mail.example.com")
@@ -24,7 +24,7 @@ from typing import Any
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from fabledscryer.models.settings import AppSetting
from roundtable.models.settings import AppSetting
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -1,4 +1,4 @@
# fabledscryer/core/time_range.py
# roundtable/core/time_range.py
"""Shared time-range utilities for scoping queries and sparkline data."""
from __future__ import annotations
from datetime import datetime, timedelta, timezone
+1 -1
View File
@@ -1,4 +1,4 @@
# fabledscryer/core/widgets.py
# roundtable/core/widgets.py
#
# Central widget registry. Each entry describes one widget type that can be
# placed on a dashboard. Plugin widgets declare which plugin must be enabled.