Skip to content

The agent that grows with you

fix(release): preserve reachable version identity in CI

ethernet7e9d4239c638
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index d5ccfeed280..6ded3f446e2 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -164,6 +164,9 @@ jobs:
# Release calls are dispatched on the stable tag: pin to the exact
# candidate commit, never a mutable branch ref.
ref: ${{ needs.mode.outputs.release == 'true' && github.sha || '' }}
+ # Dev identity is the distance from the highest reachable final
+ # release, so the stamp needs both its ancestry and release tags.
+ fetch-depth: 0
- name: Stamp release build context
if: needs.mode.outputs.release == 'true'
diff --git a/tests/ci/test_stable_release_graph.py b/tests/ci/test_stable_release_graph.py
index b6acdc3f57a..d2a3e94713b 100644
--- a/tests/ci/test_stable_release_graph.py
+++ b/tests/ci/test_stable_release_graph.py
@@ -80,6 +80,13 @@ def test_claim_custody_and_final_payload_identity_reach_every_privileged_phase()
assert final < render < reconcile
+def test_docker_dev_stamp_checkout_has_release_history():
+ build = workflow("docker.yml")["jobs"]["build"]
+ checkout = next(step for step in build["steps"] if "actions/checkout@" in step.get("uses", ""))
+
+ assert checkout["with"]["fetch-depth"] == "0"
+
+
def test_release_gates_extract_consumer_facing_versions():
release_jobs = workflow("stable-release.yml")["jobs"]
bootstrap = next(
diff --git a/tests/scripts/test_source_build_env.py b/tests/scripts/test_source_build_env.py
index 30945c2b762..d986838d61a 100644
--- a/tests/scripts/test_source_build_env.py
+++ b/tests/scripts/test_source_build_env.py
@@ -17,6 +17,7 @@ def _stamp_probe(tmp_path, shell):
repo = tmp_path / "installed source"
for relative in (
"scripts/write_install_stamp.py", "hermes_cli/__init__.py",
+ "scripts/releases/distance.py", "scripts/releases/versioning.py",
"hermes_cli/update_channel.py", "hermes_cli/release_channels.py",
"pm/paths.py", "pm/environments.py",
"hermes_cli/steward.py", "hermes_constants.py",
@@ -40,6 +41,7 @@ def _stamp_probe(tmp_path, shell):
git("add", ".")
git("commit", "-qm", "OLD")
old = git("rev-parse", "HEAD")
+ git("tag", "v1.0.0", old)
git("commit", "--allow-empty", "-qm", "NEW")
new = git("rev-parse", "HEAD")
# Control: this is the real stamp writer's CI preference, not a source-text assertion.
@@ -138,6 +140,10 @@ if ($LASTEXITCODE) { exit $LASTEXITCODE }
stamp = json.loads(Path(env["PROBE_OUT"]).read_text(encoding="utf-8-sig"))
assert (stamp["commit"], stamp["branch"], stamp["source"], stamp["payload"]) == (
sha, "installed", "local", "bootstrap")
+ distance = 0 if sha == old else 1
+ display = "1.0.0" if distance == 0 else f"1.0.0+1.g{sha[:7]}"
+ assert (stamp["baseVersion"], stamp["distance"], stamp["displayVersion"]) == (
+ "1.0.0", distance, display)
child = json.loads(Path(env["PROBE_ENV"]).read_text(encoding="utf-8-sig"))
assert not overrides.keys() & child.keys()
assert child["GIT_CONFIG_GLOBAL"] == env["GIT_CONFIG_GLOBAL"]