Watch
0
0
Fork
You've already forked hyperhive
0

move startup_read from swarm-queue-client to swarm-secret-client

read_with_startup_retry retries the first read of a client secret through a store that is restarting. Nothing in swarm-queue-client calls it; its only callers are the four binaries that read the secret (swarm-builder, swarm-claude-login, swarm-controller, swarm-review-classifier), and they already depend on swarm-secret-client. It sits beside stored_secret, which moved there in #5538. swarm-queue-client drops its backon dependency and the tokio test-util dev-dependency that only these tests used.
This commit is contained in:
atlas 2026-10-18 12:35:37 +02:00 • committed by mara
commit 741fe388f9
10 changed files with 9 additions and 12 deletions

2
Cargo.lock generated
View file

@ -5027,7 +5027,6 @@ version = "0.1.0"
dependencies = [
"async-nats",
"axum",
"backon",
"data-encoding",
"hive-sh4re",
"reqwest",
@ -5067,6 +5066,7 @@ dependencies = [
name = "swarm-secret-client"
version = "0.1.0"
dependencies = [
"backon",
"futures-util",
"reqwest",
"rustify",

View file

@ -74,7 +74,7 @@ async fn main() -> Result<()> {
deadline: BUILD_DEADLINE,
});
let secret =
swarm_queue_client::read_with_startup_retry("reading the queue client secret", || {
swarm_secret_client::read_with_startup_retry("reading the queue client secret", || {
client_secret(&client_id)
})
.await?;

View file

@ -63,7 +63,7 @@ async fn main() -> Result<()> {
STEP_DEADLINE,
));
let secret =
swarm_queue_client::read_with_startup_retry("reading the queue client secret", || {
swarm_secret_client::read_with_startup_retry("reading the queue client secret", || {
client_secret(&client_id)
})
.await?;

View file

@ -58,7 +58,7 @@ pub async fn init() -> Result<()> {
let identity = match coordinates_from(|name| std::env::var(name).ok())? {
None => None,
Some(coordinates) => {
let secret = swarm_queue_client::read_with_startup_retry(
let secret = swarm_secret_client::read_with_startup_retry(
"fetching the queue client secret from the swarm secret store",
fetch_secret,
)

View file

@ -71,7 +71,6 @@ agents-md-initial = ["async-nats/jetstream"]
# Bare (no `kv`/`jetstream`) unless a consumer opts into the `kv` feature
# above - the connect itself needs none of them.
async-nats.workspace = true
backon.workspace = true
hive-sh4re = { workspace = true, optional = true }
# `blocking` on top of the workspace default (`form`/`json`/`rustls`) —
# `mint_token_for_blocking` needs `reqwest::blocking::Client` for a caller
@ -100,9 +99,6 @@ utoipa = { workspace = true, optional = true }
# A loopback stand-in token endpoint for the client secret re-read tests.
axum.workspace = true
data-encoding.workspace = true
# `test-util` for `#[tokio::test(start_paused = true)]`: the startup-read
# retry tests run on paused time.
tokio = { workspace = true, features = ["test-util"] }
[lints]
workspace = true

View file

@ -496,9 +496,6 @@ pub mod subagent_term;
/// same shapes.
pub mod review_classifier;
mod startup_read;
pub use startup_read::read_with_startup_retry;
/// Only the fields this needs; authelia returns several.
#[derive(serde::Deserialize)]
struct TokenResponse {

View file

@ -68,7 +68,7 @@ async fn serve() -> Result<()> {
},
};
let secret =
swarm_queue_client::read_with_startup_retry("reading the queue client secret", || {
swarm_secret_client::read_with_startup_retry("reading the queue client secret", || {
client_secret(&client_id)
})
.await?;

View file

@ -4,6 +4,8 @@ version.workspace = true
edition.workspace = true
[dependencies]
# `read_with_startup_retry`'s backoff schedule.
backon.workspace = true
# `Shared`, so every caller refused while a secret re-read runs waits on that
# one read (`stored_secret`).
futures-util.workspace = true

View file

@ -44,9 +44,11 @@ pub mod path;
pub mod policy;
pub mod queue;
pub mod review_classifier;
pub mod startup_read;
pub mod stored_secret;
pub use client::SecretStore;
pub use startup_read::read_with_startup_retry;
/// What can go wrong between "we have a client certificate" and "we have the
/// credential".