Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(release): bind security decisions to the originating run (#6986)

LearningCircuit24e07bce1a69
diff --git a/.github/SECURITY_ALERTS.md b/.github/SECURITY_ALERTS.md
index 1bf468126e..6250a12e71 100644
--- a/.github/SECURITY_ALERTS.md
+++ b/.github/SECURITY_ALERTS.md
@@ -59,8 +59,10 @@ release commit, workflow run, and build attempt. PyPI dispatches carry the
artifact ID. The verifier checks GitHub's artifact/run metadata, main ancestry,
the successful build and upload time, and the archive digest before reading its
deadline. A caller-supplied `release_deadline` is never used. Missing, expired,
-tampered, or unrelated artifacts fail closed. A partial rerun keeps the artifact
-ID from the original successful build, even when the parent run's attempt changes.
+tampered, or unrelated artifacts fail closed. A partial rerun that carries over
+the original successful build keeps its artifact ID, even when the parent run's
+attempt changes. Once a rerun runs the build again, the publisher accepts only
+the decision that new build records.
Each publication checks the original deadline after environment approval,
including publish-job reruns. The explicit value `none` is recorded only when
diff --git a/.github/scripts/release_package.py b/.github/scripts/release_package.py
index 2bf4c4c3dc..f8f4071d50 100644
--- a/.github/scripts/release_package.py
+++ b/.github/scripts/release_package.py
@@ -207,9 +207,13 @@ def executed_attempt(job, history):
uploaded an artifact, so identify carried-over copies by their
unchanged execution record. A record missing that data counts as a
fresh execution of its own attempt. For the package job that fails
- closed by demanding a newer artifact; for a check job it can only
- overstate the check's attempt, and since every check needs pip Install
- Verification it cannot have run before a fresher package build.
+ closed by demanding a newer artifact. For a check job it can only
+ overstate the check's attempt, which is harmless: every check needs pip
+ Install Verification, so it cannot have run before a fresher package
+ build. For ``build``, whose attempt names the security decision, it
+ also fails closed but can block recovery: the overstated attempt names
+ a decision that the carried-over copy never uploaded, so the original
+ decision is rejected until a fresh build records a new one.
"""
def execution(row):
@@ -256,6 +260,11 @@ def validate_source(repo, payload, fetch=api, expected_attempt=None):
artifact_id = fullmatch(
r"[1-9][0-9]*", str(payload["artifact_id"]), "artifact ID"
)
+ decision_id = fullmatch(
+ r"[1-9][0-9]*",
+ str(payload.get("release_decision_artifact_id", "")),
+ "release decision artifact ID",
+ )
fullmatch(r"[0-9a-f]{64}", payload["manifest_sha256"], "manifest SHA256")
fullmatch(r"v[0-9][A-Za-z0-9.+!_-]*", payload["tag"], "release tag")
root = f"repos/{repo}"
@@ -322,11 +331,16 @@ def validate_source(repo, payload, fetch=api, expected_attempt=None):
# attempt's while this attempt has yet to rebuild. "Re-run failed jobs"
# lists its carried-over copies from the start of the attempt, so the
# package job must have a record (fresh or carried) in the current one.
- package_record = max(records[package_job], key=lambda row: row["id"])
- if job_attempt(package_record) != current_attempt:
- raise ValueError(
- "Package job has no record in the current source run attempt"
- )
+ # ``build`` needs the same guard because its attempt names the security
+ # decision checked below. Re-running any job it depends on, such as the
+ # alert check that recomputes the deadline, re-runs build too, and until
+ # the new build is listed the previous record selects the old decision.
+ for name, label in ((package_job, "Package job"), ("build", "Build job")):
+ record = max(records[name], key=lambda row: row["id"])
+ if job_attempt(record) != current_attempt:
+ raise ValueError(
+ f"{label} has no record in the current source run attempt"
+ )
package_attempt = attempts[package_job]
if any(attempt < package_attempt for attempt in attempts.values()):
raise ValueError("Required source checks predate the package build")
@@ -376,6 +390,21 @@ def validate_source(repo, payload, fetch=api, expected_attempt=None):
raise ValueError(
"Source package build changed after artifact verification"
)
+ # A same-run decision from an older build can have a different deadline.
+ # Bind the existing payload ID to the latest executed build, both before
+ # and after approval. Carried-over jobs retain their original execution
+ # attempt; a rebuild must use the newly recorded immutable decision.
+ decision = fetch(f"{root}/actions/artifacts/{decision_id}")
+ if (
+ decision["name"] != f"release-security-decision-{attempts['build']}"
+ or decision["expired"] is not False
+ or str(decision["id"]) != decision_id
+ or str(decision["workflow_run"]["id"]) != run_id
+ or decision["workflow_run"]["head_sha"] != sha
+ ):
+ raise ValueError(
+ "Security decision is not from the latest successful release build"
+ )
return match[1]
diff --git a/.github/scripts/release_security_decision.py b/.github/scripts/release_security_decision.py
index b09606a5a6..c69f2da04f 100644
--- a/.github/scripts/release_security_decision.py
+++ b/.github/scripts/release_security_decision.py
@@ -2,8 +2,10 @@
"""Record a release gate decision and verify its immutable GitHub artifact.
Dispatch payloads select an artifact, never a deadline. Only a successful build
-in this repository's release workflow, on a commit reachable from main, can
-authorize publication. The recorded attempt remains valid on partial reruns.
+in this repository's release workflow, on a commit reachable from main and in
+the tested package's release run, can authorize publication. The recorded
+attempt stays valid here on partial reruns; release_package.py source also
+requires it to come from the latest executed build.
"""
from __future__ import annotations
@@ -125,9 +127,12 @@ def successful_build(endpoint: str, run_id: int, attempt: int) -> dict:
return build
-def verify_decision(repository: str, sha: str, artifact_id: str) -> str:
+def verify_decision(
+ repository: str, sha: str, artifact_id: str, expected_run_id: str
+) -> str:
validate_identity(repository, sha)
number = positive_integer(artifact_id)
+ expected_run = positive_integer(expected_run_id)
root = f"/repos/{repository}"
artifact_endpoint = f"{root}/actions/artifacts/{number}"
artifact = api_object(artifact_endpoint)
@@ -147,6 +152,10 @@ def verify_decision(repository: str, sha: str, artifact_id: str) -> str:
require(isinstance(source, dict), "Artifact has no workflow provenance")
run_id = source.get("id")
require(type(run_id) is int and run_id > 0, "Artifact has no source run")
+ require(
+ run_id == expected_run,
+ "Decision does not match the tested package release run",
+ )
require(
source.get("head_sha") == sha, "Artifact commit does not match release"
)
@@ -238,13 +247,14 @@ def main() -> int:
write.add_argument("--deadline", required=True)
write.add_argument("--output", type=Path, required=True)
verify.add_argument("--artifact-id", required=True)
+ verify.add_argument("--run-id", required=True)
args = parser.parse_args()
try:
if args.mode == "record":
record_decision(args)
else:
deadline = verify_decision(
- args.repository, args.sha, args.artifact_id
+ args.repository, args.sha, args.artifact_id, args.run_id
)
if path := os.environ.get("GITHUB_OUTPUT"):
with Path(path).open("a", encoding="utf-8") as output:
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 6157bc471e..848c9f264f 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -43,11 +43,12 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
RELEASE_SHA: ${{ github.event.client_payload.sha }}
+ RELEASE_RUN_ID: ${{ github.event.client_payload.run_id }}
RELEASE_DECISION_ARTIFACT_ID: ${{ github.event.client_payload.release_decision_artifact_id }}
run: |
python3 .github/scripts/release_security_decision.py verify \
--repository "$GITHUB_REPOSITORY" --sha "$RELEASE_SHA" \
- --artifact-id "$RELEASE_DECISION_ARTIFACT_ID"
+ --run-id "$RELEASE_RUN_ID" --artifact-id "$RELEASE_DECISION_ARTIFACT_ID"
- name: Download tested release artifact by ID
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 2267156975..8d0b69604c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1828,7 +1828,7 @@ jobs:
+ ' If no publisher run exists, re-run the failed release jobs to dispatch it.'
+ ' Expired artifacts or security decisions require a fresh release gate run; do not rebuild in the publisher.'
+ ' After PyPI succeeds, re-run monitor-pypi and its dependent jobs in the original release run so create-release sees a successful monitor.'
- + ' A dispatch is rejected once a later release attempt rebuilt the package; publish the dispatch from that newer attempt instead.'
+ + ' A dispatch is rejected once a later release attempt rebuilt the package or ran build again, directly or because a job it depends on (for example the code-scanning alert check or a test gate) was re-run, even if the package bytes are unchanged; publish the dispatch from that newer attempt instead.'
+ ' See docs/RELEASE_GUIDE.md "Recovery from PyPI failure".';
const body = `## PyPI publish failed for ${tag}\n\nResult: \`${pypi}\`\n\nNote: At this point in the atomicity flow, Docker promote (publish-docker job) has already succeeded — the Docker release tags exist and are signed. Only PyPI and the GitHub Release are missing.\n\n${action}`;
diff --git a/docs/RELEASE_GUIDE.md b/docs/RELEASE_GUIDE.md
index e458536177..a506d8e6c2 100644
--- a/docs/RELEASE_GUIDE.md
+++ b/docs/RELEASE_GUIDE.md
@@ -234,6 +234,13 @@ succeeded, PyPI failed. At this point Docker `:1.6.9` / `:1.6` /
success, such as "Re-run failed jobs" after a later job failed, keep
the original build, so its original artifact can still be published.
The original security decision and its recorded deadline are verified too.
+ The decision must come from the same originating release run as the tested
+ packages and its latest executed `build` job. These bindings are checked
+ again after publisher approval. A decision from another run or an earlier
+ build of the same commit is rejected; a carried-over successful build keeps
+ its original decision. A rerun that runs `build` again, directly or because
+ a job it depends on was re-run, rejects the old dispatch from the start of
+ that attempt; publish from the dispatch its `trigger-pypi` job sends.
Rerunning publisher jobs preserves that decision; an expired or unavailable
decision requires a new release run after remediation or a separately reviewed
exception update. Recovery cannot override the original deadline.
diff --git a/tests/ci/standalone/test_release_package.py b/tests/ci/standalone/test_release_package.py
index b8c22c0379..ed8bd971d7 100644
--- a/tests/ci/standalone/test_release_package.py
+++ b/tests/ci/standalone/test_release_package.py
@@ -383,6 +383,11 @@ class SourceTests(unittest.TestCase):
"expired": False,
"workflow_run": {"id": 123, "head_sha": SHA},
}
+ self.decision_artifact = {
+ "expired": False,
+ "workflow_run": {"id": 123, "head_sha": SHA},
+ }
+ self.select_decision(1)
self.run_artifacts = [{"name": "verified-python-dist-1"}]
self.ancestry = "ahead"
self.calls = []
@@ -404,6 +409,10 @@ class SourceTests(unittest.TestCase):
return {"jobs": self.jobs[(page - 1) * 100 : page * 100]}
if "/artifacts?" in endpoint:
return {"artifacts": self.run_artifacts}
+ if endpoint.endswith(
+ f"/artifacts/{self.payload['release_decision_artifact_id']}"
+ ):
+ return self.decision_artifact
if "/artifacts/" in endpoint:
return self.artifact
if "/compare/" in endpoint:
@@ -413,6 +422,12 @@ class SourceTests(unittest.TestCase):
def validate(self):
return POLICY.validate_source("owner/repo", self.payload, self.fetch)
+ def select_decision(self, attempt):
+ self.decision_artifact.update(
+ id=788 + attempt, name=f"release-security-decision-{attempt}"
+ )
+ self.payload["release_decision_artifact_id"] = str(788 + attempt)
+
def rerun(self, *names, attempt=2):
"""Model a GitHub rerun: named jobs run again on new runners; every
other job is carried into the new attempt as a new record that keeps
@@ -450,6 +465,7 @@ class SourceTests(unittest.TestCase):
self.validate()
self.artifact["name"] = "verified-python-dist-2"
self.run_artifacts.append({"name": "verified-python-dist-2"})
+ self.select_decision(2)
self.assertEqual(self.validate(), "2")
def test_rerun_failed_jobs_keeps_the_carried_over_package_build(self):
@@ -458,6 +474,7 @@ class SourceTests(unittest.TestCase):
# uploads no new artifact.
self.jobs[1]["conclusion"] = "failure"
self.rerun("build")
+ self.select_decision(2)
self.assertTrue(
any(
job["name"] == "release-gate / pip Install Verification"
@@ -528,6 +545,14 @@ class SourceTests(unittest.TestCase):
"release-gate / Release Gate Summary",
}
] + real
+ # Attempt 2 also listed a new build record (93060201602) because build
+ # depends on the re-run jobs. That run skipped build again; here it
+ # succeeds and records its own decision.
+ build = next(job for job in self.jobs if job["name"] == "build")
+ self.jobs.append(
+ {**build, "id": 93060201602, "run_attempt": 2, **self.execution(7)}
+ )
+ self.select_decision(2)
self.run["run_attempt"] = 2
self.assertEqual(self.validate(), "1")
self.assertEqual(
@@ -647,11 +672,24 @@ class SourceTests(unittest.TestCase):
"EXPECTED_ARTIFACT_ATTEMPT": cached_attempt,
}
phases = (
- ("original", (), None, 0),
- ("partial rerun", ("build",), 2, 0),
- ("rebuilt package", names, 3, 1),
+ ("original", (), None, 0, None),
+ ("carried-over jobs", (), 2, 0, None),
+ (
+ "rebuilt release decision",
+ ("build",),
+ 3,
+ 1,
+ "Security decision is not from the latest successful release build",
+ ),
+ (
+ "rebuilt package",
+ names,
+ 4,
+ 1,
+ "Artifact is not from the latest successful package build",
+ ),
)
- for phase, rerun, attempt, result in phases:
+ for phase, rerun, attempt, result, error in phases:
if attempt is not None:
self.rerun(*rerun, attempt=attempt)
output.write_text("", encoding="utf-8")
@@ -670,10 +708,7 @@ class SourceTests(unittest.TestCase):
self.assertEqual(POLICY.main(), result)
if result:
self.assertEqual(output.read_text(), "")
- self.assertIn(
- "Artifact is not from the latest successful package build",
- log.getvalue(),
- )
+ self.assertIn(error, log.getvalue())
else:
self.assertEqual(
output.read_text(), "artifact_attempt=1\n"
@@ -681,6 +716,7 @@ class SourceTests(unittest.TestCase):
def test_partial_reruns_preserve_the_package_build_attempt(self):
self.rerun("release-gate / Release Gate Summary", "build")
+ self.select_decision(2)
self.assertEqual(self.validate(), "1")
self.rerun(
"release-gate / Package install (3.13, wheel)",
@@ -688,11 +724,13 @@ class SourceTests(unittest.TestCase):
"build",
attempt=3,
)
+ self.select_decision(3)
self.assertEqual(self.validate(), "1")
def test_rebuilt_package_requires_fresh_install_and_release_gates(self):
self.run["run_attempt"] = 2
self.artifact["name"] = "verified-python-dist-2"
+ self.select_decision(2)
for job in self.jobs:
job["run_attempt"] = 2
for job in self.jobs:
@@ -791,8 +829,124 @@ class SourceTests(unittest.TestCase):
self.validate()
self.artifact["name"] = "verified-python-dist-2"
self.run_artifacts.append({"name": "verified-python-dist-2"})
+ self.select_decision(2)
self.assertEqual(self.validate(), "2")
+ def test_same_run_older_decision_cannot_authorize_a_rebuilt_package(self):
+ self.rerun(*(job["name"] for job in self.jobs))
+ self.artifact["name"] = "verified-python-dist-2"
+ self.run_artifacts.append({"name": "verified-python-dist-2"})
+ with self.assertRaisesRegex(
+ ValueError, "latest successful release build"
+ ):
+ self.validate()
+ self.select_decision(2)
+ self.assertEqual(self.validate(), "2")
+
+ def test_publish_recheck_rejects_new_build_with_unchanged_package(self):
+ original_attempt = self.validate()
+ self.rerun("release-gate / Release Gate Summary", "build")
+ # The cached dispatch still selects decision 1, although a new build
+ # has recorded decision 2. Package-only validation would accept it.
+ with self.assertRaisesRegex(
+ ValueError, "latest successful release build"
+ ):
+ POLICY.validate_source(
+ "owner/repo",
+ self.payload,
+ self.fetch,
+ expected_attempt=original_attempt,
+ )
+ self.select_decision(2)
+ self.assertEqual(
+ POLICY.validate_source(
+ "owner/repo",
+ self.payload,
+ self.fetch,
+ expected_attempt=original_attempt,
+ ),
+ "1",
+ )
+
+ def test_pending_build_rerun_cannot_reuse_the_previous_decision(self):
+ # Re-running a job that build depends on, such as the alert check
+ # that recomputes the deadline, re-runs the summary and build too.
+ # The jobs API omits them while they wait on ``needs``, so attempt 2
+ # lists only the carried package jobs at first, and then the summary
+ # without build. The cached dispatch's decision 1 must not pass the
+ # pre-approval check or the post-approval recheck in either state.
+ original_attempt = self.validate()
+ self.rerun("release-gate / Release Gate Summary", "build")
+ summary, build = self.jobs[-2:]
+ self.assertEqual(
+ [summary["name"], build["name"], build["run_attempt"]],
+ ["release-gate / Release Gate Summary", "build", 2],
+ )
+ listed = self.jobs[:-2]
+ for phase, jobs in (
+ ("summary and build waiting", listed),
+ ("build waiting", [*listed, summary]),
+ ):
+ self.jobs = jobs
+ for expected in (None, original_attempt):
+ with (
+ self.subTest(phase=phase, expected=expected),
+ self.assertRaisesRegex(
+ ValueError,
+ "Build job has no record in the current source run",
+ ),
+ ):
+ POLICY.validate_source(
+ "owner/repo",
+ self.payload,
+ self.fetch,
+ expected_attempt=expected,
+ )
+ # Once the new build has run, only the decision it recorded counts.
+ self.jobs = [*listed, summary, build]
+ with self.assertRaisesRegex(
+ ValueError, "latest successful release build"
+ ):
+ self.validate()
+ self.select_decision(2)
+ self.assertEqual(self.validate(), "1")
+
+ def test_carried_build_keeps_its_original_decision_across_later_attempts(
+ self,
+ ):
+ self.rerun()
+ self.rerun(attempt=3)
+ self.assertEqual(self.validate(), "1")
+ self.assertEqual(
+ self.decision_artifact["name"], "release-security-decision-1"
+ )
+
+ def test_invalid_decision_id_fails_before_api(self):
+ for value in (None, "", "none", "0", "789\n", True):
+ with self.subTest(value=value):
+ self.payload["release_decision_artifact_id"] = value
+ with self.assertRaises(ValueError):
+ self.validate()
+ self.assertEqual(self.calls, [])
+ del self.payload["release_decision_artifact_id"]
+ with self.assertRaises(ValueError):
+ self.validate()
+ self.assertEqual(self.calls, [])
+
+ def test_decision_ownership_expiry_and_build_attempt_are_required(self):
+ original = copy.deepcopy(self.decision_artifact)
+ for changes in (
+ {"expired": True},
+ {"id": 999},
+ {"name": "release-security-decision-2"},
+ {"name": "verified-python-dist-1"},
+ {"workflow_run": {"id": 124, "head_sha": SHA}},
+ {"workflow_run": {"id": 123, "head_sha": "c" * 40}},
+ ):
+ self.decision_artifact = {**original, **changes}
+ with self.subTest(changes=changes), self.assertRaises(ValueError):
+ self.validate()
+
def test_wrong_workflow_commit_event_and_repository_fail(self):
original = copy.deepcopy(self.run)
for changes in (
diff --git a/tests/ci/test_package_artifact_policy.py b/tests/ci/test_package_artifact_policy.py
index 7f0af20027..3d00f8fa57 100644
--- a/tests/ci/test_package_artifact_policy.py
+++ b/tests/ci/test_package_artifact_policy.py
@@ -291,6 +291,16 @@ def test_publisher_requires_the_package_jobs_named_by_the_workflows():
assert "${{" not in name, "unresolved matrix job name"
names.append(f"{prefix} / {name}")
names.append(release["jobs"]["build"].get("name", "build"))
+ # The publisher also requires the security decision recorded by build.
+ upload = next(
+ step
+ for step in release["jobs"]["build"]["steps"]
+ if step.get("id") == "security-decision"
+ )
+ decision_name = upload["with"]["name"].replace(
+ "${{ github.run_attempt }}", "1"
+ )
+ assert "${{" not in decision_name, "unresolved decision artifact name"
jobs = [
{
"id": i,
@@ -325,11 +335,18 @@ def test_publisher_requires_the_package_jobs_named_by_the_workflows():
"expired": False,
"workflow_run": {"id": 123, "head_sha": sha},
},
+ f"{root}/actions/artifacts/789": {
+ "id": 789,
+ "name": decision_name,
+ "expired": False,
+ "workflow_run": {"id": 123, "head_sha": sha},
+ },
}
payload = {
"sha": sha,
"run_id": "123",
"artifact_id": "456",
+ "release_decision_artifact_id": "789",
"manifest_sha256": "b" * 64,
"tag": "v1.2.3",
}
diff --git a/tests/ci/test_release_deadline.py b/tests/ci/test_release_deadline.py
index 618826f8b8..638c4f0223 100644
--- a/tests/ci/test_release_deadline.py
+++ b/tests/ci/test_release_deadline.py
@@ -181,6 +181,11 @@ def test_pypi_checks_after_its_own_approval_and_before_both_upload_targets():
verifier = jobs["build-package"]
verify = step_named(verifier, "Verify original release security decision")
assert "release_security_decision.py verify" in verify["run"]
+ assert (
+ verify["env"]["RELEASE_RUN_ID"]
+ == "${{ github.event.client_payload.run_id }}"
+ )
+ assert '--run-id "$RELEASE_RUN_ID"' in verify["run"]
assert (
verify["env"]["RELEASE_DECISION_ARTIFACT_ID"]
== "${{ github.event.client_payload.release_decision_artifact_id }}"
diff --git a/tests/ci/test_release_security_decision.py b/tests/ci/test_release_security_decision.py
index 4cf241df8c..3d7851f8bf 100644
--- a/tests/ci/test_release_security_decision.py
+++ b/tests/ci/test_release_security_decision.py
@@ -124,7 +124,7 @@ def replace_archive(responses, record, filename=decision.RECORD_NAME):
def verify():
- return decision.verify_decision(REPOSITORY, SHA, "500")
+ return decision.verify_decision(REPOSITORY, SHA, "500", "42")
@pytest.fixture
@@ -143,6 +143,8 @@ def cli(monkeypatch, tmp_path):
SHA,
"--artifact-id",
"500",
+ "--run-id",
+ "42",
],
)
return output
@@ -329,7 +331,7 @@ def test_missing_or_malformed_artifact_id_fails_before_api(
monkeypatch.setattr(decision, "api_bytes", forbidden)
with pytest.raises(ValueError):
- decision.verify_decision(REPOSITORY, SHA, artifact_id)
+ decision.verify_decision(REPOSITORY, SHA, artifact_id, "42")
def test_record_writer_binds_context_and_deadline(tmp_path, record):
@@ -418,3 +420,33 @@ def test_api_transport_uses_only_get(monkeypatch):
monkeypatch.setattr(decision.subprocess, "run", run)
assert decision.api_object(ARTIFACT) == {}
+
+
+def test_authentic_decision_for_same_commit_but_another_run_is_rejected(
+ responses,
+):
+ # This artifact is otherwise authentic and has a still-valid deadline.
+ # It cannot authorize a package produced by a different release run.
+ with pytest.raises(ValueError, match="tested package release run"):
+ decision.verify_decision(REPOSITORY, SHA, "500", "43")
+
+
[email protected]("run_id", ["", "none", "0", "../42", "42\n"])
+def test_invalid_expected_run_id_is_rejected_before_api(monkeypatch, run_id):
+ def forbidden(*args):
+ pytest.fail("API must not run for invalid release run IDs")
+
+ monkeypatch.setattr(decision, "api_bytes", forbidden)
+ with pytest.raises(ValueError):
+ decision.verify_decision(REPOSITORY, SHA, "500", run_id)
+
+
+def test_verify_cli_requires_the_original_release_run_id(cli, monkeypatch):
+ args = sys.argv.copy()
+ index = args.index("--run-id")
+ del args[index : index + 2]
+ monkeypatch.setattr(sys, "argv", args)
+ with pytest.raises(SystemExit) as exc:
+ decision.main()
+ assert exc.value.code == 2
+ assert not cli.exists()