topology: require --parent/--root explicitly + fix stale form doc (#492 nits)
This commit is contained in:
parent
5456377622
commit
3dbef583a7
2 changed files with 11 additions and 3 deletions
|
|
@ -852,9 +852,13 @@ struct RequestSpawnForm {
|
|||
|
||||
/// `POST /api/topology/set-parent` body. `child` is required.
|
||||
/// `new_parent` may be:
|
||||
/// - omitted entirely (form field absent) → no-op error,
|
||||
/// - empty string → promote to root,
|
||||
/// - absent or empty / whitespace-only → promote to root,
|
||||
/// - non-empty → new parent's logical name.
|
||||
///
|
||||
/// (The CLI surface gates "no parent specified" behind an explicit
|
||||
/// `--root` flag for safety; the HTTP surface is permissive
|
||||
/// because the dashboard form encodes "no value" as the empty
|
||||
/// string for the optional radio-group input.)
|
||||
#[derive(Deserialize)]
|
||||
struct SetParentForm {
|
||||
child: String,
|
||||
|
|
|
|||
|
|
@ -109,7 +109,11 @@ enum Cmd {
|
|||
SetParent {
|
||||
child: String,
|
||||
/// New parent agent name. Mutually exclusive with `--root`.
|
||||
#[arg(long, conflicts_with = "root")]
|
||||
/// Exactly one of `--parent` / `--root` is required — clap
|
||||
/// rejects both-absent calls so a fat-fingered
|
||||
/// `hive-c0re set-parent alice` doesn't silently promote
|
||||
/// alice to root (argus flag on PR #492).
|
||||
#[arg(long, conflicts_with = "root", required_unless_present = "root")]
|
||||
parent: Option<String>,
|
||||
/// Promote `child` to root (no parent).
|
||||
#[arg(long)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue