Skip to content

robust health check detection#8

Merged
jaredLunde merged 4 commits into
mainfrom
jared/healthz
Apr 16, 2026
Merged

robust health check detection#8
jaredLunde merged 4 commits into
mainfrom
jared/healthz

Conversation

@jaredLunde
Copy link
Copy Markdown
Contributor

  • Add Healthcheck enum (Path/Command) to replace Option<String>,
    making the semantic distinction between HTTP paths and shell commands
    explicit in the type system
  • Fix Dockerfile CMD-SHELL parsing bug where find("CMD") matched
    inside "CMD-SHELL", producing garbled output like -SHELL curl ...
  • Parse [[http_service.checks]] in fly.toml (was silently ignored)
  • Parse healthcheck.path in Heroku app.json (was silently ignored)
  • Add Phoenix health check inference (/health — ships in generated
    router since Phoenix 1.7)
  • Update all existing health check assertions to use typed enum variants

jaredLunde and others added 4 commits April 15, 2026 19:20
- Add `Healthcheck` enum (`Path`/`Command`) to replace `Option<String>`,
  making the semantic distinction between HTTP paths and shell commands
  explicit in the type system
- Fix Dockerfile `CMD-SHELL` parsing bug where `find("CMD")` matched
  inside `"CMD-SHELL"`, producing garbled output like `-SHELL curl ...`
- Parse `[[http_service.checks]]` in fly.toml (was silently ignored)
- Parse `healthcheck.path` in Heroku app.json (was silently ignored)
- Add Phoenix health check inference (`/health` — ships in generated
  router since Phoenix 1.7)
- Update all existing health check assertions to use typed enum variants

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add HealthCheckSignal that detects health endpoints by finding a known
health check library import AND a health path string in the same file.
Both conditions must hold — co-occurrence in one file is near-certain
evidence the endpoint exists at that path.

Covers ~80% of real-world usage across Go, Node/TS, Python, and PHP:
- Go: hellofresh/health-go, heptiolabs/healthcheck, alexliesenfeld/health,
  dimiro1/health, etherlabsio/healthcheck, InVisionApp/go-health,
  GlobalWebIndex/healthcheck, gofiber healthcheck middleware
- Node/TS: @nestjs/terminus, @godaddy/terminus, express-healthcheck,
  healthcheck-middleware, fastify-healthcheck, lightship
- Python: django-health-check (health_check.urls include pattern),
  py-healthcheck, fastapi-healthchecks, fastapi-health
- PHP: pragmarx/health, liip/monitor-bundle, spatie/laravel-health

Also adds Ruby gem auto-registration detection (no source scanning needed):
- okcomputer → /okcomputer
- health_check gem → /health_check

Two-tier filtering (same pattern as LibraryCallsSignal): Aho-Corasick
pre-filter eliminates non-matching files fast; regex confirms import and
extracts the exact path string used at the registration site.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bare words like `health`, `ping`, `status` could previously match without
a leading `/`. The shared path regex now requires `/` explicitly.

Django URL conf never uses leading slashes (`path("health/", include(...))`),
so a dedicated HC_DJANGO_PATH_RE extracts the prefix from the `path()` call
and prepends `/` — rather than making the shared regex optionally slash-less.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jaredLunde jaredLunde merged commit 4900908 into main Apr 16, 2026
1 check passed
@jaredLunde jaredLunde deleted the jared/healthz branch April 16, 2026 04:18
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