wip(#3001): remove submit layer, rescue power ops into job_queue/power.rs
TREE IS RED ON PURPOSE — there is no compiling intermediate between
deleting submit and converting every caller. Checkpoint commit so the
work is durable; do not "fix" it by restoring submit.
Done:
- JobQueue::submit -> JobQueue::insert (no source/reason/container;
returns the ids insert_job names).
- submit.rs deleted. Its 6 pure chain builders + 3 async *_many
gatherers were NOT wrapper code and are rescued into
job_queue/power.rs (templates.rs documents power ops as living
outside it, because their shape needs a live is_running read).
- Converted: meta_inputs 1, topology 2, permissions 3, auto_update 2,
actions 3, lifecycle_handlers 3.
- Dropped source/reason at every converted site: nothing ever read
NodeKind::Dag's fields (only `{ .. }` matches exist), so they are
write-only. Dead reason-only locals deleted; the boot sweep's summary
became a tracing::info! rather than being lost.
Remaining: dashboard/lifecycle_ops 7, server.rs 7, and the test suite —
tests.rs has its own submit() helper whose u64 return is used as the
handle to navigate the inserted DAG, so those need a different way to
find nodes, not a mechanical port.
This commit is contained in:
parent
6f87821110
commit
7c0d9d2379
9 changed files with 198 additions and 301 deletions
|
|
@ -208,16 +208,18 @@ pub(super) async fn post_meta_update(
|
|||
if inputs.is_empty() {
|
||||
return error_response("meta-update: no inputs selected");
|
||||
}
|
||||
let inputs_label = inputs.join(", ");
|
||||
// Cascade rebuild children fan out from the MetaLock node when the
|
||||
// lock bump lands — appended by the scheduler so they build against
|
||||
// the post-bump lock, and a failed bump simply fans out nothing.
|
||||
crate::job_queue::submit::meta_update(
|
||||
&state.coord,
|
||||
inputs,
|
||||
crate::job_queue::Source::Manual,
|
||||
format!("meta-update via dashboard ({inputs_label})"),
|
||||
);
|
||||
state
|
||||
.coord
|
||||
.job_queue
|
||||
.insert(|b| {
|
||||
crate::job_queue::templates::meta_update(b, inputs, None);
|
||||
Vec::new()
|
||||
})
|
||||
.expect("template-declared shapes are acyclic");
|
||||
state.coord.emit_rebuild_queue_snapshot();
|
||||
(StatusCode::OK, "ok").into_response()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -155,15 +155,21 @@ pub(super) async fn post_tool_groups(
|
|||
// META_LOCK inside the WritePermFile node, so concurrent
|
||||
// batch-apply actions for different agents never race on the
|
||||
// shared tool-groups.json.
|
||||
crate::job_queue::submit::perm_change(
|
||||
&state.coord,
|
||||
&logical,
|
||||
crate::job_queue::Source::Manual,
|
||||
"tool-group change via permissions UI".to_owned(),
|
||||
crate::job_queue::PermPayload::ToolGroups {
|
||||
groups: body.groups.clone(),
|
||||
},
|
||||
);
|
||||
state
|
||||
.coord
|
||||
.job_queue
|
||||
.insert(|b| {
|
||||
crate::job_queue::templates::perm_change(
|
||||
b,
|
||||
&logical,
|
||||
crate::job_queue::PermPayload::ToolGroups {
|
||||
groups: body.groups.clone(),
|
||||
},
|
||||
);
|
||||
Vec::new()
|
||||
})
|
||||
.expect("template-declared shapes are acyclic");
|
||||
state.coord.emit_rebuild_queue_snapshot();
|
||||
tracing::info!(agent = %logical, groups = ?body.groups, "operator: set tool-groups via dashboard");
|
||||
Ok((StatusCode::OK, "ok").into_response())
|
||||
}
|
||||
|
|
@ -264,15 +270,21 @@ pub(super) async fn post_capabilities(
|
|||
// META_LOCK inside the WritePermFile node, so concurrent
|
||||
// batch-apply actions for different agents never race on the
|
||||
// shared capabilities.json.
|
||||
crate::job_queue::submit::perm_change(
|
||||
&state.coord,
|
||||
&logical,
|
||||
crate::job_queue::Source::Manual,
|
||||
"capability change via dashboard".to_owned(),
|
||||
crate::job_queue::PermPayload::Capabilities {
|
||||
caps: body.caps.clone(),
|
||||
},
|
||||
);
|
||||
state
|
||||
.coord
|
||||
.job_queue
|
||||
.insert(|b| {
|
||||
crate::job_queue::templates::perm_change(
|
||||
b,
|
||||
&logical,
|
||||
crate::job_queue::PermPayload::Capabilities {
|
||||
caps: body.caps.clone(),
|
||||
},
|
||||
);
|
||||
Vec::new()
|
||||
})
|
||||
.expect("template-declared shapes are acyclic");
|
||||
state.coord.emit_rebuild_queue_snapshot();
|
||||
tracing::info!(agent = %logical, caps = ?body.caps, "operator: set capabilities via dashboard");
|
||||
Ok((StatusCode::OK, "ok").into_response())
|
||||
}
|
||||
|
|
@ -359,13 +371,19 @@ pub(super) async fn post_permissions(
|
|||
}
|
||||
// Phase 2 — submit one combined PermChange DAG per affected agent.
|
||||
for (logical, groups, caps) in staged {
|
||||
crate::job_queue::submit::perm_change(
|
||||
&state.coord,
|
||||
&logical,
|
||||
crate::job_queue::Source::Manual,
|
||||
"batch permission change via permissions UI".to_owned(),
|
||||
crate::job_queue::PermPayload::Combined { groups, caps },
|
||||
);
|
||||
state
|
||||
.coord
|
||||
.job_queue
|
||||
.insert(|b| {
|
||||
crate::job_queue::templates::perm_change(
|
||||
b,
|
||||
&logical,
|
||||
crate::job_queue::PermPayload::Combined { groups, caps },
|
||||
);
|
||||
Vec::new()
|
||||
})
|
||||
.expect("template-declared shapes are acyclic");
|
||||
state.coord.emit_rebuild_queue_snapshot();
|
||||
tracing::info!(agent = %logical, "operator: batch perm change via dashboard");
|
||||
}
|
||||
Ok((StatusCode::OK, "ok").into_response())
|
||||
|
|
|
|||
|
|
@ -94,12 +94,15 @@ pub(super) async fn post_set_parent(
|
|||
new_parent = ?new_parent,
|
||||
"operator: set-parent via dashboard"
|
||||
);
|
||||
submit::reparent(
|
||||
&state.coord,
|
||||
vec![(child, new_parent)],
|
||||
Source::Manual,
|
||||
"manual set-parent via dashboard".to_owned(),
|
||||
);
|
||||
state
|
||||
.coord
|
||||
.job_queue
|
||||
.insert(|b| {
|
||||
crate::job_queue::templates::reparent(b, vec![(child, new_parent)]);
|
||||
Vec::new()
|
||||
})
|
||||
.expect("template-declared shapes are acyclic");
|
||||
state.coord.emit_rebuild_queue_snapshot();
|
||||
Ok((StatusCode::OK, "ok").into_response())
|
||||
}
|
||||
|
||||
|
|
@ -150,11 +153,14 @@ pub(super) async fn post_set_parent_bulk(
|
|||
.map_err(|e| error_problem(&e))?;
|
||||
let names: Vec<&str> = body.iter().map(|e| e.child.as_str()).collect();
|
||||
tracing::info!(agents = ?names, "operator: set-parent-bulk via dashboard");
|
||||
submit::reparent(
|
||||
&state.coord,
|
||||
moves,
|
||||
Source::Manual,
|
||||
"manual set-parent-bulk via dashboard".to_owned(),
|
||||
);
|
||||
state
|
||||
.coord
|
||||
.job_queue
|
||||
.insert(|b| {
|
||||
crate::job_queue::templates::reparent(b, moves);
|
||||
Vec::new()
|
||||
})
|
||||
.expect("template-declared shapes are acyclic");
|
||||
state.coord.emit_rebuild_queue_snapshot();
|
||||
Ok((StatusCode::OK, "ok").into_response())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue