feat(api): topology endpoints (catalog / classify / build)
ci / gates (push) Has been cancelled
ci / rust (push) Has been cancelled
ci / sandbox-k8s (push) Has been cancelled
ci / frontend (push) Has been cancelled
ci / e2e (push) Has been cancelled

Stateless, auth-gated routes backing the topology builder UI:
- GET  /api/topologies          — catalog of the 12 kinds + descriptions + role mix
- POST /api/topologies/classify — infer a kind + metrics from a posted graph
- POST /api/topologies/build    — build a canonical graph from {kind, roles}

Add Serialize to cm-topology Classification/GraphMetrics; add ApiError::BadRequest
(400) for invalid build input; add cm-topology dep. 3 integration tests
(catalog/build/auth) green against Postgres; offline build + clippy clean.

No DB or provider yet — running/comparing topologies is a later provider-backed
endpoint. Server redeploy will batch with the ReactFlow UI that consumes these.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Omar Sobh
2026-06-15 22:04:26 -07:00
co-authored by Claude Opus 4.8
parent b0c122b88d
commit fa7e5dec5f
8 changed files with 155 additions and 2 deletions
+4 -2
View File
@@ -8,12 +8,14 @@
use std::collections::VecDeque;
use serde::Serialize;
use crate::graph::TopologyGraph;
use crate::kind::TopologyKind;
/// Objective structural metrics for a topology graph (treated undirected for
/// connectivity, directed for hierarchy).
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Serialize)]
pub struct GraphMetrics {
/// Number of nodes.
pub order: usize,
@@ -38,7 +40,7 @@ pub struct GraphMetrics {
}
/// The result of [`classify`].
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Serialize)]
pub struct Classification {
/// Best-matching topology kind.
pub primary: TopologyKind,