A liveness response joins the /v1 contract - #64
Merged
Merged
Conversation
… state pinned The contract gains a response type for a liveness endpoint. Nothing in this client calls that route, and the type is here anyway, because this package is where the protocol is defined once — before anything serves it — and a supervisor or a person establishing that a listening port is attached to a server that answers is as much a consumer as the CLI is. Liveness is the whole claim and the type says so. The handler reads no datastore and reaches nothing else, so a success means this process is up and serving; it does not mean the dependencies are well. One endpoint answering both questions can only ever answer the weaker one while reporting the stronger, which is worse than not answering at all. TWO FIXTURES, because the all-zero state is reachable rather than degenerate. A supervisor's first poll arrives before a second of uptime has accrued; a binary that cannot read its own file reports no digest; nothing obliges an installation to declare a revision. All three answer success, so all three need pinning — the same argument the closed-capacity fixture already makes, and that fixture's comment claiming to be the only one of its kind moves in this commit rather than being left beside its own counterexample. Both string fields may be empty and empty is not an error. The digest is what the binary computes of ITSELF at startup — its own identity rather than an assertion about it, the one form of that fact which cannot disagree with reality — and a process that cannot read its own file still serves. The revision is configuration, and the field name says so rather than implying the binary knows: whatever installed it is the only thing that does, so the value is exactly as trustworthy as that installation. It is deliberately not compiled in, because stamping it would make the binary's bytes depend on where it came from, and the build that produces it is pinned precisely so its output follows from its inputs alone. Uptime is a count rather than an instant. At zero a count reads as zero, where an unset timestamp renders as a date in year one that every reader must decode before dismissing — and a committed fixture is read far more often than it is written. FIXTURE VALUES ARE SYNTHETIC ON PURPOSE. A fixture pins field names; it does not record a measurement. This repository is world-readable, and a real digest with a real revision id would have published two facts about a private deployment in a file that needed three keys. Both new rows were proved by mutation before being trusted: dropping a key from the zero fixture reds with "emitted but absent from the fixture", and tagging the field omitempty reds both health rows with "vanishes when the zero value is marshalled". Restored byte-identical, with the baseline green again afterwards, so the restore is measured rather than assumed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XfBYBGuUkF7zUnZfAFD3dW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The contract gains
HealthResponse, the body of an unauthenticated livenessendpoint the control plane will mount. Nothing in this client calls that
route, and the type belongs here anyway: this package defines the protocol
once, before anything serves it, and the callers that need a liveness answer
— a process supervisor, or a person establishing that a listening port is
attached to a server that answers — are as much consumers as the CLI is.
Three fields, every one emitted at its zero value because this package bans
omitemptyoutright:uptime_seconds— a count, not an instant. At zero a count reads as zero,where an unset timestamp renders as a date in year one that every reader
has to decode before dismissing, and a committed fixture is read far more
often than it is written.
artefact_sha256— what the running binary computes of ITSELF at startup.Its own identity rather than an assertion about it, which is the one form
of that fact which cannot disagree with reality. Empty when the process
could not read its own file, and that is not an error: a liveness endpoint
which failed on self-inspection would not be one.
deployed_commit— configuration, and the field name says so rather thanimplying the binary knows. Whatever installed the binary is the only thing
that knows which revision produced it, so the value is exactly as
trustworthy as that installation. Deliberately not compiled in: stamping a
revision would make the binary's bytes depend on where it came from, and
the build that produces it is pinned precisely so its output follows from
its inputs alone.
TWO FIXTURES, because the all-zero state is reachable rather than
degenerate. A supervisor's first poll arrives before a second of uptime has
accrued; a binary that cannot read its own file reports no digest; nothing
obliges an installation to declare a revision. All three answer success, so
all three need pinning — the same argument the closed-capacity fixture
already makes, and that fixture's comment claiming to be the only one of its
kind moves in this change rather than being left beside its own
counterexample.
Fixture values are synthetic on purpose. A fixture pins field names; it does
not record a measurement. This repository is world-readable, and a real
digest beside a real revision id would publish two facts about a private
deployment in a file that needed three keys.
Both new golden rows were proved by mutation before being trusted: dropping
a key from the zero fixture reds with "emitted but absent from the fixture",
and tagging a field
omitemptyreds both new rows with "vanishes when thezero value is marshalled". Restored byte-identical, with the baseline green
again afterwards, so the restore is measured rather than assumed.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XfBYBGuUkF7zUnZfAFD3dW