Skip to content
This repository was archived by the owner on May 26, 2026. It is now read-only.

feat(KR-P2-CONTROL-PANEL): kora_control runtime-observed-state viewer against stub endpoint#37

Merged
rafe-walker merged 1 commit into
mainfrom
feat/kora-KR-P2-CONTROL-PANEL
May 21, 2026
Merged

feat(KR-P2-CONTROL-PANEL): kora_control runtime-observed-state viewer against stub endpoint#37
rafe-walker merged 1 commit into
mainfrom
feat/kora-KR-P2-CONTROL-PANEL

Conversation

@rafe-walker

Copy link
Copy Markdown
Owner

Summary

Read-only Kora-runtime-local panel showing STOP-KORA commands as the runtime has observed them. Pairs with KR-P2-J (KoraControlReader + STOP-KORA handler, CC#1 — in flight) and goes in ahead of the runtime wire-in so the UI is ready when J lands.

Two complementary panels (by design)

  • Cockpit-BFF panel (IsoKron-team's lane) = command issuance — write surface
  • This Kora-runtime-local panel = runtime observation — operators confirm Kora saw + acked + enforced

Endpoint (kora_cli/web_server.py)

GET /api/kora-control/observed-state — 3 lifecycle-grouped lists with stub: true:

section semantics
active open commands (in-flight: created/visible/observed/acknowledged/enforcing)
recently_enforced last N enforced
history older terminal-state commands (enforced/superseded/expired/failed/escalated)

No POST/PUT/DELETE — the runtime advances lifecycle on its own based on KR-P2-J's reader + handler. Nothing for an operator to do from here.

Frontend (web/)

  • pages/KoraControlPage.tsx
    • Active: prominent cards, pulsing live indicator, level/kind badges color-toned by STOP-KORA tier (L0 outline, L1 warning, L2+ destructive), GitHub-PR-checks-style horizontal timeline strip showing created → visible → observed → acked → enforced with check marks for reached steps, pulsing warning for the current step, and connector lines that turn green as progress advances. Terminal-but-non-success states (superseded/expired/failed/escalated) suppress the progression and render with destructive accent.
    • Recently enforced: same card layout, quiet styling, timeline collapsed by default (expandable per-card).
    • History: collapsible (default-collapsed). Table sorted created_at desc, truncated-reason with hover-full.
    • Multiple-active fallback: R4.1 "highest open level wins" — when multiple actives exist (shouldn't, but defensively), sort by level desc + sequence asc with a small note that the topmost card is the effective constraint.
  • lib/api.ts — typed KoraControlKind / KoraControlLifecycleState enums + KoraControlCommand + KoraControlObservedStateResponse
  • App.tsx/kora-control route + nav entry (OctagonAlert icon) between /operational-state and /sea-tickets

Flip-over plan

When KR-P2-J lands and KoraControlReader.get_all_observed_commands() -> ObservedKoraControlState exists, swap get_kora_control_observed_state body to project from that read and drop the stub flag. The page itself doesn't change — banner disappears the moment stub is gone.

Test plan

  • tests/kora_cli/test_web_server_kora_control.py — 8/8 green, covers all 7 §5 scenarios + contract guard (recently_enforced ⇒ enforced lifecycle with non-null enforced_at)
  • test_web_server_{sea_tickets,operational_state,cron_profiles,host_header,mcp,gateway_identity}.py — 57/57 still green (regression sanity, 65 total in suite)
  • npx tsc -b on web/ — clean
  • npx vite build on web/ — clean
  • §8 grep checks: STUB banner present, endpoint registered, zero write-side routes leaked
  • Manual smoke: navigate to /kora-control, verify STUB banner renders, verify Active card shows the timeline strip with created/visible/observed/acked checked + enforced unchecked + pulsing warning marker

Dependency notes

  • KR-P2-J (CC#1, in flight) wires KoraControlReader + STOP-KORA L1-5 handler
  • KoraControlReader.get_all_observed_commands() is the helper that flips this from stub to real (after J)

🤖 Generated with Claude Code

… against stub endpoint

Read-only diagnostic panel showing STOP-KORA commands as the runtime
has observed them: which commands are active (pre-enforced), which
were recently enforced, and a deeper history of terminal-state
commands. Pairs with CC#1's KR-P2-J (KoraControlReader + STOP-KORA
handler) but goes in ahead of the runtime wire-in — the data source
is a hardcoded sample-data stub at each lifecycle position with
``stub: True`` so the frontend renders a banner making it obvious to
operators that values are not real commands. When KR-P2-J lands and
``KoraControlReader.get_all_observed_commands()`` exists, the endpoint
body flips to a projection of that read; the page itself doesn't
change.

Command ISSUANCE happens cockpit-side (IsoKron-team's lane). The
Kora-runtime panel built here is observation-only — operators check
here to confirm the runtime saw + acked + enforced commands issued
from the cockpit. Two complementary panels by design.

Backend (kora_cli/web_server.py):
  GET /api/kora-control/observed-state — read-only stub returning 3
  lifecycle-grouped lists. No POST/PUT/DELETE — the runtime advances
  lifecycle on its own based on the reader + handler; there's nothing
  for an operator to do from here.

Frontend:
  - KoraControlPage.tsx — 3 sections by lifecycle position:
    * Active: prominent cards with pulsing live indicator, level/kind
      badges (color-toned by STOP-KORA tier), and a GitHub-PR-checks-
      style horizontal timeline strip showing created → visible →
      observed → acked → enforced with check marks for reached steps,
      pulsing warning for the current step, and connector lines that
      turn green as progress advances. Terminal-but-non-success states
      (superseded/expired/failed/escalated) suppress the timeline
      progression and render with destructive accent.
    * Recently enforced: same card layout, quiet styling, timeline
      collapsed by default (expandable per-card).
    * History: collapsible (default-collapsed). Table sorted
      created_at desc with truncated-reason + hover-full.
  - api.ts — typed KoraControlKind / KoraControlLifecycleState enums
    + KoraControlCommand + KoraControlObservedStateResponse so a
    future Python-side enum drift surfaces at compile time.
  - App.tsx — /kora-control route + nav entry (OctagonAlert icon)
    between /operational-state and /sea-tickets per spec §3.
  - Multiple-active fallback: R4.1 "highest open level wins" — when
    multiple actives exist (shouldn't, but defensively), sort by
    level desc + sequence asc with a small note that the topmost card
    is the effective constraint.

Tests: tests/kora_cli/test_web_server_kora_control.py — 8 tests
covering all 7 §5 scenarios plus a contract guard
(recently_enforced entries are always in ``enforced`` lifecycle with
non-null ``enforced_at``). 65/65 across full web_server test suite
pass. tsc -b + vite build clean.

§8 pre-push grep checks: STUB banner present, endpoint registered,
zero write-side routes leaked.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant