Repository navigation
fix: a gateway installed from the module proxy knows its own version - #43
Merged
Merged
Conversation
`go run github.com/fold-run/fold/cmd/fold@latest` — the install this README leads with — produced a binary reporting version "dev". goreleaser stamps the version with -ldflags and the module proxy path cannot, so every operator on that route got a gateway whose /api/federation, /health, startup log and MCP clientInfo all claimed to be a development build. That is not cosmetic. The console gates its own surfaces on that string and treats an unparseable one as current, so those operators silently lost version-skew detection and got unversioned documentation links. Go already records the resolved module version in the binary; the gateway now reads it when nothing stamped one. Precedence is deliberate: a stamp wins where there is one, so releases are unaffected. "(devel)", which is what a build from a working tree records, is not a version and leaves "dev" alone — that path is a developer's and should say so. THE PART THAT COULD HAVE GONE WRONG QUIETLY `-X` only writes a string variable whose initialiser is a constant. `version` now has to be computed, so a flag still pointed at it would have stopped applying and reverted every release to "dev" — the exact bug this fixes, inverted. The stamp target is `gateway.ldflagsVersion`, and .goreleaser.yaml, deploy/docker/fold.Dockerfile, CLAUDE.md and the release runbook move with it. Verified rather than assumed: a build with -X against the new symbol reports v9.9.9. resolveVersion takes the module lookup as an argument so the tests can exercise every build route. debug.ReadBuildInfo() inside a test binary reports the test binary's own metadata and can never be made to say "v1.10.0", so a test that called it directly could only ever cover the branch this machine happens to produce. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.
go run github.com/fold-run/fold/cmd/fold@latest— the install the READMEleads with — produced a binary reporting its version as
dev:goreleaser stamps the version with
-ldflags; the module proxy path cannot. Soevery operator on that route got a gateway whose
/api/federation,/health,startup log and MCP
clientInfoall claimed to be a development build.It is not cosmetic. The console gates its own surfaces on that string and
treats an unparseable one as current, so those operators silently lost
version-skew detection and got unversioned documentation links. Go already
records the resolved module version in the binary; the gateway now reads it
when nothing stamped one.
Precedence is deliberate: a stamp wins where there is one, so releases are
unaffected.
(devel)— what a build from a working tree records — is not aversion and leaves
devalone. That path is a developer's and should say so.The part that could have gone wrong quietly
-Xonly writes a string variable whose initialiser is a constant.versionnow has to be computed, so a flag still pointed at it would havestopped applying and reverted every release to
dev— this exact bug,inverted, and invisible until someone checked a shipped binary.
The stamp target is
gateway.ldflagsVersion, and.goreleaser.yaml,deploy/docker/fold.Dockerfile,CLAUDE.mdand the release runbook move withit. Verified rather than assumed:
Verified against the real path
Installed this branch from the module proxy — the channel that was broken:
A pseudo-version because that is a commit;
@latestresolves to a tag andreports
v1.10.0. Both parse in the console's version gate.Testing
resolveVersiontakes the module lookup as an argument so the tests canexercise every build route.
debug.ReadBuildInfo()inside a test binaryreports the test binary's metadata and can never be made to say
v1.10.0, soa test calling it directly could only ever cover whichever branch the machine
happened to produce. Five cases: stamped release,
go installof a tag,go installof a commit, working-tree build, no metadata.make checkpasses locally (fmt, tidy, vet, build, race across all packages).golangci-lintis not installed on this machine; CI covers it.One consequence worth knowing
A gateway installed from a commit now reports a ~40-character
pseudo-version, which the console renders in its header lockup. For the
documented
@latestpath it is a cleanv1.10.0. If the long form turns outto look bad in practice, the fix belongs in the console's
displayVersionrather than in what the gateway reports about itself.
Changelog entry added as
v1.10.1 — unreleased.🤖 Generated with Claude Code