refactor(hive-c0re): drop the request_init_config tool and InitConfig approval
swarm-controller's `InitAgentConfigRepo` node already covers config-repo creation, so this deletes a duplicate rather than a capability; old `init_config` rows are skipped by `collect_lenient` with no migration, by operator decision. Refs #4398
This commit is contained in:
parent
3f086bc659
commit
a3b672d1d5
31 changed files with 134 additions and 601 deletions
|
|
@ -1,5 +1,5 @@
|
|||
//! Approval queue. Requests are submitted by the manager (`RequestInitConfig`
|
||||
//! / `RequestUpdateMetaInputs`), the config-PR webhook (`MergeConfigPr`), or
|
||||
//! Approval queue. Requests are submitted by the manager
|
||||
//! (`RequestUpdateMetaInputs`), the config-PR webhook (`MergeConfigPr`), or
|
||||
//! the operator (`Spawn`); the user approves/denies via the host admin CLI;
|
||||
//! on approval the host runs the corresponding action.
|
||||
|
||||
|
|
@ -74,8 +74,7 @@ impl Approvals {
|
|||
/// Insert a new pending approval row. `fetched_sha` may be supplied
|
||||
/// when the sha is already known at submission time (e.g. `MergeConfigPr`
|
||||
/// fetches the PR head before inserting), making the insert + sha-set
|
||||
/// atomic. Pass `None` when the kind carries no sha (e.g. `Spawn` /
|
||||
/// `InitConfig`).
|
||||
/// atomic. Pass `None` when the kind carries no sha (e.g. `Spawn`).
|
||||
pub fn submit_kind(
|
||||
&self,
|
||||
agent: &str,
|
||||
|
|
@ -380,7 +379,6 @@ fn row_to_approval(row: &rusqlite::Row<'_>) -> rusqlite::Result<Approval> {
|
|||
let kind: String = row.get(2)?;
|
||||
let kind = match kind.as_str() {
|
||||
"spawn" => ApprovalKind::Spawn,
|
||||
"init_config" => ApprovalKind::InitConfig,
|
||||
"update_meta_inputs" => ApprovalKind::UpdateMetaInputs,
|
||||
"schedule_prompt" => ApprovalKind::SchedulePrompt,
|
||||
"merge_config_pr" => ApprovalKind::MergeConfigPr,
|
||||
|
|
@ -434,7 +432,6 @@ fn row_to_approval(row: &rusqlite::Row<'_>) -> rusqlite::Result<Approval> {
|
|||
fn kind_from_str(s: &str) -> Result<ApprovalKind> {
|
||||
Ok(match s {
|
||||
"spawn" => ApprovalKind::Spawn,
|
||||
"init_config" => ApprovalKind::InitConfig,
|
||||
"update_meta_inputs" => ApprovalKind::UpdateMetaInputs,
|
||||
"schedule_prompt" => ApprovalKind::SchedulePrompt,
|
||||
"merge_config_pr" => ApprovalKind::MergeConfigPr,
|
||||
|
|
@ -454,31 +451,6 @@ mod tests {
|
|||
(dir, path, db)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn init_config_approval_round_trips() {
|
||||
// Regression test: an `init_config` row used to fail
|
||||
// deserialization (row_to_approval matched only apply_commit +
|
||||
// spawn), erroring out the whole `pending()` query — every
|
||||
// approval then vanished from the dashboard.
|
||||
let (_dir, _path, db) = open_temp();
|
||||
let id = db
|
||||
.submit_kind(
|
||||
"bitburner",
|
||||
ApprovalKind::InitConfig,
|
||||
"",
|
||||
Some("scaffold"),
|
||||
"bitburner",
|
||||
None,
|
||||
)
|
||||
.expect("submit init_config");
|
||||
let pending = db
|
||||
.pending()
|
||||
.expect("pending() must not error on an init_config row");
|
||||
assert_eq!(pending.len(), 1);
|
||||
assert_eq!(pending[0].id, id);
|
||||
assert!(matches!(pending[0].kind, ApprovalKind::InitConfig));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mixed_kinds_all_listed() {
|
||||
let (_dir, _path, db) = open_temp();
|
||||
|
|
@ -493,7 +465,7 @@ mod tests {
|
|||
.unwrap();
|
||||
db.submit_kind("b", ApprovalKind::Spawn, "", None, "b", None)
|
||||
.unwrap();
|
||||
db.submit_kind("c", ApprovalKind::InitConfig, "", None, "c", None)
|
||||
db.submit_kind("c", ApprovalKind::UpdateMetaInputs, "[]", None, "c", None)
|
||||
.unwrap();
|
||||
let pending = db.pending().expect("pending");
|
||||
assert_eq!(pending.len(), 3, "all three kinds must be visible");
|
||||
|
|
|
|||
Loading…
Reference in a new issue