Skip to content

Health findings as events - #81

Merged
vxnsin merged 1 commit into
mainfrom
it-says-when-something-is-wrong
Sep 8, 2026
Merged

vxnsin merged 1 commit into
mainfrom
it-says-when-something-is-wrong

Conversation

@vxnsin

@vxnsin vxnsin commented Sep 8, 2026

Copy link
Copy Markdown
Owner

warden posts an event when a port changes hands, when a node goes quiet, when a ruleset is applied and when one rolls itself back. It said nothing at all when it noticed something was wrong — warden doctor knew the webhook had not arrived since Tuesday, that three rules had been sitting unapplied for two days, that this warden is reachable with no token, and it only said so if somebody typed the command.

health.worsened   firewall  3 rules changed since the last apply
health.recovered  firewall  nothing since the last apply
  • core/rounds.py — the checks doctor runs, on a timer inside warden serve, announcing a finding when it changes state.
  • Two new happenings in the health scope, with their own colour, icon and words in all four webhook shapes. Subject is which check it was, body carries the level and what it said.
  • Check now says which check it was, so one finding changing can be told from another one appearing.
  • health_watch (default on) and health_interval (default 600s, at least 60).

On change only. A channel told every ten minutes that three rules are still unapplied is a channel people mute within the week — the same reason port.renewed is not posted by default. A warn that becomes a fail is worth saying again; a note is not worth saying at all; and the first look after a start is quiet, because what a machine was already like is not news and a deploy that restarts four wardens should not be four messages.

It leaves the sockets alone. Walking every socket every ten minutes to say the same thing is a cost /metrics already refuses to pay, so examine(sweeping=False) counts registrations instead. warden doctor still checks the holders when a person asks.

16 tests in tests/test_health_events.py. README, Events and webhooks, and Configuration say it.

Closes #75

warden posts an event when a port changes hands, when a node goes quiet, when a
ruleset is applied and when one rolls itself back. It said nothing at all when
it noticed something was wrong - `warden doctor` knew the webhook had not
arrived since Tuesday and only said so if somebody typed the command. That is
backwards: the point of an event stream is not having to ask.

The checks doctor runs now happen on a timer inside `warden serve`, and a
finding that changes state is an event like any other. `health.worsened` and
`health.recovered`, subject being which check it was, body carrying the level
and the words it said.

On change only. A channel told every ten minutes that three rules are still
unapplied is a channel people mute within the week, which is why `port.renewed`
is not posted by default either. A `warn` that becomes a `fail` is worth saying
again, a `note` is not worth saying at all, and the first look after a start is
quiet - what a machine was already like is not news, and a deploy that restarts
four wardens should not be four messages.

It leaves the sockets alone. Walking every socket every ten minutes to say the
same thing is a cost `/metrics` already refuses to pay, so the timer counts
registrations and `warden doctor` still checks the holders when a person asks.

`health_watch` turns it off, `health_interval` is how far apart it looks, and a
check now says which one it was so one finding changing can be told from
another one appearing.

Closes #75
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: d348e855-7d92-4d60-8386-524f79f82c6b

📥 Commits

Reviewing files that changed from the base of the PR and between 2325b3f and 57ee01c.

📒 Files selected for processing (10)
  • README.md
  • src/warden/api.py
  • src/warden/core/config.py
  • src/warden/core/happenings.py
  • src/warden/core/health.py
  • src/warden/core/rounds.py
  • src/warden/core/webhooks.py
  • src/warden/models.py
  • tests/test_happenings.py
  • tests/test_health_events.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vxnsin
vxnsin merged commit 0ca0dc5 into main Sep 8, 2026
12 checks passed
@vxnsin
vxnsin deleted the it-says-when-something-is-wrong branch September 8, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

warden knows something is wrong and only says so if you ask

1 participant