Skip to content

Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.

fix(ops-release): stop prepending an empty "### Changed" to --notes (#950)

Aurora Capitalf2121f2c7bb5
diff --git a/claude-ops/bin/ops-release b/claude-ops/bin/ops-release
index 9c73962d..d038d273 100755
--- a/claude-ops/bin/ops-release
+++ b/claude-ops/bin/ops-release
@@ -332,7 +332,14 @@ $diffstat"
fi
[ -z "$notes" ] && notes="${commits:-- (no notes provided)}"
fi
-if [ "$ai_used" -eq 1 ]; then
+# Only add a "### Changed" heading when the body has none of its own — notes
+# passed with --notes often already carry "### Fixed" or "### Added", and a
+# second heading would ship an empty section into the GitHub release notes.
+notes_has_heading=0
+if printf '%s\n' "$notes" | grep -qE '^### (Added|Changed|Fixed|Removed)'; then
+ notes_has_heading=1
+fi
+if [ "$ai_used" -eq 1 ] || [ "$notes_has_heading" -eq 1 ]; then
changelog_section=$'## ['"$NEW"$'] - '"$REL_DATE"$'\n\n'"$notes"$'\n'
else
changelog_section=$'## ['"$NEW"$'] - '"$REL_DATE"$'\n\n### Changed\n'"$notes"$'\n'
diff --git a/claude-ops/tests/run-all.sh b/claude-ops/tests/run-all.sh
index 0610c3da..e5c7e4b0 100755
--- a/claude-ops/tests/run-all.sh
+++ b/claude-ops/tests/run-all.sh
@@ -78,6 +78,7 @@ run_suite "$TESTS_DIR/test-deploy-fix-fleet.sh"
run_suite "$TESTS_DIR/test-cloudflare-dns-lib.sh"
run_suite "$TESTS_DIR/test-ops-dns-provision.sh"
run_suite "$TESTS_DIR/test-ops-marketing-dash-brand-isolation.sh"
+run_suite "$TESTS_DIR/test-ops-release-changelog-heading.sh"
run_suite "$TESTS_DIR/../templates/statusline/tests/run-tests.sh"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
diff --git a/claude-ops/tests/test-ops-release-changelog-heading.sh b/claude-ops/tests/test-ops-release-changelog-heading.sh
new file mode 100755
index 00000000..211f25b1
--- /dev/null
+++ b/claude-ops/tests/test-ops-release-changelog-heading.sh
@@ -0,0 +1,102 @@
+#!/usr/bin/env bash
+# test-ops-release-changelog-heading.sh — ops-release must not add a second
+# "### Changed" heading to --notes that already carry one of their own.
+# A redundant heading ships an empty section into the GitHub release notes.
+set -euo pipefail
+
+PLUGIN_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+RELEASE="$PLUGIN_ROOT/bin/ops-release"
+
+pass=0
+fail=0
+
+ok() { echo " PASS: $1"; pass=$((pass+1)); }
+err() { echo " FAIL: $1"; fail=$((fail+1)); }
+
+echo "Checking: bin/ops-release changelog heading guard"
+echo ""
+
+if [[ ! -f "$RELEASE" ]]; then
+ echo "FAIL: bin/ops-release not found"
+ exit 1
+fi
+ok "bin/ops-release exists"
+
+if bash -n "$RELEASE" 2>/dev/null; then
+ ok "bin/ops-release parses"
+else
+ err "bin/ops-release has a syntax error"
+fi
+
+# Lift the real heading block out of the script so the test exercises shipped
+# code rather than a copy that can drift away from it.
+BLOCK="$(awk '/^notes_has_heading=0$/{f=1} f{print; if ($0 == "fi") { n++; if (n == 2) exit }}' "$RELEASE")"
+if [[ -z "$BLOCK" ]]; then
+ err "heading guard block not found in bin/ops-release"
+ echo ""
+ echo "---"
+ echo "Results: $pass passed, $((fail+1)) failed"
+ exit 1
+fi
+ok "heading guard block found"
+
+render() {
+ local notes="$1" ai_used="$2"
+ local NEW=9.9.9 REL_DATE=2026-01-01 changelog_section
+ eval "$BLOCK"
+ printf '%s' "$changelog_section"
+}
+
+count_changed() {
+ printf '%s\n' "$1" | grep -c '^### Changed$' || true
+}
+
+# 1. --notes with their own "### Fixed" must stay untouched.
+out="$(render "$(printf '### Fixed\n- something')" 0)"
+if [[ "$(count_changed "$out")" == "0" ]]; then
+ ok "notes with '### Fixed' get no extra '### Changed'"
+else
+ err "an empty '### Changed' was prepended to notes that already had a heading"
+fi
+
+# 2. --notes with their own "### Added" likewise.
+out="$(render "$(printf '### Added\n- something')" 0)"
+if [[ "$(count_changed "$out")" == "0" ]]; then
+ ok "notes with '### Added' get no extra '### Changed'"
+else
+ err "an empty '### Changed' was prepended to '### Added' notes"
+fi
+
+# 3. Bare bullets still need a heading, or the section renders headless.
+out="$(render "$(printf -- '- a bare bullet')" 0)"
+if [[ "$(count_changed "$out")" == "1" ]]; then
+ ok "bare bullets still get a '### Changed' heading"
+else
+ err "bare notes lost their '### Changed' heading"
+fi
+
+# 4. The AI path already emits its own headings; nothing may be added.
+out="$(render "$(printf '### Changed\n- from the model')" 1)"
+if [[ "$(count_changed "$out")" == "1" ]]; then
+ ok "AI-written body keeps exactly its own heading"
+else
+ err "AI path duplicated or dropped a heading"
+fi
+
+# 5. Whatever the body, the version header comes first.
+out="$(render "$(printf '### Fixed\n- something')" 0)"
+if [[ "$out" == '## [9.9.9] - 2026-01-01'* ]]; then
+ ok "section starts with the version header"
+else
+ err "section does not start with '## [version] - date'"
+fi
+
+echo ""
+echo "---"
+echo "Results: $pass passed, $fail failed"
+echo ""
+
+if (( fail > 0 )); then
+ exit 1
+fi
+exit 0