Skip to content

Version validation from gh - #642

Merged
pablocampogo merged 3 commits into
developmentfrom
version-validation-from-gh
Oct 21, 2026
Merged

pablocampogo merged 3 commits into
developmentfrom
version-validation-from-gh

Conversation

@pablocampogo

Copy link
Copy Markdown
Collaborator

Summary

The main release workflow (.github/workflows/release.yml) now fails fast if the release tag does not match the software version baked into the code. Previously nothing stopped a release from being tagged with a version that didn't match SoftwareVersion, so a release could ship with a mismatched version number.

As part of this, the SoftwareVersion constant and the version-validation helpers were consolidated into a dedicated lib/version.go file.

Changes

Release validation

  • Extended cmd/scripts/semver with an opt-in --check-server-version flag. When set, in addition to validating that the argument is valid semver, it asserts the version matches lib.SoftwareVersion.
    • Only the leading v is optional; build metadata (e.g. +beta) is significant and must match.
    • On mismatch it exits non-zero with: version mismatch: remember to update the version number in lib/version.go.
  • Enabled the check in .github/workflows/release.yml only. The five release-plugin-*.yml workflows are unchanged — they still run plain semver validation, since plugins are versioned independently of the node software.

Version constant relocation

  • Moved SoftwareVersion and the version helpers (IsValidVersion, MatchesSoftwareVersion, normalizeVersion) into a new lib/version.go.
  • Added lib.MatchesSoftwareVersion(version), which compares against the constant internally so callers don't pass the expected version around.
  • Removed the constant from cmd/rpc/server.go and updated all usages to lib.SoftwareVersion:
    • cmd/rpc/query.go, cmd/cli/cli.go, cmd/auto-update/main.go (and dropped its now-unused cmd/rpc import).
  • Updated the CHANGELOG_development.md reference to point at the new lib/version.go location.

Tests

  • Moved TestIsValidVersion / TestNormalizeVersion to lib/version_test.go and added TestMatchesSoftwareVersion (covers bare/v-prefixed matches, plain mismatch, and build-metadata mismatch).
  • Added TestRunCheckServerVersion in the semver script tests.

Why read the version from lib instead of cmd/rpc

The script originally referenced rpc.SoftwareVersion, but importing cmd/rpc forces the compiler to resolve its //go:embed all:web/explorer/dist directive, which requires the built frontend. That broke the validate step (pattern all:web/explorer/dist: no matching files found). Keeping the version in lib lets the script validate it without building the frontend — confirmed via go list -deps, which shows no dependency on cmd/rpc or the web embed.

@pablocampogo
pablocampogo merged commit 1862ac4 into development Oct 21, 2026
3 checks passed
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