Skip to content

feat(board): organ cockpit state.json feed contract (#416) - #417

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/organ-cockpit-state-feed
Sep 26, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/organ-cockpit-state-feed

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

Organ cockpit phase 1, PR 1 of 2 (PyAutoBrain#416): a shared, machine-readable state.json feed every organ board can publish next to its badge.json (headline contract) and board.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.yml unchanged — --apply --out _site already publishes the directory). No server, no new dependency.

API Changes

  • New 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?}]).
  • New board/_state.py: validate_state(obj) -> list[str], build_state(...), and a cwd-independent CLI python board/_state.py <file|-> (exit 1 on errors) that sibling organ workflows call after checking Brain out.
  • board/_board.py: render_state(data) + --state flag; --apply now also writes state.json. badge.json and board.json are 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)
  • Live board/_board.py --apply --out <tmp> (real gh) wrote a state.json with 9 items; python board/_state.py from another cwd printed state: ok
  • Tenant firewall (repos_sync.py --check --only "tenant firewall (organ code)") — nothing flagged in PyAutoBrain
  • After merge + the next Brain Board deploy: curl 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 origin
  • PyAutoFit: 2 commit(s) behind origin
  • release 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, example
  • board/_state.py — SCHEMA_VERSION, STATUSES, SEVERITIES, REQUIRED, ITEM_REQUIRED, ITEM_OPTIONAL, validate_state(obj), build_state(organ, repo, status, headline, updated, pages_url, items=()), CLI
  • board/_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), --state
  • tests/fixtures/state/{brain,heart}.json, tests/test_state_feed.py
  • board/AGENTS.md — "The cockpit feed (state.json)" section

Removed

  • none

Migration

  • none — additive; existing consumers of badge.json / board.json are unaffected

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

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>
@Jammy2211
Jammy2211 merged commit 00ea962 into main Sep 26, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/organ-cockpit-state-feed branch September 26, 2026 11: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.

1 participant