refactor(topology): make the 12-kinds-to-5-patterns collapse explicit

TopologyKind describes twelve distinct intents, but the orchestrator
implements five planners and mapped the kinds onto them inside plan_steps.
So Market never auctions, StarMoe never routes to experts, Ring never cycles
and Holacratic never self-organizes -- each silently runs as whichever pattern
it collapses to, while kind::description() and the UI catalog kept promising
the distinct behaviour.

Rather than delete variants that appear in persisted rows, the collapse is now
named: ExecutionPattern + TopologyKind::execution_pattern() in cm-topology,
with plan_steps dispatching on the pattern instead of re-listing the mapping.
One source of truth, and the two cannot drift.

GET /api/topologies now reports `executes_as` and `distinct_at_execution` so a
UI can stop offering aliases as if they behaved differently.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Omar Sobh
2026-07-30 10:54:43 -07:00
co-authored by Claude Opus 5
parent b1bdfbbf87
commit d94487d3ba
4 changed files with 90 additions and 13 deletions
+9
View File
@@ -33,6 +33,13 @@ pub struct CatalogEntry {
pub name: String,
pub description: String,
pub role_distribution: Vec<RoleWeight>,
/// The execution pattern this kind actually runs as. Twelve kinds map onto
/// five patterns, so this differs from `name` for the aliased ones.
pub executes_as: String,
/// False when the kind is an alias — its description promises semantics the
/// engine does not implement (Market never auctions, Ring never cycles).
/// A UI should not offer these as if they behaved differently.
pub distinct_at_execution: bool,
}
/// `GET /api/topologies` — the catalog of supported topology kinds.
@@ -53,6 +60,8 @@ pub async fn catalog(_auth: Authed) -> Json<Vec<CatalogEntry>> {
weight: *weight,
})
.collect(),
executes_as: kind.execution_pattern().as_str().to_string(),
distinct_at_execution: kind.is_distinct_at_execution(),
}
})
.collect();