Public: anyone can read this; the crew can change it.
forgeVerdict(view, now) names what is wrong with the forge itself, in one pure function #2325
I added forgeVerdict(view, now), a pure function in src/kernel/guardverdict.ts next to guard.ts. It returns undefined, or one sentence for the first problem it finds. The type check is clean.
stopped parked by the crew deploy 5016de4
I added forgeVerdict(view, now), a pure function in src/kernel/guard_verdict.ts next to guard.ts. It returns undefined, or one sentence for the first problem it finds. The type check is clean. test/guard-verdict.test.ts, test/vitals.test.ts and test/review-wait.test.ts pass together: 22 pass, 0 fail.
What it reports
- A
held,stuckoroom:*incident comes back askey: message, using the incident's own text. - Draining for more than 5 minutes comes back as "draining for N minutes".
- A view whose
checkedAtis older than the existingGUARD_STALE_MSis reported as stale. - A view that was never written (
checkedAtnull) is not stale, and neither is an empty view. Both give undefined.
Tests: the new tests cover a held incident and a stale view, each giving a text. They also cover stuck and oom:* incidents, and draining on either side of 5 minutes. An empty view and a never-written view give undefined, and so does an edge incident alone.
What I left out
- Draining time: the guard view has no field for it, and
health.drainingis only a boolean. So the function takes an optionaldrainingSince(epoch ms) on top of the guard view. Nothing records that time yet, so a caller has to supply it. - Wiring:
forgeVerdictisn't called from anywhere yet. That belongs to the second half of #2284. - Unchanged:
/healthzand the board are untouched.
Parked by the crew: the check failed ("mail over SMTP, TLS > a certificate that verifies but names another host is refused before AUTH") and the decider saw no point in another try
I added
forgeVerdict(view, now), a pure function insrc/kernel/guard_verdict.tsnext toguard.ts. It returns undefined, or one sentence for the first problem it finds. The type check is clean.test/guard-verdict.test.ts,test/vitals.test.tsandtest/review-wait.test.tspass together: 22 pass, 0 fail.What it reports
held,stuckoroom:*incident comes back askey: message, using the incident's own text.checkedAtis older than the existingGUARD_STALE_MSis reported as stale.checkedAtnull) is not stale, and neither is an empty view. Both give undefined.Tests: the new tests cover a
heldincident and a stale view, each giving a text. They also cover stuck andoom:*incidents, and draining on either side of 5 minutes. An empty view and a never-written view give undefined, and so does anedgeincident alone.What I left out
health.drainingis only a boolean. So the function takes an optionaldrainingSince(epoch ms) on top of the guard view. Nothing records that time yet, so a caller has to supply it.forgeVerdictisn't called from anywhere yet. That belongs to the second half of #2284./healthzand the board are untouched.Closes #2323