The retry loop's body was only reachable through bring_up_account, which needs a live homeserver, so nothing exercised what happens when a down secondary comes up or fails, or that the Registry's new RwLock is never held across the network call. The unit tests covered the pure decision (DownAccounts, retry_delay) only. retry_down now delegates to retry_loop / retry_once, which take the bring-up step and the snapshot path as parameters; retry_down passes bring_up_account and the real path, so behaviour is unchanged. Tests use offline matrix-sdk clients and fake bring-ups to show that: - a secondary that comes up is inserted, leaves the down set, has its sync loop sent on and is published in the snapshot, while the primary and the other accounts stay the same clients; - one that fails (error or no token) stays down, is not published, and waits twice as long next time; one that is not yet due is not tried; - readers are not blocked while a bring-up is pending; - inserts under four busy reader threads neither deadlock nor lose an account; - the loop, under paused time, retries at 2, 6, 14 and 30 minutes. tokio's test-util feature is added as a dev-dependency for the last.
37 lines
922 B
TOML
37 lines
922 B
TOML
[package]
|
|
name = "hive-matrix-mcp"
|
|
edition.workspace = true
|
|
version.workspace = true
|
|
readme = "README.md"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
axum.workspace = true
|
|
clap.workspace = true
|
|
futures-util.workspace = true
|
|
hive-sock-client.workspace = true
|
|
matrix-sdk.workspace = true
|
|
mime = "0.3"
|
|
mime_guess = "2"
|
|
reqwest.workspace = true
|
|
rmcp.workspace = true
|
|
schemars.workspace = true
|
|
serde.workspace = true
|
|
serde_json.workspace = true
|
|
swarm-secret-client.workspace = true
|
|
tokio.workspace = true
|
|
tracing.workspace = true
|
|
tracing-subscriber.workspace = true
|
|
|
|
# `hive-matrix-daemon` — long-running per-agent matrix-sdk Client +
|
|
# sync loop. Serves its MCP tools (send_message, list_rooms, …)
|
|
# directly over streamable-http — no stdio bridge, no separate bin.
|
|
[[bin]]
|
|
name = "hive-matrix-daemon"
|
|
path = "src/main.rs"
|
|
|
|
[dev-dependencies]
|
|
tokio = { workspace = true, features = ["test-util"] }
|