fix(missions): a microvm mission could not be created at all

`runtime_kind='microvm'` passes the DB CHECK, is honoured by placement, and now
has an executor — but `POST /api/missions` rejected the value with 400, so the
only interface that creates missions could not produce one. And `backend`, which
selects the per-CLI rootfs, was not in the create payload at all: it existed as a
column and as a parameter to `vm_create`, with nothing able to set it.

microvm needs no target_node_id at create time, unlike local_herdr: placement
resolves a KVM-capable node at launch and fails the launch when there is none, so
an explicit target is a request rather than a requirement.

461 tests pass, clippy clean.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
Omar Sobh
2026-08-05 16:21:39 -07:00
co-authored by Claude Opus 5
parent 0206be68e5
commit c9b7d8b6ca
2 changed files with 17 additions and 2 deletions
+7 -2
View File
@@ -129,6 +129,10 @@ pub struct NewMission<'a> {
/// Defaults to 'zeroclaw' when None.
pub runtime_kind: Option<&'a str>,
pub target_node_id: Option<Uuid>,
/// Which per-CLI image a `microvm` mission boots. NULL = the node's default
/// rootfs. Deliberately unconstrained in the schema: which images exist is a
/// property of the NODES, not of the database.
pub backend: Option<&'a str>,
pub phases: Vec<NewMissionPhase>,
}
@@ -157,9 +161,9 @@ pub async fn insert(pool: &PgPool, m: NewMission<'_>) -> Result<Uuid, DbError> {
"INSERT INTO missions
(id, workspace_id, title, template_kind, team_id,
team_template_id, repo_id, schedule, status, description, config,
runtime_kind, target_node_id)
runtime_kind, target_node_id, backend)
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,'draft',$9,$10,
COALESCE($11,'zeroclaw'),$12)",
COALESCE($11,'zeroclaw'),$12,$13)",
)
.bind(mission_id)
.bind(m.workspace_id)
@@ -173,6 +177,7 @@ pub async fn insert(pool: &PgPool, m: NewMission<'_>) -> Result<Uuid, DbError> {
.bind(&m.config)
.bind(m.runtime_kind)
.bind(m.target_node_id)
.bind(m.backend)
.execute(&mut *tx)
.await?;