mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-10-29 16:17:25 +09:00
Plan 47 Phase 2. The status-pages blueprint (public /status/<slug> + /badge + authenticated management API) and its service move into builtin-extensions/serverkit-status/backend/ (entry_point status_pages: status_pages_bp, url_prefix unchanged). Core no longer registers /api/v1/status (management) or imports the service; the unused /api/v1/observability/status-pages alias is dropped. The StatusPage/StatusComponent/etc models stay core (G2). The public status/badge pages work whenever the extension is installed. The core WordPress health-check job (run_health_checks) now reaches StatusPageService.sync_component_from_health via get_installed_extension_attr and no-ops cleanly on a lean panel. Tests: test_status_extraction.py (8) — extraction shape, install=routes, health-job no-op, relocated status-page mutation + component-check authz. Adjusted test_observability_namespace + test_api_authz_hardening accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
38 lines
1.8 KiB
Python
38 lines
1.8 KiB
Python
"""§4 unification — one /api/v1/observability namespace.
|
|
|
|
The monitoring / metrics / telemetry(events) / uptime / fleet / status-page read
|
|
surfaces are re-mounted under /api/v1/observability/<domain> as true aliases.
|
|
The original prefixes and the public status page route stay intact.
|
|
"""
|
|
|
|
|
|
def test_observability_aliases_registered():
|
|
from app import create_app
|
|
application = create_app('testing')
|
|
rules = {r.rule for r in application.url_map.iter_rules()}
|
|
assert any(r.startswith('/api/v1/observability/monitoring') for r in rules)
|
|
assert any(r.startswith('/api/v1/observability/metrics') for r in rules)
|
|
assert any(r.startswith('/api/v1/observability/events') for r in rules)
|
|
assert any(r.startswith('/api/v1/observability/uptime') for r in rules)
|
|
assert any(r.startswith('/api/v1/observability/fleet') for r in rules)
|
|
# The status-pages observability alias was dropped when status pages moved to
|
|
# the serverkit-status extension (plan 47); the public status route now ships
|
|
# with that extension rather than core.
|
|
|
|
|
|
def test_original_prefixes_still_present():
|
|
from app import create_app
|
|
application = create_app('testing')
|
|
rules = {r.rule for r in application.url_map.iter_rules()}
|
|
assert any(r.startswith('/api/v1/monitoring') for r in rules)
|
|
assert any(r.startswith('/api/v1/telemetry') for r in rules)
|
|
assert any(r.startswith('/api/v1/fleet-monitor') for r in rules)
|
|
|
|
|
|
def test_events_alias_matches_telemetry(app, client, auth_headers):
|
|
canonical = client.get('/api/v1/telemetry/events', headers=auth_headers)
|
|
alias = client.get('/api/v1/observability/events/events', headers=auth_headers)
|
|
assert canonical.status_code == 200
|
|
assert alias.status_code == 200
|
|
assert alias.get_json() == canonical.get_json()
|