fix(plugin): umbrella.py registration broke /api/umbrella — sprint 2026-05-25 Wave 7 D12
Root cause: routes/umbrella.py:31 registered /umbrella (non-/api/* path)
which the plugin loader rejects with ValueError per SVRNTY-PLUGIN-PROTOCOL
§5.1. The ValueError bubbled out of register() before the two valid
/api/umbrella* routes could be registered, so /api/umbrella returned 404.
Note: task description fingered vault_status.py:46 as a "recursion bug",
but L46 there is handler.wfile.write(body) — no recursion. The _plugin_h
calls in tracebacks come from hermes-webui/api/routes.py:3462 (the
dispatcher, correctly invoking plugin handlers). The vault_status
BrokenPipeErrors are unrelated client-disconnect noise from a slow
credctl subprocess, not what breaks /api/umbrella.
Fix:
- Drop api.register_route("/umbrella", ...) line that violated /api/* contract
- Remove now-orphaned _handle_panel_html (Karpathy rule 3 cleanup)
- Add docstring noting umbrella panel HTML is reached via
/plugins/svrnty/umbrella.html (already served by register_static)
Verified: /api/umbrella returns 200 + umbrella.json after restart.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
db1d4e0cdb
commit
ab24ff9cdb
@ -26,12 +26,18 @@ def _repo_root() -> Path:
|
|||||||
|
|
||||||
|
|
||||||
def register(api):
|
def register(api):
|
||||||
"""Wire umbrella panel + APIs."""
|
"""Wire umbrella panel + APIs.
|
||||||
|
|
||||||
|
Note: the panel HTML lives at /plugins/svrnty/umbrella.html (served via
|
||||||
|
register_static). The /umbrella top-level route would require a non-/api/
|
||||||
|
handler, which the plugin loader doesn't allow (see SVRNTY-PLUGIN-PROTOCOL
|
||||||
|
§5.1 — register_route only accepts /api/*). Frontend nav links directly to
|
||||||
|
/plugins/svrnty/umbrella.html.
|
||||||
|
"""
|
||||||
log = api.logger("svrnty.routes.umbrella")
|
log = api.logger("svrnty.routes.umbrella")
|
||||||
api.register_route("/umbrella", "GET", _handle_panel_html)
|
|
||||||
api.register_route("/api/umbrella", "GET", _handle_graph_json)
|
api.register_route("/api/umbrella", "GET", _handle_graph_json)
|
||||||
api.register_route("/api/umbrella/doc", "GET", _handle_doc_body)
|
api.register_route("/api/umbrella/doc", "GET", _handle_doc_body)
|
||||||
log.info("umbrella panel + APIs registered")
|
log.info("umbrella APIs registered")
|
||||||
|
|
||||||
|
|
||||||
def _send(handler, status: int, body: bytes, content_type: str) -> None:
|
def _send(handler, status: int, body: bytes, content_type: str) -> None:
|
||||||
@ -101,11 +107,3 @@ def _handle_doc_body(handler, parsed) -> bool:
|
|||||||
}).encode("utf-8")
|
}).encode("utf-8")
|
||||||
_send(handler, 200, body, "application/json; charset=utf-8")
|
_send(handler, 200, body, "application/json; charset=utf-8")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def _handle_panel_html(handler, parsed) -> bool:
|
|
||||||
"""Serve the static umbrella.html via Location redirect (assets live in static/)."""
|
|
||||||
handler.send_response(302)
|
|
||||||
handler.send_header("Location", "/plugins/svrnty/umbrella.html")
|
|
||||||
handler.end_headers()
|
|
||||||
return True
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user