Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

fix

amanagarwal0424d0c4bb4003a
diff --git a/.github/scripts/release.py b/.github/scripts/release.py
index 8755871b..a7370b16 100644
--- a/.github/scripts/release.py
+++ b/.github/scripts/release.py
@@ -146,6 +146,17 @@ def previous_tag(tag: str, version: str, tool: dict[str, Any], source_sha: str)
return result
+def tag_commit_at(tag: str) -> str | None:
+ resolved = run(
+ "git",
+ "rev-parse",
+ "--verify",
+ f"refs/tags/{tag}^{{commit}}",
+ check=False,
+ )
+ return resolved or None
+
+
def path_matches(filename: str, patterns: list[str], previous_filename: str | None = None) -> bool:
names = [filename]
if previous_filename:
@@ -496,7 +507,7 @@ def prepare(args: argparse.Namespace) -> None:
main_message = run("git", "show", "-s", "--format=%B", main_sha)
main_parents = run("git", "show", "-s", "--format=%P", main_sha).split()
is_release_commit = f"Release-Tag: {tag}" in main_message and bool(main_parents)
- tag_target = run("git", "rev-parse", f"{tag}^{{commit}}", check=False)
+ tag_target = tag_commit_at(tag)
if source_sha != main_sha:
if not is_release_commit or main_parents[0] != source_sha:
raise ReleaseError(f"release source {source_sha} must target current main {main_sha}")
diff --git a/.github/scripts/test_release.py b/.github/scripts/test_release.py
index f26dd50a..d02c5787 100644
--- a/.github/scripts/test_release.py
+++ b/.github/scripts/test_release.py
@@ -248,6 +248,29 @@ class ReleaseTests(unittest.TestCase):
finally:
release.ROOT = original_root
+ def test_missing_tag_does_not_resolve_as_a_commit(self):
+ original_root = release.ROOT
+ try:
+ with tempfile.TemporaryDirectory() as temporary:
+ root = Path(temporary)
+ release.ROOT = root
+ subprocess.run(["git", "init", "-q"], cwd=root, check=True)
+ (root / "file").write_text("fixture\n", encoding="utf-8")
+ subprocess.run(["git", "add", "file"], cwd=root, check=True)
+ subprocess.run(
+ ["git", "-c", "user.name=test", "-c", "[email protected]", "commit", "-qm", "fixture"],
+ cwd=root,
+ check=True,
+ )
+ self.assertIsNone(release.tag_commit_at("py-1.45.0"))
+ subprocess.run(["git", "tag", "py-1.45.0"], cwd=root, check=True)
+ expected = subprocess.run(
+ ["git", "rev-parse", "HEAD"], cwd=root, check=True, text=True, capture_output=True
+ ).stdout.strip()
+ self.assertEqual(release.tag_commit_at("py-1.45.0"), expected)
+ finally:
+ release.ROOT = original_root
+
def test_direct_commit_diagnostics_are_tool_scoped(self):
class NoPullRequests:
@staticmethod