feat: add governance operations dashboard
This commit is contained in:
@@ -58,6 +58,7 @@ def _ops_status_payload(request: Request) -> dict[str, Any]:
|
||||
_deployment_security_check(current_profile),
|
||||
]
|
||||
readiness = _readiness(checks, maintenance_mode)
|
||||
governance = _governance_inventory(registry)
|
||||
return {
|
||||
"summary": {
|
||||
"app_env": core_settings.app_env,
|
||||
@@ -72,6 +73,7 @@ def _ops_status_payload(request: Request) -> dict[str, Any]:
|
||||
},
|
||||
"readiness": readiness,
|
||||
"checks": checks,
|
||||
"governance": governance,
|
||||
"deployment_profiles": _deployment_profiles(current_profile),
|
||||
"sizing": _sizing_assumptions(),
|
||||
}
|
||||
@@ -84,6 +86,49 @@ def _registry(request: Request) -> PlatformRegistry:
|
||||
return registry
|
||||
|
||||
|
||||
def _governance_inventory(registry: PlatformRegistry) -> dict[str, Any]:
|
||||
modules: list[dict[str, Any]] = []
|
||||
for manifest in registry.manifests():
|
||||
capability_names = tuple(sorted(manifest.capability_factories))
|
||||
access_control_count = (
|
||||
len(manifest.resource_acl_providers)
|
||||
+ len(manifest.ownership_providers)
|
||||
+ sum(len(providers) for providers in manifest.delete_veto_providers.values())
|
||||
+ len(manifest.uninstall_guard_providers)
|
||||
)
|
||||
modules.append({
|
||||
"module_id": manifest.id,
|
||||
"name": manifest.name,
|
||||
"version": manifest.version,
|
||||
"permission_count": len(manifest.permissions),
|
||||
"role_template_count": len(manifest.role_templates),
|
||||
"capability_count": len(capability_names),
|
||||
"policy_count": sum(name.startswith("policy.") for name in capability_names),
|
||||
"documentation_count": len(manifest.documentation),
|
||||
"documentation_provider_count": len(manifest.documentation_providers),
|
||||
"access_control_count": access_control_count,
|
||||
"search_provider_count": len(manifest.search_providers) + len(manifest.search_sources),
|
||||
"migration_managed": manifest.migration_spec is not None,
|
||||
})
|
||||
return {
|
||||
"summary": {
|
||||
"module_count": len(modules),
|
||||
"permission_count": sum(item["permission_count"] for item in modules),
|
||||
"role_template_count": sum(item["role_template_count"] for item in modules),
|
||||
"capability_count": sum(item["capability_count"] for item in modules),
|
||||
"policy_count": sum(item["policy_count"] for item in modules),
|
||||
"documented_module_count": sum(
|
||||
bool(item["documentation_count"] or item["documentation_provider_count"])
|
||||
for item in modules
|
||||
),
|
||||
"access_control_count": sum(item["access_control_count"] for item in modules),
|
||||
"search_provider_count": sum(item["search_provider_count"] for item in modules),
|
||||
"migration_module_count": sum(bool(item["migration_managed"]) for item in modules),
|
||||
},
|
||||
"modules": modules,
|
||||
}
|
||||
|
||||
|
||||
def _database_status() -> dict[str, Any]:
|
||||
try:
|
||||
with get_database().session() as session:
|
||||
|
||||
Reference in New Issue
Block a user