Skip to content

config: drop VERSION env override; use version.Version - #622

Open
MsfPablo wants to merge 1 commit into
agentregistry-dev:mainfrom
MsfPablo:fix/issue-567-drop-version-env
Open

config: drop VERSION env override; use version.Version#622
MsfPablo wants to merge 1 commit into
agentregistry-dev:mainfrom
MsfPablo:fix/issue-567-drop-version-env

Conversation

@MsfPablo

Copy link
Copy Markdown

What

Removes the redundant cfg.Version field from internal/registry/config so the registry server reports the version it was built with instead of one overridable through AGENT_REGISTRY_VERSION at runtime.

Why

Issue #567cfg.Version only ever set the default ("dev"), which is what internal/version.Version already returns when no -ldflags injection happened. Two production paths read it:

  1. internal/registry/registry_app.go — telemetry init label
  2. internal/registry/api/handlers/v0/health/handlers.go — health metrics version attribute

Both now read version.Version directly, so a deployed binary's reported version always matches what it was built with. There is intentionally no env override any more.

Changes

  • internal/registry/config/config.go — drop Version string field; leave a comment explaining the build-time injection point
  • internal/registry/registry_app.gotelemetry.InitMetrics(version.Version)
  • internal/registry/api/handlers/v0/health/handlers.go — same, plus the internal/version import
  • .env.example — replace the AGENT_REGISTRY_VERSION=dev line with a comment pointing at the ldflags injection

Test plan

  • go build ./... clean
  • go test ./internal/registry/config/... passes
  • go test ./internal/registry/... passes (telemetry, health, controllers)
  • No remaining cfg.Version references in the registry config path (CLI root config has its own unrelated Version field — left alone)

Notes

  • The other Version references in the codebase (internal/cli/version.go, internal/mcp/registryserver/server.go, internal/registry/registry_app.go:133/137) already read from version.Version. This change brings the two stragglers into line.
  • The maintainer comment on Why do we have a VERSION config.go value? #567 also mentioned cfg.Verbose; there is no such field in this config struct (probably from an earlier refactor), so the scope is exactly cfg.Version only.

Disclosed: this PR was authored with LLM assistance under the MsfPablo persona.

The cfg.Version field in internal/registry/config duplicated the
version.Version package var without adding value: VERSION only set the
default, which was already "dev", and the package var is set at build
time via -ldflags. Two call sites (registry_app telemetry init and the
v0 health handler) were reading cfg.Version; both now use version.Version
so the deployed binary reports the version it was built with.

The .env.example entry is replaced with a comment pointing at the
ldflags injection point — there is intentionally no env override any
more.

Refs agentregistry-dev#567.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant