You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
http_health_check: NDJSON diagnostics and usage error exit 2 #2764
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 ContainerfileHEALTHCHECK 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
Merge #2771: docs(issues): [#2758] add the specs of the CLI output co…
test(health-check): [torrust#2764] hold the unreachable port bound wi…
fix(health-check): [torrust#2764] address review round 1 of PR 2889 i…
docs(tests): [torrust#2764] say where the black-box tests of root src…
docs(issues): [torrust#2764] address review round 1 of PR 2889 in the…
docs(pr-reviews): [torrust#2764] audit review round 1 of PR 2889
fix(health-check): [torrust#2764] report a URL scheme other than http…
docs(issues): [torrust#2764] address review round 2 of PR 2889 in the…
docs(pr-reviews): [torrust#2764] audit review round 2 of PR 2889
docs(issues): [torrust#2764] address review round 3 of PR 2889 in the…
docs(pr-reviews): [torrust#2764] audit review round 3 of PR 2889
test(health-check): [torrust#2764] fail the test when the test server…
docs(issues): [torrust#2764] address review round 4 of PR 2889 in the…
1 remaining item
docs(issues): [torrust#2764] address review round 5 of PR 2889 in the…
docs(pr-reviews): [torrust#2764] audit review round 5 of PR 2889
test(health-check): [#2764] add contract tests for http_health_check
fix(health-check): [#2764] follow the CLI output contract in http_hea…
test(health-check): [#2764] find the binary through the nextest varia…
docs(issues): [#2764] record the evidence and the spec progress
Merge torrust#2889: fix(health-check): [torrust#2764] follow the CLI …
docs(issues): [torrust#2764] address PR 2896 review round 1
docs(issues): [torrust#2764] address PR 2896 review round 2
docs(issues): [#2764] close out the http_health_check issue
Merge #2896: docs(issues): close out the http_health_check issue
docs(issues): [#2758] update the specs of #2769 and #2770 after PR 29…
Merge #2958: docs(issues): [#2758] update the specs of #2769 and #2770 …
Merge #2966: docs(issues): close out the tracker_client JSON-only issue