fix(links): report Kafka probe failures as degraded, not unavailable

TY
1d ago
+319-22

Summary

Addresses maintainer feedback on #721 (supersedes the closed PR).

  • Keeps calculateLinkReadiness as the single HTTP status policy: Kafka down with ClickHouse up stays HTTP 200 degraded.
  • Maps Redpanda to error when the health probe leaves the producer in idle but didKafkaConnectFail() is true (fixes false ok readiness).
  • No blanket 503 short-circuit on Kafka connect failure.

Linked issue

Fixes #719

Test plan

  • bun test apps/links/src/lib/health.test.ts (6 pass)

AI disclosure

AI-assisted implementation; human-reviewed against izadoesdev review on #721.


Summary by cubic

Fixes the links service health check so Kafka failures report degraded instead of unavailable, and no longer reports false ok readiness after a connect failure.

  • Kafka down with ClickHouse up now returns HTTP 200 degraded via calculateLinkReadiness, replacing the previous 503 short-circuit.
  • A failed Kafka connect now maps Redpanda to error even when the producer state is idle, fixing the false ok.
  • refreshProducerConnection rejects loudly on failure and records a kafka_health_connect_failed attribute.
  • sendLinkVisit keeps falling back to ClickHouse when Kafka is unreachable, and disconnectProducer no longer fails if a pending connection dies during shutdown.
  • Redpanda SSL is now disabled when REDPANDA_SSL or REDPANDA_SSL_ENABLED is set to false (previously always on).