Skip to content

Add cluster reports tab via backplane API#325

Merged
clcollins merged 2 commits into
mainfrom
srepd/316-cluster-reports
Jun 10, 2026
Merged

Add cluster reports tab via backplane API#325
clcollins merged 2 commits into
mainfrom
srepd/316-cluster-reports

Conversation

@clcollins

Copy link
Copy Markdown
Owner

Summary

  • Adds a new Reports tab (tab 6) to display CORA cluster diagnostic reports fetched from the backplane API
  • New pkg/backplane/ package with direct HTTP client — no backplane-cli dependency
  • Reads ~/.config/backplane/config.json for proxy config, resolves backplane URL from OCM environment metadata
  • Graceful degradation when backplane is not configured

Closes #316

Details

New package: pkg/backplane/

  • backplane.go — types (ReportSummary, Report) and BackplaneClient interface
  • config.go — reads ~/.config/backplane/config.json (proxy-url, govcloud); accepts empty URL (resolved from OCM)
  • client.go — HTTP client with Bearer auth from OCM access token, proxy support
  • mock.go — mock client for dev mode with fixture loading from testdata/fixtures/clusterreports.json

OCMClient interface additions:

  • GetAccessToken() (string, error) — extracts OCM access token via conn.Tokens() for Bearer auth
  • GetBackplaneURL() (string, error) — resolves backplane API URL from OCM environment metadata

TUI integration:

  • New tabReports (tab 6) with renderClusterReportsTab()
  • Phase 2 enrichment dispatches getClusterReports() after cluster info resolves
  • clusterReportsMsg handler caches results per cluster
  • Deferred backplane client creation when OCM auth completes asynchronously
  • Tab shows "Backplane not enabled; ensure your ~/.config/backplane/config.json exists and is readable..." when unconfigured

Test coverage: 92.1% on pkg/backplane/

Test plan

  • make test-all passes (fmt, vet, lint, test, race)
  • Dev mode (srepd --dev) shows Reports tab with fixture data
  • Live mode with backplane config shows real cluster reports
  • Live mode without backplane config shows "Backplane not enabled..." message
  • Async OCM auth flow creates backplane client after browser auth completes
  • Tab bar shows correct report count per incident

Created with assistance from Claude 🤖 [email protected]

clcollins added 2 commits June 9, 2026 14:46
Add a new "Reports" tab (tab 6) to display CORA cluster diagnostic
reports fetched from the backplane API. Uses direct HTTP calls with
OCM Bearer auth instead of importing backplane-cli dependencies.

- New pkg/backplane/ package: config loader, HTTP client, mock, types
- Reads ~/.config/backplane/config.json for proxy config
- Resolves backplane URL from OCM environment metadata when config
  url field is empty (standard setup)
- Adds GetAccessToken() and GetBackplaneURL() to OCMClient interface
- Phase 2 enrichment: dispatches report fetch after cluster info loads
- Graceful degradation: shows "Backplane not enabled" if no config
- Deferred client creation for async OCM auth flow
- 92% test coverage on backplane package

Created with assistance from Claude 🤖 <[email protected]>

Signed-off-by: Christopher Collins <[email protected]>
Add plan doc for #316 and update README to document the new Reports
tab and backplane integration.

Created with assistance from Claude 🤖 <[email protected]>

Signed-off-by: Christopher Collins <[email protected]>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.74797% with 131 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.60%. Comparing base (366d7ec) to head (42c93fe).

Files with missing lines Patch % Lines
pkg/tui/views.go 6.06% 30 Missing and 1 partial ⚠️
cmd/root.go 0.00% 28 Missing ⚠️
pkg/tui/tui.go 3.57% 25 Missing and 2 partials ⚠️
pkg/ocm/client.go 0.00% 14 Missing ⚠️
pkg/backplane/client.go 86.36% 5 Missing and 4 partials ⚠️
pkg/tui/ocm_enrichment.go 0.00% 8 Missing ⚠️
pkg/ocm/mock.go 0.00% 4 Missing ⚠️
pkg/backplane/mock.go 92.10% 2 Missing and 1 partial ⚠️
pkg/tui/model.go 50.00% 3 Missing ⚠️
cmd/config.go 0.00% 2 Missing ⚠️
... and 1 more

❌ Your patch status has failed because the patch coverage (46.74%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #325      +/-   ##
==========================================
- Coverage   68.30%   67.60%   -0.71%     
==========================================
  Files          46       49       +3     
  Lines        7323     7568     +245     
==========================================
+ Hits         5002     5116     +114     
- Misses       1988     2110     +122     
- Partials      333      342       +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@clcollins clcollins merged commit c3a149c into main Jun 10, 2026
10 checks passed
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.

Research Backplane API for cluster report retrieval (CORA integration)

2 participants