sapedbd has no version command; it only says so in a log line
SAPE-1 gave the daemon a version and two ways to state it: the first line it
prints when it starts listening, and the productVersion field of every
welcome. Both require the daemon to run.
Somebody holding the binary — in a container they are trying to identify, on a host they do not
have the secret for, writing a bug report — cannot ask it what it is.
cmd/sapedbd/main.go parses no arguments at all: it builds a context, calls
service.Run, and exits. An argument is not refused; it is not looked at.
The CLI has exactly the command that is missing here, and its own declaration explains why it exists:
internal/cli/cli.go:324-338 marks version standalone: true
— the only command in the table that names no database — "Asking a binary what it is
must work before any of those exist — on a host with no databases, in a container someone is
trying to identify, in a bug report written by somebody who was never given the secret." That
reasoning applies to the daemon at least as strongly, and the daemon did not get it.
Measured at sapedb 248fa02, by building and running, not by reading:
$ go build -o /tmp/sapedbd ./cmd/sapedbd
$ env -u SAPEDB_SECRET /tmp/sapedbd version
sapedb: SAPEDB_SECRET is not set, so no connection could be verified
exit 1
$ env -u SAPEDB_SECRET /tmp/sapedbd --version
sapedb: SAPEDB_SECRET is not set, so no connection could be verified
exit 1
sapedb version (the CLI) prints sapedb <version> and
exits 0, with no secret, no directory and no database.internal/service/service.go:196-197 —
sapedb %s listening on %s as %s, databases in %s, with
build.Version first. That needs a valid SAPEDB_SECRET, a bindable
address and a writable directory before it prints anything.welcome's productVersion
(internal/server/server.go:544, 580), which needs a connection and therefore a
connection string.internal/build and are stamped by the same STAMP in the Makefile
(Makefile:33-34) and the same -ldflags in the Dockerfile. So this is
purely about there being no way to ask.
Does it lose data, break a promise on a public surface, or stop somebody installing and
running? No. The version is stamped into the daemon and reachable two ways, both of which
are measured (version_live_test.go covers the stamped build and the client reading
productVersion). No promise made anywhere says sapedbd takes arguments
— its package doc says the opposite, that everything comes from the environment so the same
image runs unchanged in a container, under systemd, or on a laptop.
Defer. The honest summary is that the capability shipped and one affordance did not. SAPE-1's acceptance criteria were about the version being embedded, printable and readable over a connection, and all three hold.
Worth recording anyway, because "no arguments, everything from the environment" is a good rule that
has one natural exception, and version is it: it is the question you ask before
you have an environment to configure.
docker run --rm image version is the shape people will
try first, and it currently fails with a message about a secret.--version is a daemon that will
accept and ignore a mistyped flag somebody thought was configuring it.