From 832bf7a8cc57dbd3664dec0ffaca97cc2efbcb6d Mon Sep 17 00:00:00 2001 From: Mark Schaller Date: Sat, 26 Sep 2026 02:31:12 -0400 Subject: [PATCH] Say that a git-derived version stamp is lost unless stamped A project that derives its version from the repository at configure or build time (git describe, a commit hash, a build date) loses it under Bazel unless the migration wires it through workspace status: a genrule cannot see .git from the sandbox, the generator still runs on both sides, and the output has the same shape, so the action graph cannot tell. Measured in any2bazel-lab: both OpenTTD migrations, with and without the skill, produced a binary reporting "norev0000", "unknown" and 1970, the project's own fallbacks for "no git information", while reporting success; the skill-guided one printed CONVERGED errors=0 warnings=0. Other migrations kept the version (a Bitcoin Core one through --workspace_status_command and a stamp = 1 genrule, as did a pono one), so it is not a capability gap: nothing in the procedure asks for it. Adds one paragraph to "Create initial BUILD.bazel files": the failure mode and the Bazel mechanism that preserves the value. The byte comparison that catches its absence is the one the convergence-boundary list already asks for on every generated file. In the lab's later OpenTTD run with this change, the binary reported the revision, through --workspace_status_command. Lab-Proposal: P19 Co-Authored-By: Claude Opus 5.5 --- SKILL.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SKILL.md b/SKILL.md index 62d3bd6..b39386f 100644 --- a/SKILL.md +++ b/SKILL.md @@ -271,6 +271,11 @@ rather than recalled). Put `common --check_direct_dependencies=error` in the generated `.bazelrc` so a declared version that MVS overrides fails the build instead of being a warning nobody reads. +**Values read from the repository** (`git describe`, a commit hash) are lost +silently: a genrule cannot see `.git` from the sandbox, and the binary reports +an "unknown version". Feed them through `--workspace_status_command` to a +`stamp = 1` rule. + The reference guide covers what is specific to translating its build system (for CMake: the build type and configure-time generated files).