ADR-0022: The health check passes only on evidence, and only main owns its incident#

  • Status: accepted. In force since 25 November 2026 (see Current status).
  • Date: 2026-11-25

Context#

scripts/health-check.sh is the full external report on the domain. The dns-health workflow runs it twice a day and keeps one issue, labelled health-check, open while it fails. The hourly Lambda probe is the punctual alarm for the chain of trust (ADR-0020); this is everything else, seen the way a client sees it (principle 8).

The review of 24 November 2026 (finding 7) found three ways it could report the wrong thing. Each was reproduced on 25 November against stub servers on a local machine before it was changed.

  1. A broken origin passed as "reachable". The homepage check was

curl -sS with no status check, so any HTTP response passed: a 403 from a broken origin access control, a 503, a redirect to anywhere. The header checks passed too, because the response headers policy also applies to error responses. The Terraform check block requires 200, but runs only at plan and apply time.

  1. A host that could not be reached passed as "refusing TLS 1.2". The

review read the check as matching Cipher is in openssl s_client's output, and worried that OpenSSL 3 prints Cipher is (NONE) on a refusal. It does, but the script runs with set -o pipefail, so the pipeline's status was openssl's own exit status, not grep's: the check already went by exit status, by accident. The real fault is the other direction. Any failure counted as a refusal: no DNS answer, a refused connection, a host that does not speak TLS. All three printed "TLS 1.2 correctly refused".

  1. **A run that was not the production check could close the production

incident.** Any run that passed closed every open health-check issue, whatever domain it checked and whatever branch it ran from. This has happened. On 24 November, issue #11 was opened by a dns-health run from a feature branch and closed two minutes later by another run from the same branch, with a script edited on that branch. The issue title was also hard-coded to testz.dev, whatever the run checked. A manual run against another domain also shared the production run's concurrency group, so it could cancel a scheduled run part-way through.

Constraints: a check that cannot fail is worse than none, and a check that could not run must never read as a pass (principle 2); no new dependency, and nothing third-party unpinned (principle 5); permissions per job (principle 4).

Decision#

  1. The homepage must return HTTP 200, and redirects are not followed. The

script makes one GET of https://testz.dev/ and judges its status: 200 passes; no response, any 3xx, 4xx or 5xx fails, and the failure names the status (and a redirect's target). The header checks read the headers of that same response, where they previously made a separate HEAD request. The homepage is served at / directly (CloudFront's default root object), so a redirect there is a fault, and following one could pass on whatever answers at the other end, with headers that are not this site's.

  1. TLS 1.2 is refused only if the server was reached and spoke TLS. Each

handshake is judged by openssl s_client's exit status. With TLS 1.2 forced:

    • exit 0 means TLS 1.2 was accepted, and fails;
    • a timeout fails, as not a refusal;
    • no TCP connection fails, as not a refusal. A connection is shown by the

CONNECTED( line s_client prints when the socket opens; if a future OpenSSL stopped printing it, the check would fail, not pass;

    • a refused handshake passes only if the TLS 1.3 handshake to the same host

succeeded in the same run, so the host demonstrably speaks TLS there. Otherwise it fails, as not evidence of a TLS 1.3-only policy.

The TLS 1.3 handshake is judged by exit status too: forcing TLS 1.3, s_client exits 0 only if one completed. Each attempt is bounded by timeout (20 seconds) where GNU coreutils provides it.

  1. Only a run that checks testz.dev from main owns the incident. The

first step of dns-health decides this, and only that run may open, update or close the health-check issue. Any other run (another domain, or any branch) reports in its run summary and its status, and touches no issue. The issue is written by a separate job, incident, the only job in the workflow with issues: write, which runs only when the check job says the run owns the incident, and does not check out the repository. The check job holds only contents: read. The issue title names the domain checked. Runs that own the incident share a concurrency group and queue rather than cancel each other; report-only runs get a group of their own.

  1. The script is tested against stub servers. make test-health, in

make check and in CI, runs the real script against HTTPS servers on 127.0.0.1 with chosen statuses and TLS versions, a port nothing listens on, a .invalid name and a server that is not TLS, with dig and delv stubbed so nothing leaves the machine. It also asserts that only the incident job can write issues and only under that condition. Each test was shown to fail by reintroducing the fault it covers. The script reads HTTPS_PORT (default 443) so a stub's port can be used.

Alternatives considered#

Follow redirects and require a final 200 (curl -L). The plan-time check block does this, because the provider follows redirects. It lost because a redirect from / to anywhere, including off the domain, would pass, and the headers judged would be the last hop's. If the site ever redirects / on purpose, that is a new decision and the check changes with it.

Accept any 2xx. Nothing at / should return 204 or 206 to a plain GET, so accepting them only widens what passes.

Decide the TLS 1.2 refusal by the alert text (alert protocol version). The text differs between OpenSSL versions and between servers, and CloudFront's exact alert has not been observed from this project. The alert, when there is one, is printed as information instead.

Report "could not test" as a warning. Warnings do not open the issue or fail the run, so a check that could not run would pass in effect. When the host is unreachable, the homepage and TLS 1.3 checks fail anyway; the TLS 1.2 line now says why it could not judge, instead of claiming a refusal.

A Python ssl probe in place of openssl s_client. Its exceptions separate socket errors from handshake errors cleanly, but it would replace a tool the script already uses and that a reader can run by hand, to fix a decision rule that is three lines of shell.

Let any domain own an issue of its own (keyed by title). It would open issues for any domain typed into the form, and still let a branch run close the production one. The roadmap's legacy.testz.dev exhibit will need its own expectations anyway, and that is the time to decide how a second domain reports.

Scope by domain only, and allow branches. That is what the review asked for, but issue #11 shows the branch half is the one that has already happened: a branch can carry an edited script, and its pass is not evidence about main.

Consequences#

Positive:

  • A 403, a 5xx or a redirect at the homepage fails the twice-daily report,

where before only the next plan would have seen it.

  • "TLS 1.2 correctly refused" now means a server that speaks TLS 1.3 refused

TLS 1.2 in the same run.

  • Neither a manual run against another domain nor any branch run can open,

update, close or cancel the production incident. Report-only runs do not hold a token that can write issues at all.

  • 14 tests (make test-health) keep all three true.

Negative:

  • An unreachable host now fails one more check (the TLS 1.2 line), so the

failure count, which is the exit status, goes up by one in that case.

  • The issue handling can no longer be exercised from a branch. Seeing it open

or close the issue means a run from main.

  • The production domain is written twice in the workflow: in env and, because

concurrency cannot read env, in the concurrency expression. A test checks the first; changing the domain means changing both.

  • The connection test reads one line of openssl's output. It fails closed,

but it is text.

  • make test-health uses curl, openssl and timeout from the runner image,

which, like the rest of the image, is not pinned (security posture).

Neutral:

  • The header checks read a GET response instead of a HEAD.
  • TLS checks are meaningful only where nothing between the runner and

CloudFront terminates TLS. GitHub-hosted runners have no such proxy. A network that intercepts TLS makes the handshake checks test the proxy instead; this was seen when developing the change, where an intercepting proxy accepted TLS 1.2 on the domain's behalf, and is why the change was verified against stub servers.

Current status#

25 November 2026, at merge: merged in PR #31; changes to dns-health and the script take effect on the next run from main, with nothing to apply.

25 November 2026, later: in force. A manual dns-health run from main against testz.dev (run 243) passed all 30 checks with no warnings; the check job decided the run owned the incident, and the incident job ran and found no open issue to close. It was the first time this project saw CloudFront's refusal of TLS 1.2: alert protocol version, after a TCP connection and a completed TLS 1.3 handshake (which negotiated X25519MLKEM768). The alternatives above say that alert had not been observed; it now has, and the decision not to judge by alert text stands.

A second manual run from main, against example.com (run 244), was report only: the check job decided it did not own the incident, the run failed with 10 failed checks, the incident job was skipped, and no issue was opened or changed. It also showed the TLS 1.2 check failing where it should: example.com accepts TLS 1.2, and the check reported "TLS 1.2 was accepted".

Revisit when#

  • The site deliberately serves / as a redirect, or the homepage moves.
  • A second domain needs a health check (the legacy.testz.dev exhibit on the

roadmap): decide then how its failures are reported.

  • A GitHub-hosted runner gains an intercepting proxy, or the workflow moves to

a runner that has one.

  • OpenSSL changes what s_client prints when it connects, or its exit status

on a completed handshake.

Built 2026-11-25 from commit 33bfabf6a27d4baeecf228c31bd5d636a3965070. This page was generated from the same source that provisions the infrastructure it describes.