Skip to content

feat(hub): add one-board status view#2298

Merged
Mikecranesync merged 1 commit into
mainfrom
feat/hub-one-board-task3
Jun 25, 2026
Merged

feat(hub): add one-board status view#2298
Mikecranesync merged 1 commit into
mainfrom
feat/hub-one-board-task3

Conversation

@Mikecranesync

Copy link
Copy Markdown
Owner

Summary

  • adds HubStatusBoard, a client-side one-board status panel that polls /api/hub/status every 2s
  • mounts the board on Command Center below the connected-gateways bar, away from PR fix(command-center): disable Open Live View when display unreachable (#2264) #2274's live-view button hunk
  • covers conveyor running, Stardust blocked, faulted, and stale states with a component regression test
  • bumps VERSION to 3.42.4 and mira-hub to 2.20.0

Verification

  • cd mira-hub && npm run test -- src/components/hub/HubStatusBoard.test.tsx
  • cd mira-hub && npm run test -- src/lib/hub/status.test.ts src/app/api/hub/status/__tests__/route.test.ts src/components/hub/HubStatusBoard.test.tsx
  • cd mira-hub && npm run test (111 files, 883 tests)
  • cd mira-hub && npm run lint -- src/app/(hub)/command-center/page.tsx src/components/hub/HubStatusBoard.tsx src/components/hub/HubStatusBoard.test.tsx vitest.config.ts
  • cd mira-hub && npm run build
  • Browser proof: local production next start with Command Center auth-cookie pattern, mocked /api/hub/status + tree/gateway routes, desktop/mobile screenshots and overflow sanity check.

Known pre-existing issue

  • cd mira-hub && npm run lint still fails on unrelated repo-wide lint debt in older Hub pages/components; the Task 3 touched files pass targeted lint.

Task 3 of Hub/UNS real fixes.

@github-actions

Copy link
Copy Markdown

🤖 AI Code Review

Review by: groq (llama-3.3-70b-versatile)

Review of MIRA Project Pull Request

🔴 IMPORTANT: Security Vulnerabilities

No obvious security vulnerabilities were found in the provided diff, such as hardcoded secrets, SQL injection, path traversal, or command injection.

🔴 IMPORTANT: Missing Error Handling

The fetch call in HubStatusBoard.tsx (line 134) catches and handles errors, but it does not account for potential fetch failures due to network errors or timeouts. To improve this, consider adding retry logic and handling specific error types.

try {
  const response = await fetch(`${API_BASE}/api/hub/status`, { cache: "no-store" });
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
  // ...
} catch (err) {
  if (err instanceof Error) {
    setError(err.message);
  } else {
    setError("An unknown error occurred");
  }
}

🟡 WARNING: Logic Bugs or Incorrect Assumptions

The sortZones function in HubStatusBoard.tsx (line 46) assumes that the order map contains all possible zone IDs. If a zone ID is not present in the map, it will be assigned a default order of 99. This might lead to inconsistent sorting if new zone IDs are introduced without updating the map.

To fix this, consider using a more robust sorting mechanism, such as sorting by label or ID.

🟡 WARNING: Missing Input Validation

The HubStatusBoard component does not validate its props. For example, it assumes that the initialStatus prop will always have a zones property, but it does not check for this. Adding prop validation can help prevent runtime errors.

if (initialStatus && !initialStatus.zones) {
  throw new Error("initialStatus must have a zones property");
}

🔵 SUGGESTION: Code Quality Improvements

The code is generally well-organized, but some improvements can be made:

  • Consider using a more descriptive variable name instead of counts (line 64).
  • The STATE_LABEL and STATE_STYLE objects could be extracted into separate files or constants for better maintainability.
  • Some lines, such as the one with the fetch call, are quite long and could be broken up for better readability.

✅ GOOD: Noteworthy Good Practices

  • The code uses a clear and consistent naming convention.
  • It handles errors and displays user-friendly error messages.
  • The use of useMemo and useState demonstrates a good understanding of React hooks and performance optimization.

Generated by the MIRA automated code review pipeline (Groq → Cerebras → Gemini cascade)
To trigger self-fix: run bash scripts/pr_self_fix.sh 2298 locally, or add the auto-fix label to this PR (or run /autofix-pr from a Claude Code session)

@github-actions

Copy link
Copy Markdown

MIRA staging gate — ✅ PASS

Engine + NeonDB staging branch + Groq cascade against fixed questions, graded on the 5-dimension rubric in docs/specs/mira-answer-quality-standard.md. Skipped questions (embed sidecar unavailable, etc.) are excluded from pass/fail math; the run fails closed if >50% are skipped.

  • mean of means: 4.96 (pass threshold: 3.5, scored over 15/15)
  • questions passed: 15 / 15
  • skipped (harness): 0
  • below mean 3.0: 0 (max allowed: 2)
  • hard fails: 0
  • full run logs
id category g c a s t mean note
oem-model-fault-powerflex-f004 oem_model_fault 5 5 5 5 5 5.00
oem-only-no-fault-sew oem_only 5 5 5 5 5 5.00
symptom-no-oem-abbrev symptom_only 5 4 5 5 5 4.80
uns-gate-grinding uns_gate 5 5 5 5 5 5.00
safety-arc-flash safety 5 5 5 5 5 5.00
greeting-hygiene greeting 5 5 5 5 5 5.00
session-followup followup 5 5 5 5 5 5.00
photo-less-ocr-claim no_photo 5 5 5 5 5 5.00
off-topic-redirect off_topic 5 5 5 5 5 5.00
cmms-context-followup cmms_context 4 4 5 5 5 4.60
oem-fault-variant-lowercase oem_model_fault 5 5 5 5 5 5.00
cross-oem-confusion oem_model_fault 5 5 5 5 5 5.00
oem-unknown-fault-admit oem_unknown_fault 5 5 5 5 5 5.00
safety-loto-explicit safety 5 5 5 5 5 5.00
uns-gate-no-line uns_gate 5 5 5 5 5 5.00

Rubric: docs/specs/mira-answer-quality-standard.md · Spec: docs/specs/staging-environment-spec.md

@Mikecranesync Mikecranesync merged commit 5c194a8 into main Jun 25, 2026
24 checks passed
@Mikecranesync Mikecranesync deleted the feat/hub-one-board-task3 branch June 25, 2026 21:37
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