Skip to content

feat(inbox): surface health check issues as inbox signals#2711

Merged
trunk-io[bot] merged 1 commit into
mainfrom
posthog-code/health-inbox-signals
Jul 21, 2026
Merged

feat(inbox): surface health check issues as inbox signals#2711
trunk-io[bot] merged 1 commit into
mainfrom
posthog-code/health-inbox-signals

Conversation

@rafaeelaudibert

@rafaeelaudibert rafaeelaudibert commented Jun 16, 2026

Copy link
Copy Markdown
Member

Problem

PostHog already detects instrumentation problems via health checks — missing events, reverse-proxy gaps, outdated SDKs, ingestion warnings, broken data-warehouse models — and surfaces them in the Health UI. PostHog/posthog#61955 wired those into the Signals inbox on the Cloud backend. This brings the same source surface to the Code app.

This is a from-scratch reimplementation (the original version of this PR predated the EXTERNAL_INBOX_SOURCES registry and the ~30 warehouse sources, so it no longer applied).

Changes

health_checks / health_issue signal source

Added everywhere source products surface, not gated behind a feature flag — per-team enablement is handled by SignalSourceConfig on the Cloud backend, exactly like the other sources.

  • Contracts: health_checks in SourceProduct / ToggleableSourceProduct (@posthog/shared), in SignalSourceConfig with the new health_issue source type (@posthog/api-client), and in the SignalSourceConnected analytics event.
  • Toggle plumbing: wired as a plain PostHog-data source (no warehouse setup) through signalSourceService (core) and useSignalSourceToggles (UI), mapping to source_type: "health_issue".
  • UI: a "Health checks" card in the PostHog data column of SignalSourceToggles, an entry in the responder roster (responderAgentMeta), the source filter dropdown, SOURCE_PRODUCT_META, and a "Health checks · Issue" source line on detail signal cards.
  • Mobile: filter-sheet option, filter-store union entry, and signal-card icon/source line.
  • Icon: FirstAidIcon — phosphor's medical plus/cross — matching the IconHeartPlus cross used in the Cloud PR (the earlier revision used HeartbeatIcon), colored --crimson-9 to echo Cloud's text-danger styling.

Source-vocabulary dedup (new in this revision)

The ~40-entry source-product union previously existed in five hand-synced copies. Now EXTERNAL_INBOX_SOURCES in inbox-types.ts is the single place warehouse products are named:

  • ExternalInboxSourceProduct is derived from the registry literals (as const satisfies); SourceProduct is that plus the six PostHog-native products (alphabetical); ToggleableSourceProduct is just Exclude<SourceProduct, "llm_analytics" | "signals_scout">.
  • A shared SourceType (PostHog-native types + SignalRecordKind) replaces the hand-written source_type union.
  • The @posthog/api-client SignalSourceConfig unions and the analytics SignalSourceConnectedProperties union are replaced with the shared types, and now-unneeded as casts fell away.
  • Registry entries are alphabetized within their category groups (issue trackers, error tracking, support, …). Note: registry order drives the toggle-card order in the UI, so cards reorder slightly within each group (e.g. Gitea now before GitHub).
  • ExternalInboxSource.requiredTables is now readonly string[] (required by the as const registry); schemasPayload in DataSourceSetup was adjusted accordingly.

Tests

  • signalSourceService.test.ts: computeSourceValues enables health_checks from its config, and toggleSource creates a health_issue config.

Testing

  • pnpm --filter @posthog/shared --filter @posthog/api-client --filter @posthog/core --filter @posthog/ui typecheck ✅ (full repo pnpm typecheck also passes via the pre-commit hook)
  • pnpm --filter @posthog/core test — 2477 passing, including the new cases ✅
  • Mobile tsc --noEmit — no errors in features/inbox
  • biome check on all touched files + biome lint packages/core (zero noRestrictedImports) ✅

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

React Doctor found 1 issue in 1 file · 1 warning.

1 warning

src/features/inbox/components/SignalSourceToggles.tsx

Reviewed by React Doctor for commit dd4ad5d.

@greptile-apps

greptile-apps Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (1)

  1. packages/core/src/inbox/signalSourceService.test.ts, line 59-69 (link)

    P2 New test duplicates existing coverage; prefer parameterised form

    The computeSourceValues test added for health_checks (lines 64–69) exercises the exact same code path as "enables a non-error source when any config is enabled" (lines 59–62). Both verify that configs.some(c => c.source_product === product && c.enabled) returns true — the only difference is the input. Per the project's preference for parameterised tests, both cases (and the analogous toggleSource test below) belong in a single it.each block so future sources get a one-line addition rather than a new duplicate test.

    Context Used: Do not attempt to comment on incorrect alphabetica... (source)

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: packages/core/src/inbox/signalSourceService.test.ts
    Line: 59-69
    
    Comment:
    **New test duplicates existing coverage; prefer parameterised form**
    
    The `computeSourceValues` test added for `health_checks` (lines 64–69) exercises the exact same code path as "enables a non-error source when any config is enabled" (lines 59–62). Both verify that `configs.some(c => c.source_product === product && c.enabled)` returns `true` — the only difference is the input. Per the project's preference for parameterised tests, both cases (and the analogous `toggleSource` test below) belong in a single `it.each` block so future sources get a one-line addition rather than a new duplicate test.
    
    **Context Used:** Do not attempt to comment on incorrect alphabetica... ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))
    
    How can I resolve this? If you propose a fix, please make it concise.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/core/src/inbox/signalSourceService.test.ts:59-69
**New test duplicates existing coverage; prefer parameterised form**

The `computeSourceValues` test added for `health_checks` (lines 64–69) exercises the exact same code path as "enables a non-error source when any config is enabled" (lines 59–62). Both verify that `configs.some(c => c.source_product === product && c.enabled)` returns `true` — the only difference is the input. Per the project's preference for parameterised tests, both cases (and the analogous `toggleSource` test below) belong in a single `it.each` block so future sources get a one-line addition rather than a new duplicate test.

Reviews (1): Last reviewed commit: "feat(inbox): surface health check issues..." | Re-trigger Greptile

@rafaeelaudibert
rafaeelaudibert requested review from a team and sortafreel June 16, 2026 20:54
@rafaeelaudibert
rafaeelaudibert force-pushed the posthog-code/health-inbox-signals branch from 7e1b9c5 to f855ab4 Compare June 25, 2026 22:55

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sortafreel sortafreel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Adds the health_checks / health_issue signal source everywhere source
products surface, mirroring PostHog/posthog#61955 on the Cloud backend:
the sources toggle grid (PostHog data column), responder roster, filter
options, signal cards, and the mobile inbox — using the FirstAid
plus-cross icon to match the Cloud health icon.

Also dedupes the source-product vocabulary: EXTERNAL_INBOX_SOURCES is
now the single place warehouse products are named (SourceProduct,
ToggleableSourceProduct, and the api-client/analytics unions derive
from it), a shared SourceType replaces the hand-written source_type
union, and registry entries are alphabetized within their category
groups.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@rafaeelaudibert
rafaeelaudibert force-pushed the posthog-code/health-inbox-signals branch from f855ab4 to dd4ad5d Compare July 21, 2026 19:11
@rafaeelaudibert
rafaeelaudibert dismissed sortafreel’s stale review July 21, 2026 19:25

I feel like he really wanted to approve this

@rafaeelaudibert

Copy link
Copy Markdown
Member Author

/trunk merge

@trunk-io

trunk-io Bot commented Jul 21, 2026

Copy link
Copy Markdown

😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details.

@trunk-io
trunk-io Bot merged commit 7265430 into main Jul 21, 2026
33 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/health-inbox-signals branch July 21, 2026 19:42
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.

3 participants