Skip to content

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

fix: preserve empty-body commits in release bump parsing

JerrettDavis799e1c3a3046
diff --git a/headroom/release_version.py b/headroom/release_version.py
index b6268819c..951a8bfc0 100644
--- a/headroom/release_version.py
+++ b/headroom/release_version.py
@@ -249,10 +249,9 @@ def list_release_commits(root: Path, previous_tag: str) -> list[CommitInfo]:
commits: list[CommitInfo] = []
for raw_entry in result.stdout.split(RECORD_SEP):
- entry = raw_entry.strip()
- if not entry or FIELD_SEP not in entry:
+ if not raw_entry or FIELD_SEP not in raw_entry:
continue
- subject, body = entry.split(FIELD_SEP, 1)
+ subject, body = raw_entry.split(FIELD_SEP, 1)
commits.append(CommitInfo(subject=subject.strip(), body=body.strip()))
return commits
diff --git a/tests/test_release_version.py b/tests/test_release_version.py
index 81f2751db..52bb0fcac 100644
--- a/tests/test_release_version.py
+++ b/tests/test_release_version.py
@@ -4,6 +4,7 @@ import os
import subprocess
import sys
from pathlib import Path
+from unittest.mock import Mock
import pytest
@@ -137,12 +138,21 @@ def test_determine_bump_level_prefers_major_over_minor_and_patch() -> None:
assert determine_bump_level(commits) == "major"
-def test_list_release_commits_returns_first_parent_range() -> None:
+def test_list_release_commits_parses_empty_body_entries(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ run = Mock()
+ run.return_value = Mock(
+ stdout="feat: add capability\x1f\x1efix: patch bug\x1fbody text\x1e",
+ )
+ monkeypatch.setattr("headroom.release_version.subprocess.run", run)
+
commits = list_release_commits(ROOT, "")
- assert commits
- assert isinstance(commits[0], CommitInfo)
- assert commits[0].subject
+ assert commits == [
+ CommitInfo(subject="feat: add capability", body=""),
+ CommitInfo(subject="fix: patch bug", body="body text"),
+ ]
def test_release_version_script_runs_directly_without_importing_headroom_package(