common: stamp build time + commit, log build info in every build#556
common: stamp build time + commit, log build info in every build#556myleshorton wants to merge 1 commit into
Conversation
Add BuildTime and Commit vars (ldflags-injected alongside Version) and un-gate build/dependency logging that was Dev()-only. A shipped binary now logs its version, build time, commit, and the linked versions of the load-bearing deps (keepcurrent, amp, domainfront, kindling, lantern-box, sing-box) at Info on startup, with the full dependency list at Debug. Motivation: a 9.1.14 iOS TestFlight build shipped a pre-fix keepcurrent (send-on-closed-channel crash) even though go.mod declared the fixed version. logModuleInfo() being gated behind Dev() meant beta/prod builds logged nothing about their actual linked deps, so the stale build was invisible until a crash stack happened to reveal the version. ReadBuildInfo reflects what is really in the binary, making such stale-build regressions visible directly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGpKfgkbfdJwwsTaouMDoR
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds ChangesBuild Metadata Logging
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Init
participant logBuildInfo
participant ReadBuildInfo as debug.ReadBuildInfo
participant Logger
Init->>logBuildInfo: call on startup
logBuildInfo->>ReadBuildInfo: request build info
ReadBuildInfo-->>logBuildInfo: return info or failure
alt info available
logBuildInfo->>Logger: log Version, BuildTime, Commit, GoVersion, Main
loop each dependency
logBuildInfo->>Logger: log at Info (load-bearing) or Debug (other)
end
else info unavailable
logBuildInfo->>Logger: log "no build info" message
end
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR makes Radiance binaries self-describing by adding ldflags-injected build identity fields and emitting build + dependency linkage information on startup in all builds (not just Dev), so mismatched/stale linked dependencies are visible directly in logs.
Changes:
- Add
common.BuildTimeandcommon.Commitbuild-time variables (ldflags-injected alongsideVersion). - Replace the Dev-only
debug.ReadBuildInfo()logging withlogBuildInfo()that runs in every build. - Log a concise
buildbanner at Info and log dependency versions (Info for selected “load-bearing” deps; Debug for full list).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| common/init.go | Always logs build identity + linked module versions at startup (Info for selected deps, Debug for full list). |
| common/constants.go | Adds ldflags-injected BuildTime and Commit variables to capture build identity. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if _, ok := loadBearingDeps[dep.Path]; ok { | ||
| slog.Info("build dep", "path", dep.Path, "version", dep.Version) | ||
| } | ||
| } else { | ||
| slog.Info("No build information available.") | ||
| slog.Debug("build dep", "path", dep.Path, "version", dep.Version) | ||
| } |
What
common.BuildTime+common.Commitvars (ldflags-injected, alongsideVersion).if Dev()gate on build/dependency logging (added incidentally in Linux daemon and systemd service #301) so it runs in every build.buildbanner (version, buildTime, commit, goVersion, mainModule) at Info, plus the linked versions of the load-bearing deps (keepcurrent, amp, domainfront, kindling, lantern-box, sing-box) at Info; the full dependency list stays at Debug (so no per-dep spam in prod).Why
A 9.1.14 iOS TestFlight build shipped a pre-fix keepcurrent (
54a4d9a, the send-on-closed-channel crash) even though go.mod declared the fixedf204338. BecauselogModuleInfo()was gated behindDev(), beta/prod builds logged nothing about their actual linked deps — the stale build was invisible until a crash stack happened to reveal the version.debug.ReadBuildInfo()reflects what is really linked into the binary, so surfacing it makes stale-build regressions visible directly.Pairs with getlantern/lantern's Makefile change that injects the new ldflags.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WGpKfgkbfdJwwsTaouMDoR
Summary by CodeRabbit