From a444fc4f32257664bef8dffb2baab8aec797aa5b Mon Sep 17 00:00:00 2001 From: BLC Core Studio <207100624+BLCCoreStudio@users.noreply.github.com> Date: Mon, 7 Sep 2026 09:45:53 +0300 Subject: [PATCH 1/3] Report source-health impact by module --- scripts/check_source_health.py | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/scripts/check_source_health.py b/scripts/check_source_health.py index 27c9b04..1f4d43e 100644 --- a/scripts/check_source_health.py +++ b/scripts/check_source_health.py @@ -23,6 +23,12 @@ USER_AGENT = "OpenDevIndex-SourceHealth/1.0 (+https://github.com/BLCCoreStudio/OpenDevIndex)" RESTRICTED_CODES = {401, 403, 407, 423, 425, 429, 451} BROKEN_CODES = {404, 410} +HEALTH_SEVERITY = { + "healthy": 0, + "restricted": 1, + "transient": 2, + "broken": 3, +} def static_public_https_url(url: str) -> tuple[bool, str]: @@ -186,18 +192,47 @@ def collect_urls(entries: list[dict]) -> dict[str, set[str]]: return contexts +def module_health_summary(results: list[dict]) -> Counter[str]: + """Count modules by their worst source-health classification.""" + worst_by_module: dict[str, str] = {} + for result in results: + classification = result.get("classification") + if classification not in HEALTH_SEVERITY: + continue + for context in result.get("contexts", []): + if not isinstance(context, str) or ":" not in context: + continue + module_ref, _ = context.rsplit(":", 1) + current = worst_by_module.get(module_ref) + if current is None or HEALTH_SEVERITY[classification] > HEALTH_SEVERITY[current]: + worst_by_module[module_ref] = classification + return Counter(worst_by_module.values()) + + def render_markdown(results: list[dict], checked_at: str) -> str: counts = Counter(result["classification"] for result in results) + module_counts = module_health_summary(results) lines = [ "# OpenDevIndex Source Health", "", f"Checked at **{checked_at}**.", "", + "## URL results", + "", f"- Healthy: **{counts.get('healthy', 0)}**", f"- Restricted/anti-bot: **{counts.get('restricted', 0)}**", f"- Transient: **{counts.get('transient', 0)}**", f"- Broken: **{counts.get('broken', 0)}**", "", + "## Module impact", + "", + "Each module is counted once using the worst classification among its homepage, repository, and source URLs.", + "", + f"- Healthy: **{module_counts.get('healthy', 0)}**", + f"- Restricted/anti-bot: **{module_counts.get('restricted', 0)}**", + f"- Transient: **{module_counts.get('transient', 0)}**", + f"- Broken: **{module_counts.get('broken', 0)}**", + "", ] notable = [result for result in results if result["classification"] != "healthy"] From 67a4810eca79fc5f25e5dd3e922b122d3331579a Mon Sep 17 00:00:00 2001 From: BLC Core Studio <207100624+BLCCoreStudio@users.noreply.github.com> Date: Mon, 7 Sep 2026 09:46:06 +0300 Subject: [PATCH 2/3] Test source-health module impact reporting --- tests/test_source_health.py | 58 ++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/tests/test_source_health.py b/tests/test_source_health.py index 1abb802..93dd683 100644 --- a/tests/test_source_health.py +++ b/tests/test_source_health.py @@ -9,7 +9,12 @@ if str(SCRIPTS) not in sys.path: sys.path.insert(0, str(SCRIPTS)) -from check_source_health import classify_http_code, static_public_https_url # noqa: E402 +from check_source_health import ( # noqa: E402 + classify_http_code, + module_health_summary, + render_markdown, + static_public_https_url, +) from url_safety import is_safe_https_url # noqa: E402 @@ -42,6 +47,57 @@ def test_http_classification(self) -> None: self.assertEqual(classify_http_code(410), "broken") self.assertEqual(classify_http_code(503), "transient") + def test_module_health_uses_worst_classification_once_per_module(self) -> None: + results = [ + { + "classification": "healthy", + "contexts": ["tool/git:homepage", "tool/docker:homepage"], + }, + { + "classification": "restricted", + "contexts": ["tool/git:repository"], + }, + { + "classification": "transient", + "contexts": ["tool/docker:source"], + }, + { + "classification": "broken", + "contexts": ["tool/git:source"], + }, + ] + + summary = module_health_summary(results) + + self.assertEqual(summary["broken"], 1) + self.assertEqual(summary["transient"], 1) + self.assertEqual(summary["healthy"], 0) + self.assertEqual(summary["restricted"], 0) + + def test_markdown_reports_module_impact(self) -> None: + results = [ + { + "url": "https://example.com/a", + "classification": "healthy", + "http_status": 200, + "contexts": ["tool/git:homepage"], + "detail": "reachable", + }, + { + "url": "https://example.com/b", + "classification": "broken", + "http_status": 404, + "contexts": ["tool/git:source", "tool/docker:source"], + "detail": "Not Found", + }, + ] + + markdown = render_markdown(results, "2026-09-07T00:00:00+00:00") + + self.assertIn("## Module impact", markdown) + self.assertIn("Each module is counted once", markdown) + self.assertIn("- Broken: **2**", markdown) + if __name__ == "__main__": unittest.main() From 21b62f5935f6f41c374f15019f1f2a0ebabf8342 Mon Sep 17 00:00:00 2001 From: BLC Core Studio <207100624+BLCCoreStudio@users.noreply.github.com> Date: Mon, 7 Sep 2026 10:39:47 +0300 Subject: [PATCH 3/3] Fix comparison discovery smoke coverage --- comparisons/_meta/search-smoke.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/comparisons/_meta/search-smoke.yaml b/comparisons/_meta/search-smoke.yaml index 379cc69..47049cd 100644 --- a/comparisons/_meta/search-smoke.yaml +++ b/comparisons/_meta/search-smoke.yaml @@ -1,5 +1,7 @@ schema_version: 1 cases: +- comparison: containers-docker-containerd + query: image build responsibility - comparison: github-actions-argocd query: runner jobs drift reconciliation - comparison: kubernetes-helm-argocd