diff --git a/internal/cli/doctor.go b/internal/cli/doctor.go index 4206930..33134e5 100644 --- a/internal/cli/doctor.go +++ b/internal/cli/doctor.go @@ -134,8 +134,19 @@ func runDoctor(cmd *cobra.Command) []docker.Check { }) } else { v, _ := db.SchemaVersion() - db.Close() checks = append(checks, docker.Check{Name: "state ledger", Status: docker.StatusOK, Detail: fmt.Sprintf("schema v%d @ %s", v, ctxName)}) + // Shared-service ledger summary (informational): instances + total refs. + shared, _ := db.ListSharedServices() + totalRefs := 0 + for _, s := range shared { + n, _ := db.RefCount(s.Name) + totalRefs += n + } + db.Close() + checks = append(checks, docker.Check{ + Name: "shared services", Status: docker.StatusOK, + Detail: fmt.Sprintf("%d instance(s), %d ref(s)", len(shared), totalRefs), + }) } // DNS entries for *.localhost (spec 05) — best-effort, only when the current diff --git a/internal/cli/gc_test.go b/internal/cli/gc_test.go index ca7c4c4..bb728a8 100644 --- a/internal/cli/gc_test.go +++ b/internal/cli/gc_test.go @@ -59,3 +59,15 @@ func TestDoctorIncludesTrustProbe(t *testing.T) { t.Errorf("doctor --json missing the trust probe:\n%s", out.String()) } } + +func TestDoctorIncludesSharedProbe(t *testing.T) { + var out strings.Builder + root := NewRootCmd(Options{}) + root.SetArgs([]string{"doctor", "--json"}) + root.SetOut(&out) + root.SetErr(&out) + _ = root.Execute() + if !strings.Contains(out.String(), `"shared services"`) { + t.Errorf("doctor --json missing the shared-services probe:\n%s", out.String()) + } +}