Files
buzz/desktop/src-tauri/src/relay/get.rs
Wes 2693e0db1f Make workflow run history authoritative in Desktop (#5780)
## Summary

- persist stable workflow run `error_code` values separately from human
diagnostics
- expose NIP-98 authenticated, channel-authorized run history and
approval reads with stable keyset pagination
- connect Desktop to those authoritative reads and return the
relay-created run ID on trigger
- show truthful loading, failure, and pending-trace states, and do not
render approval actions from non-actionable stored hashes

## Validation

- pre-push `branch-skew`, `desktop-typecheck`, `desktop-test`,
`rust-tests`, `desktop-tauri-checks`, and `desktop-check` all passed on
`a097dbe5f`
- Desktop tests: 4,761 passed, 0 failed
- `cargo check -p buzz-relay`
- `git diff --check`

## Remaining gate

This does not claim a relay-backed Playwright workflow journey. The
browser relay bridge still routes workflow invokes through in-memory
handlers; that production-shaped acceptance gate remains follow-up work
before Workflows can leave preview.

---------

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Co-authored-by: Carl <c7ebe626f000404285d3686e1dc74cc07cc60a9754a150041ba132e14bd3e2ec@buzz.block.builderlab.xyz>
Co-authored-by: Mongo <5c25403eab7271f9f94ddd4f2b270e8cac2c92e2c830c51877cca6ec974ffb3f@buzz.block.builderlab.xyz>
Co-authored-by: Princess Donut <68157ebd23b3897c1991015c3038658ea916200c67d3a54620b0754d1b92f6e0@buzz.block.builderlab.xyz>
2026-08-13 12:56:37 -07:00

38 lines
1.1 KiB
Rust

use reqwest::Method;
use serde::de::DeserializeOwned;
use crate::app_state::AppState;
use super::{
build_nip98_auth_header, classify_request_error, parse_json_response,
relay_api_base_url_with_override, relay_error_message,
};
/// Execute an authenticated GET against the active relay and decode its JSON body.
pub async fn get_relay_json<T: DeserializeOwned>(
state: &AppState,
path_with_query: &str,
) -> Result<T, String> {
if !path_with_query.starts_with('/') {
return Err("relay GET path must begin with '/'".to_string());
}
crate::relay_admission::wait_for_rate_limit().await;
let url = format!(
"{}{}",
relay_api_base_url_with_override(state),
path_with_query
);
let auth = build_nip98_auth_header(&Method::GET, &url, &[], state)?;
let response = state
.http_client
.get(&url)
.header("Authorization", auth)
.send()
.await
.map_err(|error| classify_request_error(&error))?;
if !response.status().is_success() {
return Err(relay_error_message(response).await);
}
parse_json_response(response).await
}