gitbayd: warn at startup about a build that cannot be vouched for !118

merged merged by cmc on 2026-08-30 04:04 UTC · krz/gitbay:startup-warning into main

Discussion

cmc

Stamping the commit (!117) let a binary say where it came from, but nothing acted on the answer. Two warnings on the serve path close that.

An uncommitted build now logs WARN instead of INFO. It was built from a tree that was never committed, so the source no longer exists anywhere. Both stale binaries this week looked exactly like this.

A build off the default branch gets its own warning. It serves perfectly well, which is why it can sit unnoticed. This needs to know which hosted repository the instance develops itself in, so it reads a new server.source_repo ("owner/name") and stays silent when unset — right for any instance that does not host its own source. HEAD in a bare repository is the default branch, so there is no branch name to resolve or configure.

A commit the repository has never seen warns as well: unverifiable is not the same as fine.

Tests build a real bare repository with a commit on the branch and one off it, and cover both warnings, the unknown commit, the unset key, and the dirty case that belongs to the other warning. Checked against unpatched code to confirm they fail without it.

Deploy order matters: config.Load rejects unknown keys, so this binary must ship before source_repo is added to config.toml.

Ref #28.