ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.Pipeline.Diagnostics

Description

The operator-facing diagnostics the packument serve path emits: the per-origin metadata-fetch failure log, the response-bound breach warning, the cross-upstream integrity-divergence warning (threat #11), and the dropped-entry warning a successful-but-degraded projection produces.

Each is a log line (with its structured payload) or a metered warning an operator filters, alarms on, or reads back during an incident; none changes what is served. They are emitted once per real fetch or merge, inside the request's katip context, so every line carries the request's trace correlation. The sibling per-condition log helpers these dispatch to (logDecodeFailure and friends) live in Ecluse.Core.Server.Pipeline.Internal; this module owns the packument-specific renderings.

Synopsis

Documentation

logMetadataFailure :: PackageName -> Text -> MetadataError -> Handler () Source #

Log a per-origin metadata-fetch failure at the point and severity it has always been logged: a response-bound breach names the ceiling crossed (logBreach); an undecodable body is the silent-guard decode log (logDecodeFailure); a self-reported different name is the name-mismatch log (logNameMismatch); an unformable configured base URL is the config-fault log (logUpstreamUnformable); an unreachable origin is the outage log (logUpstreamUnreachable). Invoked once per real fetch, inside the single-flight leader, in the request's context.

logInvalidEntries :: KatipContext m => PackageName -> Text -> [InvalidEntry] -> m () Source #

Log the malformed packument entries an upstream served that the projection dropped rather than failing the whole document on, at WarningS, so an operator can see that an upstream served a malformed entry, which kind (a version manifest, a dist-tag, or a per-version publish time), and the raw value it sent. The structured payload names the package, the per-kind drop counts, and a bounded sample of the dropped entries each rendering its raw Value (truncated if large, and capped to maxRenderedDrops entries so a flood of drops cannot bloat the line). The dropped versions are still served minus those entries (graceful degradation), so this is an observability signal, not a refusal. Emitted once per real fetch (inside the cache leader, so a coalesced follower never re-logs) through the request's katip context. The caller guards on a non-empty list, so this never logs for a clean document.

warnDivergences :: KatipContext m => MetricsPort -> PackageName -> MergePlan -> m () Source #

Log a cross-upstream integrity divergence (threat #11) at WarningS and meter it. A public copy contradicts the trusted one on a shared integrity algorithm for a shared version; the trusted copy still won the merge (and is served, or withheld under FailClosed), so this is the supply-chain signal the operator alarms on, never a silent reconciliation. The structured payload names the package and the contradicting versions; the ecluse.registry.merge.divergence counter is incremented once per contradicting version. Nothing is logged or metered for a clean merge.