Harden topology tree against bad view filters and allow deleting UME World.

Coerce non-dict filter JSON so /tree no longer 500s, surface API failure details, and let users remove the UME World container for local resets.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-07 09:58:20 +08:00
parent 35a3980dc0
commit 961d523479
7 changed files with 89 additions and 30 deletions

View file

@ -19,6 +19,14 @@ PHYSICAL_VIEW_NAME = "Physical topology"
# Legacy system region name (no longer auto-created; stripped on bootstrap when empty).
_LEGACY_UNASSIGNED_NAME = "Unassigned"
def view_filter_dict(raw: Any) -> dict[str, Any]:
"""Coerce TopoView.filter JSON to a dict (bad rows must not 500 the tree)."""
if isinstance(raw, dict):
return dict(raw)
return {}
PAGE_DEFAULT = 100
PAGE_MAX = 2000
VIEW_GRAPH_NODE_HARD_CAP = 2000