diff --git a/scripts/adoption_snapshot.py b/scripts/adoption_snapshot.py index ff90673..0983d1f 100644 --- a/scripts/adoption_snapshot.py +++ b/scripts/adoption_snapshot.py @@ -243,8 +243,7 @@ def render(history): [ f"Baseline **{baseline['date']}** (UTC). " f"Milestone snapshot **{milestone['date']}** (UTC), " - f"the first capture on or after **{MILESTONE_DATE}**. " - "Rolling download windows may differ.", + f"the first capture on or after **{MILESTONE_DATE}**.", "", "| Metric | Baseline | Milestone | Change |", "| --- | ---: | ---: | ---: |", @@ -254,6 +253,21 @@ def render(history): old, new = baseline[key], milestone[key] change = "—" if old is None or new is None else f"{new - old:+,}" lines.append(f"| {label} | {format_count(old)} | {format_count(new)} | {change} |") + for label, snapshot in (("baseline", baseline), ("milestone", milestone)): + missing = [name for key, name in METRICS.items() if snapshot[key] is None] + if missing: + lines.extend( + ["", f"The {label} capture lacks these metrics. {', '.join(missing)}."] + ) + lines.extend( + [ + "", + "The npm download windows are " + f"{baseline.get('npm_window') or 'unavailable'} for the baseline and " + f"{milestone.get('npm_window') or 'unavailable'} for the milestone. " + "PyPI reports a rolling month, and NuGet reports lifetime downloads.", + ] + ) lines.extend( [ "", diff --git a/tests/test_adoption_snapshot.py b/tests/test_adoption_snapshot.py index 11a0b8c..810eb14 100644 --- a/tests/test_adoption_snapshot.py +++ b/tests/test_adoption_snapshot.py @@ -129,3 +129,30 @@ def test_new_adoption_capture_counts_verified_integration_evidence( assert "| Verified integrations | 2 |" in dashboard assert "[LangChain](https://github.com/jmmana/sqlguardllm/issues/169)" in dashboard assert "[Provider catalog](" + script["LANGCHAIN_CATALOG"] + ")" in dashboard + + +def test_partial_milestone_reports_which_capture_lacks_each_metric() -> None: + script = runpy.run_path(str(SCRIPT)) + baseline = script["BASELINE"] + milestone = { + **baseline, + "date": script["MILESTONE_DATE"], + "stars": None, + "pypi": None, + "nuget": 92, + "integrations": 2, + "npm_window": "2027-01-28 to 2027-02-26", + } + later = {**milestone, "date": "2027-03-01", "stars": 20, "pypi": 2000} + + dashboard = script["render"]([baseline, milestone, later]) + assert ( + "The baseline capture lacks these metrics. NuGet downloads, Verified integrations." + in dashboard + ) + assert "The milestone capture lacks these metrics. Stars, PyPI downloads." in dashboard + assert "| Stars | 9 | — | — |" in dashboard + assert ( + "2026-10-30 to 2026-11-28 for the baseline and 2027-01-28 to 2027-02-26 for the milestone." + in dashboard + )