swarm-controller: fix broken intra-doc links (private items, rustdoc lint)
This commit is contained in:
parent
f3e42c93b4
commit
377dbb57e3
3 changed files with 18 additions and 10 deletions
|
|
@ -16,7 +16,7 @@
|
||||||
//! - [`ConfigPrCache::apply_webhook_delivery`] — called from
|
//! - [`ConfigPrCache::apply_webhook_delivery`] — called from
|
||||||
//! `crate::webhook::post_webhook_forge` on a verified `ConfigPr` delivery.
|
//! `crate::webhook::post_webhook_forge` on a verified `ConfigPr` delivery.
|
||||||
//! The low-latency path: a PR opening or closing shows up immediately
|
//! The low-latency path: a PR opening or closing shows up immediately
|
||||||
//! instead of waiting up to [`POLL_INTERVAL`].
|
//! instead of waiting up to `POLL_INTERVAL`.
|
||||||
//!
|
//!
|
||||||
//! Per mara's review call: ship both from the start rather than the poll
|
//! Per mara's review call: ship both from the start rather than the poll
|
||||||
//! alone — the eventual swarm-level replacement for `hive-c0re`'s own
|
//! alone — the eventual swarm-level replacement for `hive-c0re`'s own
|
||||||
|
|
@ -93,6 +93,12 @@ impl ConfigPrCache {
|
||||||
.cloned()
|
.cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// ⚠️ Can race [`Self::apply_webhook_delivery`]: a scan started before a
|
||||||
|
/// PR opened may finish *after* the webhook already upserted it, and
|
||||||
|
/// this snapshot — taken before that PR existed — will overwrite the
|
||||||
|
/// fresh entry. Self-heals within one `POLL_INTERVAL` (the next scan
|
||||||
|
/// sees the PR), so not worth coordinating against; noted per argus's
|
||||||
|
/// review rather than left implicit.
|
||||||
fn replace(&self, scan: HashMap<String, ConfigPrStatus>) {
|
fn replace(&self, scan: HashMap<String, ConfigPrStatus>) {
|
||||||
*self
|
*self
|
||||||
.0
|
.0
|
||||||
|
|
@ -152,7 +158,7 @@ impl ConfigPrCache {
|
||||||
///
|
///
|
||||||
/// The scan runs immediately on the first tick (`tokio::time::interval`'s
|
/// The scan runs immediately on the first tick (`tokio::time::interval`'s
|
||||||
/// default), so the cache is populated on startup rather than staying empty
|
/// default), so the cache is populated on startup rather than staying empty
|
||||||
/// for a full [`POLL_INTERVAL`] after boot.
|
/// for a full `POLL_INTERVAL` after boot.
|
||||||
pub fn spawn(client: Arc<Client>) -> Arc<ConfigPrCache> {
|
pub fn spawn(client: Arc<Client>) -> Arc<ConfigPrCache> {
|
||||||
let cache = Arc::new(ConfigPrCache::new());
|
let cache = Arc::new(ConfigPrCache::new());
|
||||||
let cache_for_task = Arc::clone(&cache);
|
let cache_for_task = Arc::clone(&cache);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ use utoipa::ToSchema;
|
||||||
use crate::webhook::DeliveryKind;
|
use crate::webhook::DeliveryKind;
|
||||||
|
|
||||||
/// An agent's open config-PR, as [`Client::list_open_config_prs`] reports it
|
/// An agent's open config-PR, as [`Client::list_open_config_prs`] reports it
|
||||||
/// and [`crate::get_agent_config_pr`] serves it.
|
/// and `GET /api/agents/{name}/config-pr` serves it.
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, ToSchema)]
|
#[derive(Clone, Debug, PartialEq, Serialize, ToSchema)]
|
||||||
pub struct ConfigPrStatus {
|
pub struct ConfigPrStatus {
|
||||||
pub pr_number: u64,
|
pub pr_number: u64,
|
||||||
|
|
@ -367,8 +367,9 @@ impl Client {
|
||||||
/// name. Mirrors `hive-c0re::forge::config_pr_poll::poll_open_config_prs`'s
|
/// name. Mirrors `hive-c0re::forge::config_pr_poll::poll_open_config_prs`'s
|
||||||
/// scan shape (list repos in the org, list open PRs per repo) but returns
|
/// scan shape (list repos in the org, list open PRs per repo) but returns
|
||||||
/// data instead of side-effecting an approval queue — this daemon has no
|
/// data instead of side-effecting an approval queue — this daemon has no
|
||||||
/// approval system of its own; it exists so [`crate::get_agent_config_pr`]
|
/// approval system of its own; it exists so `GET
|
||||||
/// has something to answer from, independent of any one hive being up.
|
/// /api/agents/{name}/config-pr` has something to answer from,
|
||||||
|
/// independent of any one hive being up.
|
||||||
///
|
///
|
||||||
/// A single repo's list failing does not fail the whole scan — logged and
|
/// A single repo's list failing does not fail the whole scan — logged and
|
||||||
/// skipped, so one flaky repo can't blank out every other agent's status.
|
/// skipped, so one flaky repo can't blank out every other agent's status.
|
||||||
|
|
|
||||||
|
|
@ -772,15 +772,16 @@ async fn get_jobq_rollup(State(state): State<AppState>) -> Json<Vec<hive_jobq_wi
|
||||||
|
|
||||||
/// `agent`'s open config PR, from [`config_pr::ConfigPrCache`] — kept
|
/// `agent`'s open config PR, from [`config_pr::ConfigPrCache`] — kept
|
||||||
/// current by a webhook nudge (near-real-time) backstopped by a periodic
|
/// current by a webhook nudge (near-real-time) backstopped by a periodic
|
||||||
/// scan (worst case: up to one [`config_pr::POLL_INTERVAL`] stale if a
|
/// scan (worst case: up to one `config_pr::POLL_INTERVAL` stale if a
|
||||||
/// delivery was ever missed). Not a live forge read either way, so this
|
/// delivery was ever missed). Not a live forge read either way, so this
|
||||||
/// answers even when the forge itself is momentarily unreachable.
|
/// answers even when the forge itself is momentarily unreachable.
|
||||||
///
|
///
|
||||||
/// `200` with a `null` body means "no open PR" (or "no scan has completed
|
/// `200` with a `null` body means "no open PR" (or "no scan has completed
|
||||||
/// yet") — not distinguished, for the same reason [`ConfigPrCache::get`]
|
/// yet") — not distinguished, for the same reason
|
||||||
/// doesn't: both read as "nothing to show" to the swarm-ui config-PR panel
|
/// [`config_pr::ConfigPrCache::get`] doesn't: both read as "nothing to show"
|
||||||
/// this feeds, and a cache is a best-effort read, not a source of truth
|
/// to the swarm-ui config-PR panel this feeds, and a cache is a best-effort
|
||||||
/// callers should expect to disambiguate against.
|
/// read, not a source of truth callers should expect to disambiguate
|
||||||
|
/// against.
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
get,
|
get,
|
||||||
path = "/api/agents/{name}/config-pr",
|
path = "/api/agents/{name}/config-pr",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue