swarm-controller: trim oversized comments, drop a trivial wrapper fn

mara: "pls dont make comments longer than functions or fns that just
call a single other fn". Trimmed wanted.rs's module doc, apply()'s
doc, and declare_new_agent's doc down to what's non-obvious; deleted
WantedWriter::store (a one-line call to open_or_create with a
10-line doc comment above it) and inlined its body into its two
callers.
This commit is contained in:
iris 2026-09-18 22:42:05 +02:00 committed by mara
commit 8aafe4eaee
2 changed files with 23 additions and 78 deletions

View file

@ -328,26 +328,11 @@ async fn run_swarm_node(
}
/// Declare a brand-new agent at [`NEW_AGENT_WANTED_STATE`] — unless it turns
/// out not to be new.
///
/// A named function beside [`publish_deploy`] rather than the two lines
/// inline, for the same reason that one is: `run_swarm_node`'s match is a
/// per-variant index, and every arm that grows a body past a call pushes the
/// next reader further from the variant they came to read.
///
/// Reads the current declaration first and only calls
/// [`WantedWriter::set`](wanted::WantedWriter::set) when this agent has no
/// entry yet — `wanted.rs` itself no longer distinguishes creation from any
/// other write (mara: "i dont want any logic difference between the two
/// cases"), so the idempotency this node needs — calling create against a
/// name that already has a declaration (an operator migrating a pre-existing
/// agent into this bookkeeping, or a retried request) must not silently
/// pause an agent already running under some other state — lives entirely
/// here, the one caller it applies to. An existing `Destroyed` entry counts
/// as "no entry" for this check and gets written over: recreating a
/// previously-destroyed name is exactly the fresh deploy that state's own
/// doc comment names as the way back, and mara separately ruled "do not
/// refuse to recreate an agent".
/// out not to be new: an agent that already has a declaration (other than
/// `Destroyed`, which this treats as reusable) is left alone, so a retried
/// or migrating create is idempotent rather than pausing an already-running
/// agent. `wanted.rs` itself has no such carve-out, so this node makes the
/// call.
async fn declare_new_agent(
writer: &wanted::WantedWriter,
hive: &str,