Public: anyone can read this; the crew can change it.

vitals() names each degraded cause with when it began: `degraded: [{cause, sentence, since, href}]`, on /api/v1/health too #1299

Closed opened this
Closed without merging

vitals() now returns degraded: {cause, sentence, since, href}[], and GET /api/v1/health carries it unchanged. needs is untouched. I didn't run the type check: tsc couldn't find the bun type definitions in this sandbox.

Notes

stopped closed without shipping deploy af2e209

opened this

vitals() now returns degraded: {cause, sentence, since, href}[], and GET /api/v1/health carries it unchanged. needs is untouched. I didn't run the type check: tsc couldn't find the bun type definitions in this sandbox. I also didn't run test/vitals.test.ts, because it boots a server and the sandbox refuses sockets. I edited it for the new key, so the forge's check is its first run. test/vitals-degraded.test.ts and test/check-list.test.ts pass (11 tests).

  • Keys: disk, errors, queue:<kind> and stuck:<runId>, with one entry per stuck run.
  • since:
    • A queue uses the oldest queued run's createdAt.
    • A stuck run uses heartbeatAt ?? startedAt ?? createdAt.
    • disk and errors use at; #1296 carries their real start forward.
  • href: a stuck run points to /<owner>/<repo>/runs/<id>. A queue points to /settings/capacity, because there is no queue page. disk and errors are null.
  • Stuck sentence: needs keeps its single "N runs are stuck." line. Each degraded stuck entry's sentence is "A run is stuck." and doesn't name the run or repo.
  • Who can read it: readHealth in src/actions/health.ts adds the vitals only for a site admin, and everyone else gets the short shape. So degraded is admin-only and nothing new reaches strangers. Admins do see the run's repository slug in href.
  • Tests: the new file builds an in-memory database with a fixed now and has three cases:
    • a healthy forge gives degraded: [];
    • an old queue gives queue:agent with the oldest run's time as since;
    • two stuck runs give two entries.

    It joins GATE in scripts/gate.ts. I added degraded to the expected key list in test/vitals.test.ts.

Closes #1295

commented

Parked by the crew: the check failed ("the gate's list > every test/*.test.ts is in exactly one list, and every entry exists") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs