docs: missing_docs sweep — 0 warnings + deny gate + publish-prep decisions (HY-02, HY-04, HY-11)
- document every public-API item across 18 files (openapi_spec model, HttpAuthScheme/HttpServiceConfig, HttpClientBuildError + SharedHttpClient accessors, RetryAfterMiddleware, GatewayDispatch, gateway error mapping, CallRequest/SchemaQuery/SubscribeStream, HttpAdapter + ALPNs + builders, decoy/healthz/state, WsSessions/WsPumps, from_openapi/from_jsonschema/from_mcp/from_wss/to_mcp, lib.rs module docs) - enforcement: #![deny(missing_docs)] at crate root — stronger than CI rustdocflags (every build incl. cfg(test), where rustdoc misses the test-support module docs) - HY-10 (opportunistic): all 8 docs.rs/alkhttp placeholder ADR links + the one relative ../docs link converted to plain text; the 10 pre-existing private/redundant intra-doc-link warnings fixed — RUSTDOCFLAGS="-D warnings" cargo doc is fully clean - HY-11 decision: docs/ + tasks/ excluded from the published package (contributor-facing design/process material; ADR references degrade to plain text uniformly). cargo publish --dry-run: 38 files, ~889 KiB, zero docs/ or tasks/ entries - HY-04 decision: keep + document — frame_channel0_chunk's unwrap is on serializing the acyclic EventEnvelope (unreachable failure); # Panics on it and the adjacent WsClient senders state the contract Verified: cargo test (299 + 5 TLS), --all-features (370 + suites), --no-default-features (299), clippy --all-targets -D warnings (default + all-features), fmt --check, cargo doc -D warnings clean, cargo publish --dry-run --allow-dirty clean. Tasks: review-001-missing-docs-sweep (final pending task; 42/42)
This commit is contained in:
@@ -177,36 +177,59 @@ impl Default for HttpClientConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// Why a [`SharedHttpClient`] could not be built: PEM file reads fail
|
||||
/// with `CaBundleRead`/`ClientCertRead`, PEM parsing fails with
|
||||
/// `CaBundleParse`/`ClientCertParse` (both carry the offending path),
|
||||
/// and the underlying reqwest builder fails with `Build`.
|
||||
#[derive(Debug, Error)]
|
||||
pub enum HttpClientBuildError {
|
||||
/// The configured `ca_bundle` path could not be read.
|
||||
#[error("failed to read CA bundle from {path}: {source}")]
|
||||
CaBundleRead {
|
||||
/// The unreadable path, for the caller's diagnostics.
|
||||
path: PathBuf,
|
||||
/// The underlying I/O error.
|
||||
#[source]
|
||||
source: std::io::Error,
|
||||
},
|
||||
/// The CA bundle file exists but is not valid PEM.
|
||||
#[error("failed to parse CA bundle at {path}: {source}")]
|
||||
CaBundleParse {
|
||||
/// The unparseable path, for the caller's diagnostics.
|
||||
path: PathBuf,
|
||||
/// The underlying reqwest parse error.
|
||||
#[source]
|
||||
source: reqwest::Error,
|
||||
},
|
||||
/// A client-certificate PEM path (`cert_pem` or `key_pem`) could
|
||||
/// not be read.
|
||||
#[error("failed to read client cert from {path}: {source}")]
|
||||
ClientCertRead {
|
||||
/// The unreadable path.
|
||||
path: PathBuf,
|
||||
/// The underlying I/O error.
|
||||
#[source]
|
||||
source: std::io::Error,
|
||||
},
|
||||
/// The client cert/key files exist but do not form a valid
|
||||
/// reqwest `Identity`.
|
||||
#[error("failed to parse client cert at {path}: {source}")]
|
||||
ClientCertParse {
|
||||
/// The path of the identity whose parse failed.
|
||||
path: PathBuf,
|
||||
/// The underlying reqwest parse error.
|
||||
#[source]
|
||||
source: reqwest::Error,
|
||||
},
|
||||
/// The reqwest client itself failed to build (e.g. TLS backend
|
||||
/// initialization).
|
||||
#[error("failed to build reqwest client: {0}")]
|
||||
Build(reqwest::Error),
|
||||
}
|
||||
|
||||
/// A hot-reloadable, middleware-stacked outbound HTTP client shared by
|
||||
/// consumer adapters. Clone-cheap (`ArcSwap` inner); callers reach the
|
||||
/// current stack through [`SharedHttpClient::client`].
|
||||
pub struct SharedHttpClient {
|
||||
inner: ArcSwap<SharedHttpInner>,
|
||||
}
|
||||
@@ -244,10 +267,15 @@ impl SharedHttpClient {
|
||||
})
|
||||
}
|
||||
|
||||
/// The current middleware-stacked client. Every call loads the
|
||||
/// latest stack — after a [`reload`](Self::reload), new requests
|
||||
/// ride the rebuilt client.
|
||||
pub fn client(&self) -> Arc<ClientWithMiddleware> {
|
||||
Arc::clone(&self.inner.load().client)
|
||||
}
|
||||
|
||||
/// The config the current client was built from (swapped together
|
||||
/// with the client; FWD-12).
|
||||
pub fn config(&self) -> Arc<HttpClientConfig> {
|
||||
Arc::clone(&self.inner.load().config)
|
||||
}
|
||||
|
||||
@@ -61,6 +61,10 @@ fn parse_retry_after_with_ceiling(value: &str, ceiling: Duration) -> Option<Syst
|
||||
Some(clamped)
|
||||
}
|
||||
|
||||
/// Per-URL `Retry-After` memory (FWD-05): records the backlog deadline
|
||||
/// an upstream declared and holds back subsequent requests to that URL
|
||||
/// until it elapses. LRU-bounded by capacity; deadlines clamped to the
|
||||
/// configured ceiling.
|
||||
pub struct RetryAfterMiddleware {
|
||||
deadlines: Mutex<HashMap<Url, SystemTime>>,
|
||||
capacity: usize,
|
||||
@@ -68,10 +72,22 @@ pub struct RetryAfterMiddleware {
|
||||
}
|
||||
|
||||
impl RetryAfterMiddleware {
|
||||
/// A middleware with the default 300 s `Retry-After` ceiling.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics when `capacity` is 0 (a rate-limit memory that remembers
|
||||
/// nothing is a construction error, not a runtime fallback).
|
||||
pub fn with_capacity(capacity: usize) -> Self {
|
||||
Self::with_capacity_and_ceiling(capacity, Duration::from_secs(300))
|
||||
}
|
||||
|
||||
/// A middleware with an explicit `capacity` bound and a ceiling
|
||||
/// clamping hostile upstream deadlines.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics when `capacity` is 0.
|
||||
pub fn with_capacity_and_ceiling(capacity: usize, ceiling: Duration) -> Self {
|
||||
Self {
|
||||
deadlines: Mutex::new(HashMap::with_capacity(capacity.min(128))),
|
||||
|
||||
Reference in New Issue
Block a user