Repository navigation
feat(board): publish state.json cockpit feed + transition-only ntfy alert (PyAutoBrain#416) - #238
Merged
Merged
Conversation
… push alert PyAutoBrain#416 PR 2 (Heart side): - dashboard.to_state / --state: contract-v1 cockpit feed projected from the same Board as every other surface; ts normalised to ISO-8601 Z; missing snapshot or verdict yields a valid grey feed, never a default green. - heart/alert.py: compare the previously published state.json with the new one and POST one ntfy message only when the status changed; unknown previous never alerts; never raises, always exits 0. - heart-health.yml: render _site/state.json, validate it with the Brain's board/_state.py, push the transition alert (HEART_NTFY_URL secret). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…irewall) PyAutoBrain#416: replace tenant literals (org, library name, Pages host) in tests/test_alert.py and tests/test_dashboard.py with example.org / SomeLib. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Organ cockpit phase 1, PR 2 of 2 (PyAutoBrain#416, after PyAutoBrain#417): the Heart publishes the shared
state.jsoncockpit feed next to itsbadge.json/board.json, validates it in the board workflow against the Brain contract (PyAutoBrain/board/_state.py, checked out in the job already), and sends a transition-only push alert through ntfy when the readiness status changes (GREEN→RED, RED→GREEN, …). No alert on an unchanged status and none on the first run, since there is no previously published feed to compare with. The existing[heart-health]issue channel is untouched.The previous status is read from the last published Pages feed (
curl …/PyAutoHeart/state.json), so no new state is persisted anywhere.HEART_NTFY_URL(already set as a repo secret) points at a private ntfy topic; when unset the step prints a notice and skips.API Changes
heart/dashboard.py:to_state(board),grey_state(),fmt == "state"and a--stateCLI flag (no-snapshot fallback emits a valid grey feed, exit 0).heart/alert.py:transition(previous, new),render_message(kind, state),notify(url, …)and the CLIpython -m heart.alert --previous prev.json --current state.json [--url](always exit 0)..github/workflows/heart-health.yml: render_site/state.json; "Validate the cockpit feed against the Brain contract" (fails the job on drift); "Push a transition alert" before the Pages upload.See full details below.
Test Plan
pytest tests/— 1063 passed (test_alert.py new; 8 newto_statetests in test_dashboard.py)state: okheart-healthrun publishesstate.json(validate step green) and sends nothing (first run); the first later status change sends exactly one pushFull API Changes (for automation & release notes)
Added
heart/dashboard.py—STATE_SCHEMA_VERSION,STATE_STATUSES,_iso_z(board.ts → whole-second…Z, naive treated as UTC),_clip(160 chars),grey_state(),to_state(board)(verdict → status, unknown → grey; first red/yellow/stale reason or a "clear" line with the score → headline; blockers → items withrun_url/repo_url+prompt, stale blockers → info; flat stale reasons only when no stale blocker exists),fmt="state",--stateheart/alert.py—transition(None/unknown previous or unknown new → None; stale↔green counts),render_message(TitleHeart: GREEN -> RED— headers must be latin-1 — priority 5 for →red else 3, tagsheart,<status>),notify/_post(stdlib urllib, never raises), CLItests/test_alert.pyRemoved
Migration
Heart RED override (development only)
Heart readiness is RED (score 5, snapshot 2026-09-26T11:02:36+00:00). Verbatim reason strings:
PyAutoNerves: 1 commit(s) behind originPyAutoFit: 2 commit(s) behind originrelease validation FAILED (stage integrate)The first two are local-checkout staleness (fast-forwarded this session); the third is the pre-existing release-integrate failure, unrelated to this diff (dashboard/alert/workflow only). Branch gates passed as listed above.
Human authorization (live, this session, 2026-09-26, for PyAutoBrain#416, covering both PRs of the task): "ok merge the pr and contonue"
Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code