#[non_exhaustive]pub enum WarningCode {
CommunityFilterNoop,
PprNoSubstrate,
NoReranker,
AuthoredAdjacencyEmpty,
BelowConfidenceFloor,
WarningsTruncated,
PprSizeGateSkipped,
}Expand description
Closed enum of every warning the retrieve pipeline can emit.
New variants require (a) a sibling warnings/<snake_case>.txt
message body, (b) a docs/warnings/<snake_case>.md remediation
markdown with an ## Agent fallback section, and (c) a line in
the WarningCode::remediation_ref match arm. The
xtask lint-warnings binary asserts all three at CI time; a
missing body or doc is a hard CI failure.
#[non_exhaustive] so adding a variant is an additive wire
change - existing callers match with a catch-all and keep
compiling.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
CommunityFilterNoop
community_filter: true was accepted but the commit has no
authored edges AND no vector index was available, so the
expander had no substrate to operate on.
PprNoSubstrate
graph_mode = "ppr" was accepted but the commit has no
authored edges AND no vector index was available, so the
PPR walk degraded to the identity pass (input order
unchanged).
NoReranker
rerank was requested but no reranker provider could be
opened (bad spec, missing credentials, unreachable endpoint);
results carry their fusion scores unchanged.
AuthoredAdjacencyEmpty
graph_expand was accepted but the commit has no authored
edges so the walk added no neighbours. Distinct from
WarningCode::CommunityFilterNoop: graph_expand ignores
the vector-derived KNN substrate, so vectors alone do not
suppress this warning.
BelowConfidenceFloor
Every candidate scored below the configured confidence floor,
so the items[] array is empty by gate rather than by a
retrieval failure. Reserved for callers using the (future)
min_confidence knob; wired through now so the warning code
is part of the stable v1 surface.
WarningsTruncated
Synthetic: more than WARNINGS_CAP warnings were generated;
the tail was dropped to bound the response size. Never emit
this manually - it is produced exclusively by
cap_warnings.
PprSizeGateSkipped
Gap 02 #17: graph_mode = "ppr" was requested but the graph
exceeds crate::ppr::PPR_DEFAULT_MAX_NODES and the caller
did not opt in via ppr_opt_in = true. PPR is skipped and the
pipeline falls back to the decay-BFS expansion to prevent
unbounded query latency.
Implementations§
Source§impl WarningCode
impl WarningCode
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Canonical wire name. Stable across versions; downstream dashboards and agent routing tables key on these strings.
Sourcepub const fn knob(self) -> &'static str
pub const fn knob(self) -> &'static str
Canonical agent-facing knob name this warning is about. Stable
across versions. Agents read warning.knob to decide which
knob to drop or substitute on the fallback call.
Sourcepub const fn message(self) -> &'static str
pub const fn message(self) -> &'static str
Compile-time-constant message body for this code.
Sourced via include_str! from
crates/mnem-core/src/retrieve/warnings/<code>.txt. Never
varies with user input; this is the sole anti-prompt-injection
guarantee.
Sourcepub const fn remediation_ref(self) -> &'static str
pub const fn remediation_ref(self) -> &'static str
Path (relative to repo root) of the remediation markdown for
this code. xtask lint-warnings asserts the file exists at CI
time; agents dereference the ref to get the full ## Agent fallback section.
Trait Implementations§
Source§impl Clone for WarningCode
impl Clone for WarningCode
Source§fn clone(&self) -> WarningCode
fn clone(&self) -> WarningCode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more