Class OutcomeLedger
- Namespace
- Kuestenlogik.Bowire.Monitoring
- Assembly
- Kuestenlogik.Bowire.Monitoring.dll
The append-only outcome ledger (#102, Decision 2). Each probe gets a
<name>.jsonl file under the ledger root; every run appends one
JSON line. The last row is the source of truth for restart resume
(when did this probe last run) and transition detection (was it passing or
failing). Reading the last row is a cheap tail read; the workbench surface
reads the whole file for the sparkline.
public sealed class OutcomeLedger
- Inheritance
-
OutcomeLedger
- Inherited Members
Constructors
OutcomeLedger(string)
Create a ledger rooted at root (created on first append).
public OutcomeLedger(string root)
Parameters
rootstring
Fields
Json
JSON shape shared with the workbench reader: camelCase throughout — the
top-level keys are pinned via JsonPropertyNameAttribute, and
the naming policy carries camelCase into the nested assertion verdicts so
the whole line is uniform (passed / description, not the
PascalCase record defaults). The result enum serialises as a string so
<probe>.jsonl stays human-readable; case-insensitive reads
keep older lines loadable.
public static readonly JsonSerializerOptions Json
Field Value
Methods
Append(string, ProbeOutcome)
Append one outcome as a JSON line (creates the root + file on demand).
public void Append(string probeName, ProbeOutcome outcome)
Parameters
probeNamestringoutcomeProbeOutcome
LastOutcome(string)
The last recorded outcome for a probe, or null when it has never
run (no file / empty file). Tolerant of a trailing partial line — scans
backward for the last parseable row.
public ProbeOutcome? LastOutcome(string probeName)
Parameters
probeNamestring
Returns
ListProbeNames()
Probe names present under the ledger root — the *.jsonl file
stems, sorted case-insensitively. These are the sanitised
names (see PathFor(string)); the workbench surface lists and
re-queries by exactly these stems, so the round-trip stays lossless
even when the original probe name carried characters the sanitiser
folded away. Empty when the root doesn't exist yet (no probe ever ran).
public IReadOnlyList<string> ListProbeNames()
Returns
PathFor(string)
Absolute path of a probe's ledger file.
public string PathFor(string probeName)
Parameters
probeNamestring
Returns
ReadOutcomes(string, int)
A probe's recorded outcomes in ledger order (oldest first), skipping
corrupt / partially-written lines. maxRows > 0
keeps only the newest rows — the tail the sparkline + outcome table
render. Empty when the probe has never run.
public IReadOnlyList<ProbeOutcome> ReadOutcomes(string probeName, int maxRows = 0)