Skip to content

The agent that grows with you

feat(release): key the stable archive by the attempt ref

ethernet8e0a256f4914
diff --git a/scripts/bundles/desktop_prepare.py b/scripts/bundles/desktop_prepare.py
index 630dbdff4e8..eda9d10bdf8 100644
--- a/scripts/bundles/desktop_prepare.py
+++ b/scripts/bundles/desktop_prepare.py
@@ -18,6 +18,8 @@ ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
+from scripts.releases.versioning import parse_attempt_ref
+
def git(source: Path, *args: str) -> str:
return subprocess.check_output(["git", *args], cwd=source, text=True, encoding="utf-8").rstrip("\r\n")
@@ -97,6 +99,7 @@ class BuildRequest:
bundle_env: dict[str, str | None]
channel_request: dict | None = None
release_epoch: int | None = None
+ archive_tag: str | None = None
@classmethod
def create(cls, source: Path, *, tag: str | None, commit: str | None, variant: str,
@@ -144,6 +147,7 @@ class BuildRequest:
commit = require_commit(release_commit) if release_commit else \
git(source, "rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
release_epoch = None
+ archive_tag = None
if tag:
canary = re.fullmatch(r"v\d+\.\d+\.\d+\+canary\.(20\d{6}T\d{6}Z)", tag)
if canary:
@@ -151,8 +155,12 @@ class BuildRequest:
.replace(tzinfo=timezone.utc).timestamp())
else:
claim_tag = os.environ.get("RELEASE_CLAIM_TAG", "")
- if claim_tag != tag + "-rc":
+ # The archive is keyed by the attempt ref; the payload version
+ # stays plain. Both come from the claim, never from the checkout.
+ parsed = parse_attempt_ref(claim_tag)
+ if parsed is None or parsed[0] != version:
raise ValueError("stable preparation requires its exact claim tag")
+ archive_tag = claim_tag
claim_object = os.environ.get("RELEASE_CLAIM_OBJECT", "")
if not re.fullmatch(r"[a-f0-9]{40}", claim_object) or \
git(source, "rev-parse", f"refs/tags/{claim_tag}") != claim_object:
@@ -168,7 +176,7 @@ class BuildRequest:
raise ValueError("channel sourceVersion differs from checkout project version")
version = channel_request["version"]
return cls(source, work, cache, commit, tag, version, variant, current_target(), bundle_env,
- channel_request, release_epoch)
+ channel_request, release_epoch, archive_tag)
def data(self) -> dict:
return {**asdict(self), "source": str(self.source), "work": str(self.work), "cache": str(self.cache)}
diff --git a/scripts/releases/channel_releases.py b/scripts/releases/channel_releases.py
index 0b516cc3fba..b4552896909 100644
--- a/scripts/releases/channel_releases.py
+++ b/scripts/releases/channel_releases.py
@@ -16,6 +16,7 @@ from hermes_cli.release_channels import (
from scripts.bundles.channel_artifacts import assemble
from scripts.releases import handoff, r2, stable
from scripts.releases.channels import ChannelPublisher, R2ChannelStore
+from scripts.releases.versioning import parse_attempt_ref
NATIVE_LEGS = ("darwin-arm64", "darwin-x64", "win32-arm64", "win32-x64", "windows-universal")
CANARY_NEEDS = ("validate", "build-win32", "build-darwin", "build-linux", "builds-table", "assemble-win32-bundle",
@@ -112,10 +113,15 @@ def admit_transaction(policy: str, env: dict, *, require_published: bool = False
repository = validate_repository(env.get("GITHUB_REPOSITORY"))
tag = env.get("RELEASE_TAG", "")
- if not tag.startswith("v") or not is_release_version(tag[1:]):
- raise ChannelError("Invalid protected release tag")
- if (policy == "canary-release") != is_canary_tag(tag):
- raise ChannelError("Protected release policy/tag mismatch")
+ if policy == "stable-release":
+ # Stable runs on its attempt ref; the final vX.Y.Z tag is a publish receipt.
+ if parse_attempt_ref(tag) is None:
+ raise ChannelError("Invalid protected release tag")
+ else:
+ if not tag.startswith("v") or not is_release_version(tag[1:]):
+ raise ChannelError("Invalid protected release tag")
+ if (policy == "canary-release") != is_canary_tag(tag):
+ raise ChannelError("Protected release policy/tag mismatch")
if env.get("GITHUB_ACTIONS") != "true":
raise ChannelError("Protected heads require the accepted release workflow")
default = ""
@@ -130,10 +136,13 @@ def admit_transaction(policy: str, env: dict, *, require_published: bool = False
or env.get("GITHUB_WORKFLOW_REF") not in expected):
raise ChannelError("Protected publication requires its stable release controller")
try:
- verified_tag, verified_commit, _claim = stable.final_context(env, run=run)
+ # final_context binds the final vX.Y.Z receipt to the claim; the
+ # release tag env carries the attempt ref, so patch the payload tag.
+ _verified_tag, verified_commit, _claim = stable.final_context(
+ {**env, "RELEASE_TAG": f"v{parse_attempt_ref(tag)[0]}"}, run=run)
except (ValueError, subprocess.CalledProcessError) as error:
raise ChannelError(str(error)) from error
- return verified_tag, verified_commit
+ return tag, verified_commit
elif policy == "canary-release":
if env.get("GITHUB_EVENT_NAME") != "workflow_dispatch":
raise ChannelError("Protected heads require the accepted release workflow")
@@ -171,14 +180,17 @@ def admit_transaction(policy: str, env: dict, *, require_published: bool = False
def accepted_stable(publisher: ChannelPublisher, env: dict, tag: str, commit: str,
release_epoch: int) -> dict:
+ """Read the accepted candidate from the attempt-scoped release archive."""
from hermes_cli.release_channels import decode_json, require_sha256
+ parsed = parse_attempt_ref(tag)
+ payload_tag = f"v{parsed[0]}" if parsed else tag
digest = require_sha256(env.get("CANDIDATE_MANIFEST_SHA256"))
key = f"releases/tag/{tag}/release-candidates.json"
if env.get("CANDIDATE_MANIFEST_URL") != publisher.public_base + "/" + key:
raise ChannelError("Accepted candidate URL differs from release archive")
candidate = decode_json(publisher.reader.read_bytes(key, digest))
- stable.validate_candidates(candidate, tag, commit, publisher.public_base, release_epoch)
+ stable.validate_candidates(candidate, payload_tag, commit, publisher.public_base, release_epoch)
return candidate
@@ -202,7 +214,7 @@ def advance_stable(env: dict, release: dict, root: Path) -> dict:
creds, base, bucket = r2.credentials()
store = R2ChannelStore(creds, base, bucket)
public_base = r2.public_base_url()
- key = f"releases/tag/{release['tag']}/release-candidates.json"
+ key = f"releases/tag/{release['claim_tag']}/release-candidates.json"
found = store.get(key)
if found is None:
raise ChannelError("Stable candidate manifest is unavailable")
@@ -211,7 +223,7 @@ def advance_stable(env: dict, release: dict, root: Path) -> dict:
raise ChannelError("Stable candidate manifest differs from the final release receipt")
scoped_env = {
**env,
- "RELEASE_TAG": release["tag"],
+ "RELEASE_TAG": release["claim_tag"],
"RELEASE_COMMIT": release["commit"],
"RELEASE_CLAIM_TAG": release["claim_tag"],
"RELEASE_CLAIM_OBJECT": release["claim_object"],
@@ -236,19 +248,31 @@ def verify_bootstrap(request: dict, manifest: dict, base: str, repository: str)
from hermes_cli.update_channel import is_canary_tag
canary = is_canary_tag(tag)
reader = ChannelReader(base, repository)
+ payload_tag = tag
if canary:
verify_canary_outputs(request, manifest, reader)
else:
- candidate = decode_json(reader.read_bytes(f"releases/tag/{tag}/release-candidates.json"))
- stable.validate_candidates(candidate, tag, request["commit"], base)
+ # The archive prefix is the attempt path the manifest itself names; a
+ # releaseTag that is already the attempt ref must agree with it.
+ keys = [package["artifact"]["key"] for package in manifest["packages"]]
+ archive = os.path.commonprefix(keys)
+ parsed = parse_attempt_ref(tag)
+ payload_tag = f"v{parsed[0]}" if parsed else tag
+ if parsed is not None and archive != f"releases/tag/{tag}/":
+ raise ChannelError("Bootstrap archive differs from its attempt ref")
+ if not archive.startswith("releases/tag/") or not archive.endswith("/"):
+ raise ChannelError("Bootstrap archive key is invalid")
+ candidate = decode_json(reader.read_bytes(archive + "release-candidates.json"))
+ stable.validate_candidates(candidate, candidate["tag"], request["commit"], base)
if decode_json(reader.read_bytes("releases/stable/release-candidates.json")) != candidate:
raise ChannelError("Bootstrap must use the current accepted stable transaction")
match_accepted_packages(manifest, candidate)
- identity = product_identity(tag)
+ identity = product_identity(payload_tag)
if any(request["identity"][key] != value for key, value in identity.items() if key != "token"):
raise ChannelError("Bootstrap must retain official native identity")
- release = json.loads(stable.output(["gh", "api", f"repos/{repository}/releases/tags/{tag}"]))
- commit = stable.output(["gh", "api", f"repos/{repository}/commits/{tag}", "--jq", ".sha"])
+ # The GitHub release is resolved by its final payload tag, never the draft.
+ release = json.loads(stable.output(["gh", "api", f"repos/{repository}/releases/tags/{payload_tag}"]))
+ commit = stable.output(["gh", "api", f"repos/{repository}/commits/{payload_tag}", "--jq", ".sha"])
if (release.get("draft") is not False or release.get("prerelease") is not canary
or not release.get("published_at") or commit != request["commit"]):
raise ChannelError("Bootstrap requires the published release")
@@ -290,25 +314,30 @@ def verify_canary_outputs(request: dict, manifest: dict, reader) -> None:
def publish_release(policy: str, env: dict, root: Path) -> dict:
tag, commit = admit_transaction(policy, env)
+ # Stable's tag is the attempt ref: native receipts, product identity and the
+ # channel record bind the plain payload tag, while the archive is attempt-scoped.
+ parsed = parse_attempt_ref(tag)
+ payload_tag = f"v{parsed[0]}" if parsed else tag
if env.get("R2_DISPOSABLE_RUN"):
raise ChannelError("Disposable receiver builds cannot enter production release publication")
publisher = ChannelPublisher(R2ChannelStore(*r2.credentials()), env["GITHUB_REPOSITORY"],
r2.public_base_url(), authorize=lambda action, record:
admit_transaction(policy, env, require_published=True))
name = select_channel(publisher, policy)
- identity = product_identity(tag)
+ identity = product_identity(payload_tag)
current = publisher._read(name)
if current:
# Explicit bootstrap may have reserved another opaque token for the same app.
identity["token"] = current[0]["identity"]["token"]
if identity != current[0]["identity"]:
raise ChannelError("Protected R2 identity differs from the existing product")
- release_epoch = stable.final_context(env)[2]["claim_epoch"] if policy == "stable-release" else None
+ release_epoch = stable.final_context({**env, "RELEASE_TAG": payload_tag})[2]["claim_epoch"] \
+ if policy == "stable-release" else None
accepted = accepted_stable(publisher, env, tag, commit, release_epoch) \
if release_epoch is not None else None
- handoff.fetch(tag, commit, list(NATIVE_LEGS), root,
+ handoff.fetch(payload_tag, commit, list(NATIVE_LEGS), root,
["metadata-*.json", "*.zip", "*.dmg", "*.blockmap", "*.msixbundle"], public_base=publisher.public_base)
- native = read_native_receipts(root, tag, commit)
+ native = read_native_receipts(root, payload_tag, commit)
windows = next(row for row in native["packages"] if row["platform"] == "windows")
if policy == "canary-release":
expected_windows = canary_windows_version(tag)
@@ -329,9 +358,9 @@ def publish_release(policy: str, env: dict, root: Path) -> dict:
return accepted_stable(publisher, env, tag, commit, release_epoch) == accepted
return True
- source_version = tag[1:].split("+", 1)[0]
- request = publisher.allocate_protected(name, commit, source_version, release_tag=tag,
- version=tag[1:], windows_version=windows["version"],
+ source_version = payload_tag[1:].split("+", 1)[0]
+ request = publisher.allocate_protected(name, commit, source_version, release_tag=payload_tag,
+ version=payload_tag[1:], windows_version=windows["version"],
identity=identity, policy=policy, release_gate=release_gate)
manifest, feeds = assemble(request, native, root, artifact_prefix=f"releases/tag/{tag}/")
if accepted is not None:
diff --git a/scripts/releases/docker.py b/scripts/releases/docker.py
index 7a9b7878ac3..69314b0f18f 100644
--- a/scripts/releases/docker.py
+++ b/scripts/releases/docker.py
@@ -13,6 +13,7 @@ MANIFEST_SCHEMA = 1
SHA256 = re.compile(r"[a-f0-9]{64}")
GIT_SHA = re.compile(r"[a-f0-9]{40}")
from hermes_cli.update_channel import STABLE_TAG_RE
+from scripts.releases.versioning import parse_attempt_ref
ARCHES = ("amd64", "arm64")
IMAGE = "nousresearch/hermes-agent"
@@ -21,7 +22,9 @@ class DockerReleaseError(ValueError):
def require_stable_tag(tag: str) -> str:
- if not isinstance(tag, str) or not STABLE_TAG_RE.fullmatch(tag or ""):
+ # The versioned image is tagged by the attempt ref; stable/latest move only
+ # at publish. The old v-suffix shape is dead.
+ if not isinstance(tag, str) or not (STABLE_TAG_RE.fullmatch(tag) or parse_attempt_ref(tag)):
raise DockerReleaseError(f"Not a stable release tag: {tag!r}")
return tag
diff --git a/scripts/render-builds-table.py b/scripts/render-builds-table.py
index 110a90e67af..9289a9cd11b 100644
--- a/scripts/render-builds-table.py
+++ b/scripts/render-builds-table.py
@@ -546,10 +546,14 @@ def r2_object_names_under(prefix: str) -> list[str]:
def r2_object_names(tag: str) -> list[str]:
"""Object keys in the R2 staging dir for `tag`, under releases/tag/<tag>/.
- A tag prefix and exact version match exclude neighboring releases.
+ A tag prefix and exact version match exclude neighboring releases. An
+ attempt ref filters by its plain version, which is what file names carry.
"""
+ from scripts.releases.versioning import parse_attempt_ref
+
keys = r2_object_names_under(f"releases/tag/{tag}/")
- return filter_names_for_version(keys, tag.lstrip("v"))
+ parsed = parse_attempt_ref(tag)
+ return filter_names_for_version(keys, parsed[0] if parsed else tag.lstrip("v"))
def splice(body: str, block: str) -> str:
diff --git a/tests/ci/test_stable_release_graph.py b/tests/ci/test_stable_release_graph.py
index 2b6ad0bb4a6..ae543ea1587 100644
--- a/tests/ci/test_stable_release_graph.py
+++ b/tests/ci/test_stable_release_graph.py
@@ -77,12 +77,18 @@ def test_claim_custody_and_final_payload_identity_reach_every_privileged_phase()
assert jobs["publish-docker"]["with"]["release-epoch"] == \
"${{ needs.admit.outputs.release-epoch }}"
complete = jobs["complete"]["steps"]
- final = next(i for i, step in enumerate(complete) if step.get("name", "").startswith("Create the final tag"))
- assert complete[final]["env"]["DOCKER_MANIFEST_DIGEST"] == \
- "${{ needs.publish-docker.outputs.manifest-digest }}"
+ # A6: the green workflow validates the accepted candidate archive; the
+ # final tag and the retarget move to the publication pass.
+ validation = next(i for i, step in enumerate(complete)
+ if step.get("name", "").startswith("Validate the accepted candidate archive"))
+ assert "DOCKER_MANIFEST_DIGEST" not in complete[validation]["env"]
+ assert "RELEASE_ID" not in complete[validation]["env"]
+ assert complete[validation]["env"]["CANDIDATE_MANIFEST_SHA256"] == \
+ "${{ needs.candidates.outputs.manifest-sha256 }}"
render = next(i for i, step in enumerate(complete) if step.get("name", "").startswith("Render the admitted"))
reconcile = next(i for i, step in enumerate(complete) if step.get("name", "").startswith("Reconcile ordered"))
- assert final < render < reconcile
+ assert validation < render < reconcile
+ assert not any("Create the final tag" in step.get("name", "") for step in complete)
def test_docker_dev_stamp_checkout_has_release_history():
diff --git a/tests/scripts/test_desktop_preparation.py b/tests/scripts/test_desktop_preparation.py
index bd6f631ce82..3f97d2613b7 100644
--- a/tests/scripts/test_desktop_preparation.py
+++ b/tests/scripts/test_desktop_preparation.py
@@ -36,12 +36,12 @@ def test_stable_build_accepts_the_admitted_commit_before_the_final_tag_exists(tm
source, commit = _project(tmp_path)
subprocess.run([
"git", "-c", "user.name=Fixture", "-c", "[email protected]",
- "-c", "tag.gpgSign=false", "tag", "-a", "v1.2.4-rc", "-m", "claim",
+ "-c", "tag.gpgSign=false", "tag", "-a", "rc.1-v1.2.4", "-m", "claim",
], cwd=source, check=True, env={**__import__("os").environ,
"GIT_COMMITTER_DATE": "2026-08-29T01:02:03Z"})
- monkeypatch.setenv("RELEASE_CLAIM_TAG", "v1.2.4-rc")
+ monkeypatch.setenv("RELEASE_CLAIM_TAG", "rc.1-v1.2.4")
claim_object = subprocess.check_output(
- ["git", "rev-parse", "v1.2.4-rc"], cwd=source, text=True,
+ ["git", "rev-parse", "rc.1-v1.2.4"], cwd=source, text=True,
).strip()
monkeypatch.setenv("RELEASE_CLAIM_OBJECT", claim_object)
request = BuildRequest.create(
@@ -51,6 +51,7 @@ def test_stable_build_accepts_the_admitted_commit_before_the_final_tag_exists(tm
assert request.commit == commit
assert request.version == "1.2.4"
+ assert request.archive_tag == "rc.1-v1.2.4"
assert request.release_epoch == 1787965323
env = identity_environment(request, "bundled", {"HERMES_RELEASE_EPOCH": "1"})
assert env["HERMES_RELEASE_EPOCH"] == "1787965323"
@@ -63,6 +64,25 @@ def test_stable_build_accepts_the_admitted_commit_before_the_final_tag_exists(tm
)
+def test_stable_build_rejects_a_claim_tag_for_another_version(tmp_path, monkeypatch):
+ from scripts.bundles.desktop_prepare import BuildRequest
+
+ source, commit = _project(tmp_path)
+ subprocess.run([
+ "git", "-c", "user.name=Fixture", "-c", "[email protected]",
+ "-c", "tag.gpgSign=false", "tag", "-a", "rc.2-v1.2.5", "-m", "claim",
+ ], cwd=source, check=True, env={**__import__("os").environ,
+ "GIT_COMMITTER_DATE": "2026-08-29T01:02:03Z"})
+ monkeypatch.setenv("RELEASE_CLAIM_TAG", "rc.2-v1.2.5")
+ monkeypatch.setenv("RELEASE_CLAIM_OBJECT", subprocess.check_output(
+ ["git", "rev-parse", "rc.2-v1.2.5"], cwd=source, text=True).strip())
+ with pytest.raises(ValueError, match="exact claim tag"):
+ BuildRequest.create(
+ source, tag="v1.2.4", commit=None, release_commit=commit, variant="bundled",
+ work=tmp_path / "work", cache=tmp_path / "cache", bundle_env={},
+ )
+
+
def test_prepared_input_roundtrip_rejects_mutation_and_foreign_source(tmp_path):
from scripts.bundles.desktop_prepare import BuildRequest, PreparedDesktop
diff --git a/tests/scripts/test_release_channels.py b/tests/scripts/test_release_channels.py
index 1344f7739f4..51cca36ae92 100644
--- a/tests/scripts/test_release_channels.py
+++ b/tests/scripts/test_release_channels.py
@@ -468,12 +468,12 @@ def test_accepted_release_receipts_feed_the_protected_head_without_rebuilding(tm
def test_protected_transaction_refuses_custom_workflow_and_unpublished_release(monkeypatch):
from scripts.releases import channel_releases
from hermes_cli.release_channels import ChannelError
- tag, commit = "v2.0.0", "a" * 40
+ attempt, tag, commit = "rc.1-v2.0.0", "v2.0.0", "a" * 40
env = {"GITHUB_ACTIONS": "true", "GITHUB_EVENT_NAME": "workflow_dispatch",
- "GITHUB_REPOSITORY": "example/hermes-agent", "RELEASE_TAG": tag,
- "RELEASE_COMMIT": commit, "RELEASE_CLAIM_TAG": tag + "-rc",
+ "GITHUB_REPOSITORY": "example/hermes-agent", "RELEASE_TAG": attempt,
+ "RELEASE_COMMIT": commit, "RELEASE_CLAIM_TAG": attempt,
"RELEASE_CLAIM_OBJECT": "b" * 40,
- "GITHUB_WORKFLOW_REF": "example/hermes-agent/.github/workflows/stable-release.yml@refs/tags/" + tag + "-rc"}
+ "GITHUB_WORKFLOW_REF": "example/hermes-agent/.github/workflows/stable-release.yml@refs/tags/" + attempt}
published = [True]
def final_context(_env, run):
@@ -488,14 +488,53 @@ def test_protected_transaction_refuses_custom_workflow_and_unpublished_release(m
return "main"
return ""
- assert channel_releases.admit_transaction("stable-release", env, run=run) == (tag, commit)
+ assert channel_releases.admit_transaction("stable-release", env, run=run) == (attempt, commit)
published[0] = False
with pytest.raises(ChannelError, match="published"):
channel_releases.admit_transaction("stable-release", env, run=run)
published[0] = True
with pytest.raises(ChannelError, match="controller"):
channel_releases.admit_transaction("stable-release", dict(env, GITHUB_WORKFLOW_REF="custom.yml"), run=run)
- from hermes_cli.release_channels import canonical_json
+ with pytest.raises(ChannelError, match="protected release tag"):
+ channel_releases.admit_transaction(
+ "stable-release", dict(env, RELEASE_TAG=tag + "-rc"), run=run)
+
+
+def test_stable_admission_requires_an_attempt_ref_release_tag(monkeypatch):
+ from scripts.releases import channel_releases
+ from hermes_cli.release_channels import ChannelError
+ attempt, commit = "rc.2-v1.2.3", "c" * 40
+ env = {"GITHUB_ACTIONS": "true", "GITHUB_EVENT_NAME": "workflow_dispatch",
+ "GITHUB_REPOSITORY": "example/hermes-agent", "RELEASE_TAG": attempt,
+ "RELEASE_COMMIT": commit, "RELEASE_CLAIM_TAG": attempt,
+ "RELEASE_CLAIM_OBJECT": "b" * 40,
+ "GITHUB_WORKFLOW_REF": "example/hermes-agent/.github/workflows/stable-release.yml@refs/tags/" + attempt}
+ monkeypatch.setattr(channel_releases.stable, "final_context",
+ lambda _env, run: ("v1.2.3", commit, {}))
+
+ def run(command):
+ if command[-1] == ".default_branch":
+ return "main"
+ return ""
+
+ assert channel_releases.admit_transaction("stable-release", env, run=run) == (attempt, commit)
+ # The v-tag the final receipt binds is derived from the attempt ref, so the
+ # candidate manifest custody is checked against the claim's own version.
+ seen = {}
+ def final_context_checked(patched_env, run):
+ seen["RELEASE_TAG"] = patched_env["RELEASE_TAG"]
+ return "v1.2.3", commit, {}
+ monkeypatch.setattr(channel_releases.stable, "final_context", final_context_checked)
+ channel_releases.admit_transaction("stable-release", env, run=run)
+ assert seen["RELEASE_TAG"] == "v1.2.3"
+ with pytest.raises(ChannelError, match="protected release tag"):
+ channel_releases.admit_transaction("stable-release", dict(env, RELEASE_TAG="v1.2.3"), run=run)
+
+
+def test_accepted_stable_reads_the_release_archive_by_tag(monkeypatch):
+ from scripts.releases import channel_releases
+ from hermes_cli.release_channels import ChannelError, canonical_json
+ tag, commit = "v2.0.0", "c" * 40
with object_server() as (url, objects, headers, requests, faults):
pub = publisher(url)
# Exercise HTTPS authority validation through the loopback transport.
diff --git a/tests/scripts/test_release_docker_cli.py b/tests/scripts/test_release_docker_cli.py
index 9b4abb76209..babedf3a92e 100644
--- a/tests/scripts/test_release_docker_cli.py
+++ b/tests/scripts/test_release_docker_cli.py
@@ -53,6 +53,18 @@ def test_cli_manifest_and_verify(tmp_path):
assert result.returncode == 1 and '::error::' in result.stderr
+def test_manifest_admits_the_attempt_ref_image_tag():
+ from scripts.releases.docker import DockerReleaseError, build_manifest, parse_manifest
+
+ manifest = build_manifest("rc.1-v1.2.3", "a" * 40, {"amd64": "b" * 64, "arm64": "c" * 64})
+ assert parse_manifest(json.dumps(manifest).encode())["tag"] == "rc.1-v1.2.3"
+ # The old suffix shape is dead; a recut reuses no image tag.
+ with pytest.raises(DockerReleaseError):
+ build_manifest("v1.2.3-rc", "a" * 40, {"amd64": "b" * 64, "arm64": "c" * 64})
+ with pytest.raises(DockerReleaseError):
+ parse_manifest(json.dumps(dict(manifest, tag="not-a-tag")).encode())
+
+
def test_promotion_reuses_the_receipt_digest_without_rebuilding():
from scripts.releases.docker import DockerReleaseError, promote_stable
diff --git a/tests/scripts/test_render_builds_publication.py b/tests/scripts/test_render_builds_publication.py
index 95e00957081..2c9b11625c6 100644
--- a/tests/scripts/test_render_builds_publication.py
+++ b/tests/scripts/test_render_builds_publication.py
@@ -128,6 +128,15 @@ def test_exact_version_and_flat_name_boundaries(version, name):
assert rbt.parse_assets([name])['HermesBundled'][('win', 'x64')] == (name, 'msix')
+def test_attempt_archive_objects_are_listed_by_their_plain_version(monkeypatch):
+ keys = ['releases/tag/rc.2-v1.2.3/HermesBundled-1.2.3-win-x64.msix',
+ 'releases/tag/rc.2-v1.2.3/HermesBundled-1.2.3-win-x64.msix.blockmap',
+ 'releases/tag/rc.2-v1.2.3/latest.yml',
+ 'releases/tag/rc.2-v1.2.3/HermesBundled-1.2.4-win-x64.msix']
+ monkeypatch.setattr(rbt, 'r2_object_names_under', lambda prefix: keys)
+ assert rbt.r2_object_names('rc.2-v1.2.3') == [keys[0]]
+
+
@pytest.mark.parametrize('current,tag,allowed', [
(None, 'v1.2.3', True), ('garbage', 'v1.2.3', True),
('v1.2.3', 'v1.2.3+canary.20260818T101010Z', False),