Skip to content

feat(build): stamp commit, build number, and date into the binary - #143

Open
Emasoft wants to merge 1 commit into
mlhher:mainfrom
Emasoft:feat/version-stamping
Open

Emasoft wants to merge 1 commit into
mlhher:mainfrom
Emasoft:feat/version-stamping

Conversation

@Emasoft

@Emasoft Emasoft commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

-version used to print a static string identical across every build — two binaries built a month apart were indistinguishable. Now it prints

late 2.0.0-rc.1 (build 1239, commit 2fe0e83, built 2026-09-25T13:12:11Z)

so every build is uniquely identifiable.

How it's stamped

  • build number: git rev-list --count HEAD — deterministic, monotonic, works offline; reports unknown outside a git tree
  • commit: short SHA from the same git probe
  • date: RFC3339 build timestamp

The Makefile stamps all three via -ldflags -X, with a graceful fallback when git isn't available, and unknown pieces are omitted from the display instead of printed as noise.

Scope notes

  • the info-bar version segment (compact v2.0.0-rc.1 · bN · <commit> form) rides with the info-bar PR — there's no info bar on main yet
  • install-dev.sh stamping rides with the installer PR — there's no install-dev.sh on main

Testing

$ go test -count=1 -race ./...
ok  	late/cmd/late	1.535s
?  	late/cmd/mcp-run	[no test files]
ok  	late/internal/agent	2.495s
?  	late/internal/assets	[no test files]
ok  	late/internal/client	3.209s
ok  	late/internal/common	3.541s
ok  	late/internal/config	1.518s
ok  	late/internal/executor	10.428s
ok  	late/internal/git	3.492s
ok  	late/internal/mcp	4.231s
ok  	late/internal/orchestrator	2.489s
?  	late/internal/pathutil	[no test files]
ok  	late/internal/plugin	13.185s
ok  	late/internal/session	2.631s
ok  	late/internal/skill	3.373s
ok  	late/internal/tool	4.682s
ok  	late/internal/tool/ast	4.355s
ok  	late/internal/tui	9.788s

exit 0 — all 18 packages green (15 ok, 3 without test files).

-lversion now prints 'late 2.0.0-rc.1 (build N, commit X, built DATE)'
so every build is uniquely identifiable — no more identical static
version strings. Build number is git rev-list --count HEAD (deterministic,
monotonic, offline; 'unknown' outside a git tree). The info bar shows
the compact form 'v2.0.0-rc.1 · bN · <commit>'. Makefile and both
install-dev.sh direct-build paths stamp all three via -ldflags -X.
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