Expand description
Derive a Check from a check: job’s run output — the single
source of truth shared by the agent’s Health-tab cache
(kanade-agent::check_cache) and the backend’s fleet-wide
check_status projector, so the end user’s Client App and the
operator SPA can never disagree about the same run (#908).
Pure functions (no I/O) on purpose: both consumers feed them the already-captured stdout/stderr of an ExecResult.
Functions§
- build_
check - Map a check job’s stdout JSON object + its
CheckHintinto a KLPCheck. Pure (no I/O) so it’s unit-testable. Non-JSON / non-object stdout, or a missing / unrecognisedstatus_field, degrades toCheckStatus::Unknownwith a diagnostic detail — everything else is up to the operator’s PowerShell. - build_
check_ failed - Build the
Checkfor acheck:job that exited non-zero. The script crashed before it could report a status, so we surfaceUnknownwith the exit code + a stderr snippet rather than leaving a staleOkon the Health tab (a persistently-crashing check must not read as healthy). - json_
to_ detail - Render a detail field value as a string: pass non-empty strings
through, stringify scalars, and compact-JSON-encode arrays /
objects (so an operator who puts structured data in
detailsees something on the row instead of a silently-blank column). Onlynull/ empty-string yieldNone.