AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
fix(ci): fail closed on changelog-guard version parse errors
Trevin Chow1bc916fc04fc
diff --git a/.github/scripts/read_manifest_version.py b/.github/scripts/read_manifest_version.pyindex eaa1e7a5..4dd692ed 100644--- a/.github/scripts/read_manifest_version.py+++ b/.github/scripts/read_manifest_version.py@@ -28,11 +28,13 @@ def version_from(path: str, text: str) -> str:text,)return match.group(1) if match else ""- if path.endswith("marketplace.json"):+ try:data = json.loads(text)+ except json.JSONDecodeError as exc:+ raise SystemExit(f"invalid JSON in {path}: {exc}") from exc+ if path.endswith("marketplace.json"):plugins = data.get("plugins") or []return plugins[0].get("version", "") if plugins else ""- data = json.loads(text)return data.get("version", "") or ""diff --git a/.github/workflows/changelog-guard.yml b/.github/workflows/changelog-guard.ymlindex 9b98500d..57c0b21c 100644--- a/.github/workflows/changelog-guard.yml+++ b/.github/workflows/changelog-guard.yml@@ -82,9 +82,10 @@ jobs:version_at() {local ref="$1"local path="$2"- git show "${ref}:${path}" 2>/dev/null \- | python3 .github/scripts/read_manifest_version.py "${path}" \- || true+ # Fail closed: do not swallow helper/parse errors with || true.+ # Callers only invoke this after git cat-file confirms the blob.+ git show "${ref}:${path}" \+ | python3 .github/scripts/read_manifest_version.py "${path}"}VERSION_PATHS=(diff --git a/tests/test_changelog_workflow.py b/tests/test_changelog_workflow.pyindex a5e68243..b22d07a4 100644--- a/tests/test_changelog_workflow.py+++ b/tests/test_changelog_workflow.py@@ -12,6 +12,39 @@ from pathlib import PathROOT = Path(__file__).resolve().parents[1]+def _assert_run_blocks_indented(text: str, *, label: str) -> None:+ """Fail if a ``run: |`` block contains under-indented (esp. column-0) lines.++ A prior bug treated indent <= run_indent as "end of block" and skipped the+ assertion, so column-0 Python inside the scalar never failed the test.+ """+ in_run = False+ run_indent = 0+ for lineno, line in enumerate(text.splitlines(), 1):+ match = re.match(r"^(\s*)run:\s*\|\s*$", line)+ if match:+ in_run = True+ run_indent = len(match.group(1))+ continue+ if not in_run or not line.strip():+ continue+ indent = len(line) - len(line.lstrip(" "))+ if indent > run_indent:+ continue+ # Valid block end: a YAML key or list item at/above the run: indent.+ # Column-0 (or any non-key dedent) is the Actions parse failure.+ looks_like_yaml = bool(+ re.match(r"^\s*(- )?[A-Za-z_][\w-]*\s*:", line)+ or re.match(r"^\s*-\s+\S", line)+ )+ if indent == 0 or not looks_like_yaml:+ raise AssertionError(+ f"{label}:{lineno} under-indented inside run: | "+ f"(indent={indent}, run_indent={run_indent}): {line!r}"+ )+ in_run = False++def _load_prepare_release():path = ROOT / ".github" / "scripts" / "prepare_release.py"spec = importlib.util.spec_from_file_location("prepare_release", path)@@ -60,26 +93,23 @@ class TestChangelogWorkflow(unittest.TestCase):def test_changelog_guard_run_blocks_stay_indented(self) -> None:"""Column-0 lines inside ``run: |`` break Actions YAML parsing."""path = ROOT / ".github" / "workflows" / "changelog-guard.yml"- lines = path.read_text(encoding="utf-8").splitlines()- in_run = False- run_indent = 0- for lineno, line in enumerate(lines, 1):- match = re.match(r"^(\s*)run:\s*\|\s*$", line)- if match:- in_run = True- run_indent = len(match.group(1))- continue- if not in_run or not line.strip():- continue- indent = len(line) - len(line.lstrip(" "))- if indent <= run_indent:- in_run = False- continue- self.assertGreater(- indent,- run_indent,- msg=f"{path}:{lineno} must stay indented inside run: |",- )+ _assert_run_blocks_indented(+ path.read_text(encoding="utf-8"),+ label=str(path),+ )++ def test_run_block_indent_checker_rejects_column_zero(self) -> None:+ malformed = (+ "jobs:\n"+ " guard:\n"+ " steps:\n"+ " - name: Enforce\n"+ " run: |\n"+ " set -euo pipefail\n"+ "import json\n"+ )+ with self.assertRaises(AssertionError):+ _assert_run_blocks_indented(malformed, label="synthetic")def test_read_manifest_version_helper(self) -> None:script = ROOT / ".github" / "scripts" / "read_manifest_version.py"@@ -117,6 +147,8 @@ class TestChangelogWorkflow(unittest.TestCase):),"3.18.1",)+ with self.assertRaises(SystemExit):+ mod.version_from(".claude-plugin/plugin.json", "{not-json")def test_pr_template_has_agent_and_relationship_sections(self) -> None:text = (ROOT / ".github" / "PULL_REQUEST_TEMPLATE.md").read_text(