Skip to content

fix: dev version format leaking to release builds#282

Merged
avihut merged 2 commits intomasterfrom
fix/dev-version-format-leaks-to-release
Mar 9, 2026
Merged

fix: dev version format leaking to release builds#282
avihut merged 2 commits intomasterfrom
fix/dev-version-format-leaks-to-release

Conversation

@avihut
Copy link
Owner

@avihut avihut commented Mar 9, 2026

Summary

  • Release builds showed dev version format (e.g., daft 1.0.34 (dev HEAD a5d0d1b)) instead of clean daft 1.0.34
  • Root cause: build.rs gated on DAFT_BUILD_RELEASE env var which was never set anywhere (not in CI, not in build tasks)
  • Fix: auto-detect release builds by checking if HEAD has a git tag matching the Cargo.toml version; keep DAFT_BUILD_RELEASE as a manual override

Test plan

  • mise run fmt -- passes
  • mise run clippy -- passes
  • mise run test:unit -- passes
  • Dev build shows branch + hash: daft 1.0.34 (dev fix/... b95fa97)
  • Tagged build shows clean version: daft 1.0.34
  • DAFT_BUILD_RELEASE=1 override still works

🤖 Generated with Claude Code

build.rs checked for DAFT_BUILD_RELEASE env var to distinguish dev from
release builds, but this env var was never set anywhere — not in CI, not
in the build task. All builds got the dev format, including cargo-dist
release builds (e.g., "daft 1.0.34 (dev HEAD a5d0d1b)").

Replace the env var check with automatic git tag detection: if HEAD has a
tag matching the Cargo.toml version, treat it as a release build and
output the clean version string. Keep DAFT_BUILD_RELEASE as a manual
override fallback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@avihut avihut added this to the v1.1.0 milestone Mar 9, 2026
@avihut avihut added bug Something isn't working fix Bug fix labels Mar 9, 2026
@avihut avihut self-assigned this Mar 9, 2026
Adds `mise run test:version-format` which asserts that:
1. Dev builds show branch + commit hash (dev format)
2. Release builds show clean version (simulates cargo-dist conditions:
   detached HEAD with a version tag pointing at HEAD)
3. DAFT_BUILD_RELEASE env var override produces clean version

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@avihut avihut merged commit 7b1ca92 into master Mar 9, 2026
6 checks passed
@avihut avihut deleted the fix/dev-version-format-leaks-to-release branch March 9, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant