Skip to content

refactor(health): extract internal/health; webui drops tui import (#1497 partial 3.3)#1519

Merged
nextlevelshit merged 1 commit into
mainfrom
refactor/1497-health-package-extract
Apr 28, 2026
Merged

refactor(health): extract internal/health; webui drops tui import (#1497 partial 3.3)#1519
nextlevelshit merged 1 commit into
mainfrom
refactor/1497-health-package-extract

Conversation

@nextlevelshit
Copy link
Copy Markdown
Collaborator

Summary

  • New internal/health package owns CheckStatus, DataProvider, DefaultDataProvider, status enum, check helpers
  • internal/webui/handlers_health.go imports internal/health instead of internal/tui
  • internal/tui/health_provider.go reduced to 36 LOC alias shim — preserves type identity for tui.HealthCheckResultMsg == health.CheckResult so bubbletea message dispatch unaffected

Direction reversed (verified)

$ go list -deps github.com/recinq/wave/internal/webui | grep "internal/tui"
(empty)

Symbols moved

Old (tui) New (health)
HealthCheckStatus health.CheckStatus
HealthCheckOK/Warn/Err/Checking health.StatusOK/Warn/Err/Checking
HealthCheckResultMsg health.CheckResult
HealthDataProvider health.DataProvider
DefaultHealthDataProvider health.DefaultDataProvider
NewDefaultHealthDataProvider health.NewDefaultDataProvider
9 check* methods methods on *DefaultDataProvider

Validation

  • go build ./... + go vet ./... clean
  • go test -race ./internal/health/... ok
  • go test -race ./internal/tui/... ok (5.2s)
  • go test -race ./internal/webui/... ok (79.9s; includes TestHealthStatusString, TestHandleAPIHealth, TestHandleHealthPage)

Out of scope (deferred)

  • 3.4 onboarding→tui (in flight, separate PR)
  • health_provider.go 569→36 LOC delete shim once tui consumers migrate fully — separate ticket

Test plan

  • CI green
  • wave serve /health endpoint renders
  • wave tui health panel unchanged from user perspective

Partial of #1497 (subset 3.3). Parent: #1494.

- New internal/health package owns CheckStatus, CheckResult,
  DataProvider interface, and DefaultDataProvider with all 9
  built-in checks. Status enum: StatusOK/Warn/Err/Checking.
- internal/webui/handlers_health.go imports internal/health
  instead of internal/tui. Cross-presentation coupling removed.
- internal/tui/health_provider.go is now a thin shim of type
  aliases (HealthCheckStatus, HealthCheckResultMsg,
  HealthDataProvider, DefaultHealthDataProvider) and a
  NewDefaultHealthDataProvider constructor that delegates to the
  health package. All existing TUI consumers (health_list.go,
  health_detail.go, content_health.go, app.go, tests) keep their
  identifiers unchanged via aliasing.
- Verified: go list -deps internal/webui no longer contains
  internal/tui.

Partial of #1497 (subset 3.3).
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