Report what is actually running - #44
Merged
Merged
Conversation
The installer skipped the build whenever a release binary existed in the checkout, regardless of age. Its own header claimed the skip also required the binary to be newer than the sources, but that half was never implemented, so any stale artifact won permanently. The failure is silent and looks like success. Pulling three weeks of changes and running the installer copied a three-week-old binary into place, restarted the services, passed the health check and printed an install summary. The installed file carried the current date because it had just been copied, so the one available piece of evidence agreed with the wrong conclusion. A security fix that had already landed in the lockfile was absent from the running process. The skip now requires the artifact to be newer than everything compiled into it and names the file that forced a rebuild. When it does skip it reports when the binary was built, because "skipping" alone reads as success while deploying whatever happens to be sitting in the target directory. Migrations are excluded from the comparison deliberately: they are copied to the install directory as files rather than compiled in, so a change to one does not require a rebuild.
Nothing the service exposed could identify itself. There was no version subcommand, the health endpoint returned no build information, and the package version is a constant that has never moved. The only available evidence was the file modification time, which records when a file was copied rather than what is inside it — so a stale binary installed today looked newer than the source it predates. A build script stamps in the commit and the build time. Three places surface them: a version subcommand, a build object on the health endpoint for anything checking a deployment from outside, and a footer on every administrative page rather than only the dashboard, because the question gets asked from wherever the operator already is. A working tree with uncommitted changes reports the commit with a suffix, so a binary built from an edited checkout cannot be mistaken for one built from a published commit. A build with no repository to read reports an unknown commit instead of failing; unknown is honest, and a wrong answer would not be. The stamped string is rendered into HTML, so it is constrained to safe characters where it is produced rather than escaped at each place it is shown.
Four assertions on the stamped values. Two of them guard real invariants rather than exercising code: the commit string reaches an administrative page without being escaped, so a test pins the character set that makes that sound; and a zero build time would mean the stamp never happened, which would leave every binary claiming the same build moment while still looking stamped.
|
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.



Two halves of the same problem: an upgrade that silently did nothing, and no
way to notice.
The installer skipped the build whenever a release binary existed in the
checkout, regardless of age. Its own header claimed the skip also required the
binary to be newer than the sources, but that half was never implemented, so any
stale artifact won permanently. Pulling three weeks of changes and reinstalling
copied a three-week-old binary into place, restarted the services, passed the
health check and printed an install summary. The installed file carried the
current date because it had just been copied, so the one piece of available
evidence agreed with the wrong conclusion. A security fix already present in the
lockfile was absent from the running process.
That went unnoticed because nothing the service exposed could identify itself.
There was no version subcommand, the health endpoint returned no build
information, and the package version is a constant that has never moved. The
only evidence was a file modification time, which records when a file was copied
rather than what is inside it.
The skip now requires the artifact to be newer than everything compiled into it,
and names the file that forced a rebuild. When it does skip it says when the
binary was built. Migrations are excluded from the comparison deliberately —
they are copied as files rather than compiled in.
A build script stamps in the commit and the build time. Three places surface
them: a version subcommand, a build object on the health endpoint for anything
checking a deployment from outside, and a footer on every administrative page
rather than only the dashboard. A working tree with uncommitted changes reports
a suffix, so a binary built from an edited checkout cannot be mistaken for one
built from a published commit. A build with no repository reports an unknown
commit rather than failing.
Verified locally: formatting clean, no clippy errors, and test counts unchanged
against the base branch — the failures in both are a database URL absent from
the shell, not a regression.