Skip to content

Report what is actually running - #44

Merged
lgutschow merged 3 commits into
mainfrom
deploy/report-what-is-running
Aug 28, 2026
Merged

Report what is actually running#44
lgutschow merged 3 commits into
mainfrom
deploy/report-what-is-running

Conversation

@lgutschow

Copy link
Copy Markdown
Contributor

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.

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.
@sonarqubecloud

Copy link
Copy Markdown

@lgutschow
lgutschow merged commit afd46db into main Aug 28, 2026
14 checks passed
@lgutschow
lgutschow deleted the deploy/report-what-is-running branch August 28, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant