Skip to content

http_health_check: NDJSON diagnostics and usage error exit 2 #2764

Closed

Description

@josecelano-bot

Part of EPIC #2758. Order 5 of 11, wave 1.

Goal

http_health_check becomes a compliant no-stdout-result program: empty stdout, NDJSON diagnostics on stderr, exit 0 healthy, 1 unhealthy or unreachable, 2 usage error.

Background

src/bin/http_health_check.rs prints Health check ... and STATUS: <code> to stdout, plain-text errors, and exits 1 for a usage error; it carries #![allow(clippy::print_stdout, ...)]. It is the container HEALTHCHECK in the Containerfile (CMD /usr/bin/http_health_check http://localhost:${HEALTH_CHECK_API_PORT}/health_check), so unhealthy must stay a non-zero exit. Maintainer decision (2026-11-06): classify it no-stdout-result (the table change is in EPIC issue 1). The binary avoids third-party crates on purpose (see its module doc); keep dependencies minimal, and write the JSON without adding a crate if reqwest already brings what is needed.

The contract in short: see the ADRs docs/adrs/20260519000000_define_global_cli_output_contract.md and docs/adrs/20261106102632_scope_the_cli_output_contract_and_keep_exit_codes_to_zero_one_two.md.

In scope

  • Emit nothing on stdout.
  • On stderr, one JSON record per event with a kind (for example usage_error, unhealthy with the HTTP status, unreachable with the error, healthy).
  • Exit 0 on a 2xx response, 1 on non-2xx or a request failure, 2 on usage error.
  • Remove the print_* allow, using the same stderr JSON writer pattern as the other tools.
  • Tests for the exit codes and records; confirm the Containerfile HEALTHCHECK still works.

Out of scope

  • Changing the health endpoint or its timeout.
  • Editing the ADR.

Acceptance criteria

  • stdout is empty in every case.
  • Every stderr line is one JSON object with a kind.
  • Exit codes are 0, 1, 2 as specified.
  • The container still reports unhealthy when the endpoint fails.

The full specification (implementation plan, verification plan, files this issue may touch) is added by the spec PR under docs/issues/open/.

Activity

  1. added a commit that references this issue on Nov 9, 2026
  2. self-assigned this
    on Nov 11, 2026
  3. added 12 commits that reference this issue on Nov 16, 2026
  4. 1 remaining item

  5. added 2 commits that reference this issue on Nov 16, 2026
  6. added 4 commits that reference this issue on Nov 16, 2026
  7. added a commit that references this issue on Nov 16, 2026
  8. added 2 commits that reference this issue on Nov 17, 2026
  9. added 5 commits that reference this issue on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions