Skip to content

Feat/healthcheck python hardening#276

Merged
Lightheartdevs merged 3 commits intoLight-Heart-Labs:mainfrom
championVisionAI:feat/healthcheck-python-hardening
Mar 17, 2026
Merged

Feat/healthcheck python hardening#276
Lightheartdevs merged 3 commits intoLight-Heart-Labs:mainfrom
championVisionAI:feat/healthcheck-python-hardening

Conversation

@championVisionAI
Copy link
Contributor

This PR expands healthcheck.py into a more capable universal healthcheck tool for HTTP and TCP targets, while preserving expected CLI behavior. It supports retries, status/body matching, structured JSON output, and GET fallback when HEAD is blocked.

Why:

Minimal container images often do not include curl or wget, and health checks need to be reliable across a wider range of services. This PR improves observability and compatibility without introducing external dependencies.

What changed:

  • Added HTTP and TCP healthcheck support in one script
  • Added retry and timeout handling
  • Added expected-status and body-regex validation
  • Added optional JSON output for CI/debugging
  • Preserved argparse exit codes so --help exits successfully

Validation:

  • python3 -m py_compile scripts/healthcheck.py
  • python3 scripts/healthcheck.py --help

Notes:

This branch includes a small local follow-up fix so --help returns 0 instead of being forced to 2.

Copy link
Collaborator

@Lightheartdevs Lightheartdevs left a comment

Choose a reason for hiding this comment

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

Thorough rewrite. The HEAD-to-GET fallback, status code range matching, body regex, retry with backoff, and 1MiB body cap are all well-implemented. Backward compatible — existing healthcheck.py <url> usage still works. Clean exit codes.

Closes #215 — this supersedes it.

Approved.

@Lightheartdevs Lightheartdevs merged commit 9f826e0 into Light-Heart-Labs:main Mar 17, 2026
26 of 32 checks passed
Lightheartdevs added a commit that referenced this pull request Mar 17, 2026
Add credit for recently merged PRs:
- yasinBursali: #270 (Bash 4+ macOS guard), #273 (.get() defaults)
- championVisionAI: #280 (hardware detection), #275 (env validation),
  #276 (healthcheck hardening), #274 (Docker resilience),
  #277 (python command resolution)
- bugman-007: #233 (disk space preflight), #238 (compose caching)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants