mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
fix(desktop): check relay accepted flag on engram publish
publish_agent_event now parses the response body as SubmitEventResponse and verifies accepted == true. The relay can return HTTP 200 with accepted: false on duplicate events or policy rejections — previously this was treated as success. Matches the pattern in submit_event (relay.rs:394). Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
co-authored by
Will Pfleger
parent
45b0782011
commit
03618a4b59
@@ -246,6 +246,16 @@ async fn publish_agent_event(
|
||||
if !response.status().is_success() {
|
||||
return Err(relay::relay_error_message(response).await);
|
||||
}
|
||||
|
||||
let result: relay::SubmitEventResponse = response
|
||||
.json()
|
||||
.await
|
||||
.map_err(|e| format!("failed to parse publish response: {e}"))?;
|
||||
|
||||
if !result.accepted {
|
||||
return Err(format!("relay rejected engram: {}", result.message));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user