drop the host side of the agent broker send
Remove the agent-side Send and AckUntil requests, their hive-c0re handlers (handle_send with its 4 KiB size cap, handle_ack_until) and Broker::ack_until. Everything that existed only for them goes with them: the OkWarn response (its sole producer was Send's reserved-name warning), Recv's max parameter and RECV_BATCH_MAX (the harness never asked for more than one message), OPERATOR_SEND_REFUSAL, and the MESSAGE_MAX_BYTES / check_size limit (the reminder timer keeps its own copy of the cap, so its comment is reworded). Messages.remaining stays on the wire (default on read) because a harness built before this change still requires it. Update the conventions docs.
This commit is contained in:
parent
aeef4634e1
commit
1c3b5e52cf
1 changed files with 58 additions and 446 deletions
|
|
@ -33,18 +33,6 @@ pub fn format_ack(
|
|||
) -> String {
|
||||
match resp {
|
||||
Ok(hive_core_agent_sock::Response::Ok) => ok_msg,
|
||||
// Succeeded, with something the caller needs to read. Rendered
|
||||
// after the success line rather than instead of it: the operation
|
||||
// DID happen, and a warning shown as though it were a failure
|
||||
// invites a retry that would only queue a second one.
|
||||
Ok(hive_core_agent_sock::Response::OkWarn { warnings }) => {
|
||||
let mut out = ok_msg;
|
||||
for w in &warnings {
|
||||
out.push_str("\n⚠️ ");
|
||||
out.push_str(w);
|
||||
}
|
||||
out
|
||||
}
|
||||
other => reply_err(other, tool),
|
||||
}
|
||||
}
|
||||
|
|
@ -457,7 +445,7 @@ pub fn annotate_retries(mut s: String, retries: u32) -> String {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{dial_socket, format_ack};
|
||||
use super::dial_socket;
|
||||
|
||||
#[tokio::test]
|
||||
async fn a_socket_that_accepts_and_never_answers_is_given_up_on() {
|
||||
|
|
@ -487,33 +475,4 @@ mod tests {
|
|||
|
||||
assert!(resp.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ok_warn_keeps_the_success_line_and_appends_each_warning() {
|
||||
let out = format_ack(
|
||||
Ok(hive_core_agent_sock::Response::OkWarn {
|
||||
warnings: vec!["name is reserved".to_owned(), "second thing".to_owned()],
|
||||
}),
|
||||
"remind",
|
||||
"reminder set".to_owned(),
|
||||
);
|
||||
// The operation HAPPENED — dropping the success line would read as a
|
||||
// failure and invite a retry that repeats it.
|
||||
assert!(out.starts_with("reminder set"));
|
||||
assert!(out.contains("⚠️ name is reserved"));
|
||||
assert!(out.contains("⚠️ second thing"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plain_ok_is_untouched_by_the_warning_path() {
|
||||
// Absence arm: without it, a renderer that always appended a
|
||||
// warning marker would pass the test above.
|
||||
let out = format_ack(
|
||||
Ok(hive_core_agent_sock::Response::Ok),
|
||||
"remind",
|
||||
"sent".to_owned(),
|
||||
);
|
||||
assert_eq!(out, "sent");
|
||||
assert!(!out.contains('⚠'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue