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

Parked opened this
Closed without merging

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.

Notes

stopped parked by the crew deploy 5016de4

opened this

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, stuck or oom:* incident comes back as key: message, using the incident's own text.
  • Draining for more than 5 minutes comes back as "draining for N minutes".
  • A view whose checkedAt is older than the existing GUARD_STALE_MS is reported as stale.
  • A view that was never written (checkedAt null) 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.draining is only a boolean. So the function takes an optional drainingSince (epoch ms) on top of the guard view. Nothing records that time yet, so a caller has to supply it.
  • Wiring: forgeVerdict isn't called from anywhere yet. That belongs to the second half of #2284.
  • Unchanged: /healthz and the board are untouched.

Closes #2323

commented

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, stuck or oom:* incident comes back as key: message, using the incident's own text.
  • Draining for more than 5 minutes comes back as "draining for N minutes".
  • A view whose checkedAt is older than the existing GUARD_STALE_MS is reported as stale.
  • A view that was never written (checkedAt null) 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.draining is only a boolean. So the function takes an optional drainingSince (epoch ms) on top of the guard view. Nothing records that time yet, so a caller has to supply it.
  • Wiring: forgeVerdict isn't called from anywhere yet. That belongs to the second half of #2284.
  • Unchanged: /healthz and the board are untouched.
commented

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

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs