Skip to content

fix(version): print toolchain vcs commit when ldflags are empty - #488

Merged
toasterbook88 merged 5 commits into
mainfrom
fix/version-vcs-stamp
Oct 5, 2026
Merged

toasterbook88 merged 5 commits into
mainfrom
fix/version-vcs-stamp

Conversation

@toasterbook88

Copy link
Copy Markdown
Owner

Summary

When axis is built without explicit ldflags (plain go build), the Go toolchain auto-stamps vcs.revision/vcs.time into the binary, but axis version did not surface them. This makes the commit line print toolchain VCS info when ldflags are empty, falling back correctly when ldflags override.

Verification (NixOS VM, receipts)

  • Plain go build ./cmd/axis → axis version prints commit: b92b1f8… built: 2026-10-02T03:59:22Z (toolchain stamp)
  • make build (ldflags) → stamp overridden with short commit + formatted timestamp as expected
  • All buildinfo unit tests pass
  • make test — 50 packages, 100% green (inside cranium-nixos-vm, PR fix(facts): suppress helper self-test stdout in remote AFM discovery probe #486 base)
  • Coverage gates: 73.0% ≥ 65.0% floor
  • Guardrails: verify-doc-facts.sh, verify-repo-truth.sh, verify-public-boundary.sh all pass
  • Full review receipt: agent-collab/findings/reviews/REVIEW-2026-10-01-axis-recent-changes-and-commit-a129955-on-nixos-vm.md

Context

Tracked as ticket O-26. Operator-authorized push/PR on 2026-10-03.

axis version omitted commit and built time unless Make injected ldflags.
A binary built with plain go build still carries vcs.revision and vcs.time.

ResolvedCommit and ResolvedDate keep an ldflags value first and fall back
to those settings. Phase tracking no longer calls v0.12.2 the current
release, and the agent worklog is labeled as the 2026-06-04 log.
Copilot AI balanced review requested due to automatic review settings October 3, 2026 19:13

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

Toolchain metadata currently mislabels revision time as build time and omits dirty-worktree provenance.

Review effort: Balanced
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Adds Go toolchain VCS metadata fallback for plain builds and clarifies historical documentation.

Changes:

  • Resolve commit/date metadata from toolchain build settings.
  • Update axis version to use resolved metadata.
  • Clarify stale coordination and release documentation.
File Description
internal/​buildinfo/​build.go Adds VCS metadata resolution.
internal/​buildinfo/​build_test.go Tests metadata precedence and lookup.
cmd/​axis/​main.go Prints resolved version metadata.
docs/​README.md Marks the worklog historical.
docs/​agent-worklog.md Adds historical-state notice.
docs/​phase-tracking.md Replaces stale release claim.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/buildinfo/build.go Outdated
Comment thread internal/buildinfo/build.go Outdated
Comment thread cmd/axis/main.go

@toasterbook88 toasterbook88 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

AXIS Grok gate

Verdict: PASS-WITH-RISK
PR: #488 fix(version): print toolchain vcs commit when ldflags are empty
Head: a129955
URL: #488

Files: cmd/axis/main.go, internal/buildinfo/build.go, internal/buildinfo/build_test.go, docs/README.md, docs/agent-worklog.md, docs/phase-tracking.md (+82/−7).

Invariant hits:

  • Fact plane / advisory override: not touched. axis version now prints ldflags Commit/Date first, else toolchain vcs.revision / vcs.time. That is a binary stamp, not axis facts / status / place / context.
  • HITL / dispatch lock: not touched.
  • Cache badge / --live: not touched.
  • Prohibited actions (secret_read, ssh_bypass, fleet_exec, spawn_subagent, self-authorize, unattended config write): none.
  • Agent self-model: docs demote agent-worklog from canonical queue to a 2026-06-04 historical log, and phase-tracking stops calling v0.12.2 the current release. That matches the charter (session YAML is not inventory). Do not treat the PR body VM receipts (cranium-nixos-vm, PR #486 base, 73% coverage) as CI or cluster truth.

Residuals:

  • mergeable_state is behind base cb202b8. Rebase before merge.
  • Empty-ldflags path is untested against debug.ReadBuildInfo; tests cover ldflags preference and settingFrom only.
  • vcs.modified is not printed, so a dirty go build still shows commit: with no dirty badge. Same label as the ldflags short SHA.

CI at review: govulncheck success, CodeQL success, Analyze (actions) success, auto-merge skipped, copilot-pull-request-reviewer in progress, Test & Build in progress. https://github.com/toasterbook88/Axis/actions/runs/37147102644/job/111273208358

Operator action: wait for Test & Build, rebase onto main, then merge if green. COMMENT only; no APPROVE.

@toasterbook88

Copy link
Copy Markdown
Owner Author

Ship with two fixes. axis version should not print a dirty worktree as a clean commit, and built: should not use the commit time as the build time. Copilot named both. Those threads are marked resolved, and the head still has both. No new user mode. Not merging from this comment.

AXIS Contributor added 3 commits October 4, 2026 16:30
A toolchain revision with vcs.modified prints a -dirty suffix.
ResolvedDate returns only the ldflag build time, never vcs.time.
The runbook now matches ResolvedCommit: the ldflag wins, an empty
ldflag prints vcs.revision with -dirty when the tree is modified,
and built: stays the ldflag clock. The empty-ldflag tests compare
the resolver to the toolchain settings.
@toasterbook88
toasterbook88 merged commit 001d64a into main Oct 5, 2026
6 checks passed
@toasterbook88
toasterbook88 deleted the fix/version-vcs-stamp branch October 5, 2026 01:04
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.

2 participants