Repository navigation
feat(board): organ cockpit state.json feed contract (#416) - #417
Merged
Merged
Conversation
Add the v1 cockpit feed: board/state_schema.json documents the contract, board/_state.py enforces it (validate_state, build_state, and a stdlib CLI runnable from any cwd so sibling organ workflows can validate before publishing). The Brain board emits it via render_state (--state), and --apply now writes state.json beside badge.json; badge.json and board.json are unchanged. Status and headline mirror the badge; items compose the rows the board already renders (Heart blockers, failed/blocked/unreadable overnight runs, community waits, degraded legs) with their own prompts. 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 1 of 2 (PyAutoBrain#416): a shared, machine-readable
state.jsonfeed every organ board can publish next to itsbadge.json(headline contract) andboard.json(organ-specific detail). The cockpit page and phone client of later phases read only this feed. The contract and a stdlib validator live here; the Brain board emits it as the reference implementation. PR 2 (PyAutoHeart) makes the Heart emit and validate it and adds the transition-only push alert; it merges after this one because its workflow calls this validator from the checked-out Brain.Truth stays in GitHub: the feed is rendered by the existing Pages workflow (
brain_board.ymlunchanged —--apply --out _sitealready publishes the directory). No server, no new dependency.API Changes
board/state_schema.json: the v1 contract (schema_version, organ, repo, status ∈ {green,yellow,red,stale,grey}, headline, updated (ISO-8601 Z), pages_url, items[{severity ∈ {red,yellow,info}, text, url, prompt?}]).board/_state.py:validate_state(obj) -> list[str],build_state(...), and a cwd-independent CLIpython board/_state.py <file|->(exit 1 on errors) that sibling organ workflows call after checking Brain out.board/_board.py:render_state(data)+--stateflag;--applynow also writesstate.json.badge.jsonandboard.jsonare byte-for-byte unchanged.See full details below.
Test Plan
pytest tests/test_state_feed.py tests/test_board.py tests/test_board_degraded.py— 71 passed (23 new)board/_board.py --apply --out <tmp>(real gh) wrote astate.jsonwith 9 items;python board/_state.pyfrom another cwd printedstate: okrepos_sync.py --check --only "tenant firewall (organ code)") — nothing flagged in PyAutoBraincurl https://pyautolabs.github.io/PyAutoBrain/state.json | python board/_state.py -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 (both mains fast-forwarded in this session; they clear on the next vitals tick). The third is the pre-existing release-integrate failure, unrelated to board code (this PR touches
board/and its tests only). Branch gates passed: 71 tests, live render validates, tenant firewall OK.Human authorization (live, this session, 2026-09-26, for PyAutoBrain#416): "ok merge the pr and contonue"
Full API Changes (for automation & release notes)
Added
board/state_schema.json— documented contract with$comment, per-field notes,required,exampleboard/_state.py—SCHEMA_VERSION,STATUSES,SEVERITIES,REQUIRED,ITEM_REQUIRED,ITEM_OPTIONAL,validate_state(obj),build_state(organ, repo, status, headline, updated, pages_url, items=()), CLIboard/_board.py—STATE_STATUS(badge colour → status: red→red, orange→yellow, lightgrey→grey, brightgreen→green),STATE_ITEM_CAP = 20,_iso_generated,_state_items(Heart blockers → red/yellow with run_url/repo_url + prompt-or-command; failed overnight runs → red, gate-blocked → yellow, unreadable → info; community waits → yellow after 7 days else info; degraded legs → info),render_state(data),--statetests/fixtures/state/{brain,heart}.json,tests/test_state_feed.pyboard/AGENTS.md— "The cockpit feed (state.json)" sectionRemoved
Migration
badge.json/board.jsonare unaffectedGenerated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code