Skip to content

Report the next release version for dev builds - #6189

Open
denik wants to merge 2 commits into
mainfrom
denik/dev_version
Open

Report the next release version for dev builds#6189
denik wants to merge 2 commits into
mainfrom
denik/dev_version

Conversation

@denik

@denik denik commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Why

A local build (go build, no release flags) reported 0.0.0-dev+<sha>. Semver treats -dev as a
prerelease, so that sorted below every published release — even below bare 0.0.0 — even though a
local build is made from main and is therefore newer than the latest release.

Now it reports <next release>-dev+<sha>, e.g. 1.12.0-dev+abc123, read from
.nextchanges/version. It sorts above the latest release and below the release it will become,
matching what goreleaser already produces for snapshots (snapshot.version_template).

Compare(v1.11.0, v1.12.0-dev+sha) = -1
Compare(v1.12.0, v1.12.0-dev+sha) = +1

Changes

.nextchanges/nextversion.go embeds the version file as a sibling — go:embed cannot reach a parent
directory, and embedding from internal/build would need a second copy of the value that could
drift. A generated const would go stale in the release commit itself: the release bot bumps
.nextchanges/version through the GitHub API without running Go generators.

Six places detected dev builds by string-matching the 0.0.0 prefix and would all have silently
stopped recognizing them (version --check would start nagging developers to upgrade, skill
min-version gates would start applying, the compat manifest would resolve the wrong entry). They now
share build.Info.IsDevelopment, which keys off the -dev prerelease.

Two acceptance fixtures hardcoded 0.0.0-dev and rendered as [CLI_VERSION] only because it
happened to equal the real version; they now use 0.0.0-test so they no longer track it.

Tests

IsDevelopment unit tests including a release candidate (not a dev build) and a snapshot of a
release version, plus a test pinning the ordering invariant this change exists for.

A local build reported 0.0.0-dev+<sha>, which semver sorts below every
release even though the build is made from main and is therefore newer
than the latest release. Report <next release>-dev+<sha> instead, read
from .nextchanges/version, matching what goreleaser produces for
snapshots.

Dev builds were detected by string-matching the 0.0.0 prefix in six
places, all of which would silently stop recognizing them. Replace those
with build.Info.IsDevelopment, which keys off the -dev prerelease.
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 40595ea

Run: 31099738079

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 291 1110 5:22
💚​ aws windows 4 4 293 1108 4:39
💚​ azure linux 4 4 290 1110 5:47
💚​ azure windows 4 4 292 1108 4:54
💚​ gcp linux 1 5 291 1110 6:04
💚​ gcp windows 1 5 293 1108 5:08
8 interesting tests: 4 RECOVERED, 4 SKIP
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:09 aws windows TestAccept
3:09 gcp windows TestAccept
2:57 azure windows TestAccept

Comment thread internal/build/info.go

const DefaultSemver = "0.0.0-dev"
// devPrerelease marks a build that was not produced from a release tag.
const devPrerelease = "-dev"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we export this and use in the other places?

go:embed is byte-exact and the version file must end with a newline, so
keep the raw contents unexported and export the trimmed value. Callers no
longer have to remember to trim.

Replace the three copies of the "-dev" prerelease constant with one
exported predicate, and pin the version ordering with a test that asserts
every pair in an ascending list.
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.

3 participants