From 5c5d99b95871a9208c24d61252b8dbaa6a909ed0 Mon Sep 17 00:00:00 2001 From: wshallwshall Date: Tue, 28 Jul 2026 17:44:04 -0500 Subject: [PATCH] =?UTF-8?q?probe:=20TEMPORARY=20diff-coverage=20probe=20?= =?UTF-8?q?=E2=80=94=20do=20not=20merge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Four merged PRs surfaced the advisory quality gates, but the headline claim of that work — that diff-cover emits INLINE `::notice` annotations on the Files changed tab — has never been observed on a real diff. None of those PRs touched `messagefoundry/`, and `--cov` only measures that package, so every run correctly reported "no lines with coverage information in this diff". Reporting correctly that there was nothing to report is not the same as rendering. This supplies real changed lines under coverage: `probe_covered` is exercised by its test, `probe_uncovered` deliberately is not. A correct run annotates only the latter, which proves both that the surface renders and that it is scoped to genuinely uncovered changed lines rather than to the whole diff. Verified locally with the exact CI invocation before spending CI time: ::notice file=messagefoundry/_diffcov_probe.py,line=27,endLine=30,title=Missing Coverage ::notice file=messagefoundry/_diffcov_probe.py,line=32,endLine=34,title=Missing Coverage messagefoundry/_diffcov_probe.py (36.4%): Missing lines 27-30,32-34 Total: 11 lines / Missing: 7 Worth noting what that also settles: coverage.xml names files RELATIVE TO ITS `` element (`filename="_diffcov_probe.py"`, source = .../messagefoundry), not repo-relative. The adversarial review of the liveness work flagged exactly this shape as a way the gate could go permanently "not applicable" — a source-path resolution mismatch. diff-cover resolves it correctly, and the annotation paths come out repo-relative, which is what GitHub needs to place them on the diff. DELETE BEFORE MERGE. This branch exists to observe the annotation and is not intended to land. --- messagefoundry/_diffcov_probe.py | 34 ++++++++++++++++++++++++++++++++ tests/test_diffcov_probe.py | 13 ++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 messagefoundry/_diffcov_probe.py create mode 100644 tests/test_diffcov_probe.py diff --git a/messagefoundry/_diffcov_probe.py b/messagefoundry/_diffcov_probe.py new file mode 100644 index 00000000..bbe6a783 --- /dev/null +++ b/messagefoundry/_diffcov_probe.py @@ -0,0 +1,34 @@ +"""TEMPORARY diff-coverage probe — DELETE BEFORE MERGE. Not part of the engine. + +Exists for one reason: four merged PRs surfaced the advisory quality gates, and the headline claim of +that work — that diff-cover emits INLINE `::notice` annotations on the Files changed tab — has never +been observed on a real diff, because none of those PRs touched `messagefoundry/` and `--cov` only +measures this package. The mechanism is proven locally and the CI path provably executes, but "it +reports correctly that there was nothing to report" is not the same as "it renders". + +This module supplies real changed lines under coverage: `probe_covered` is exercised by +tests/test_diffcov_probe.py, `probe_uncovered` deliberately is not. A correct run annotates only the +latter — which proves both that the surface renders AND that it is scoped to genuinely uncovered +changed lines rather than to the whole diff. + +Delete this file and its test once the annotation has been observed. +""" + + +def probe_covered(value: int) -> int: + """Exercised by the probe test, so these lines must NOT be annotated.""" + doubled = value * 2 + return doubled + + +def probe_uncovered(value: int) -> str: + """Deliberately unexercised. Every line below should come back as a `Missing Coverage` notice, + coalesced into as few ranges as diff-cover can manage.""" + if value > 100: + label = "large" + elif value > 10: + label = "medium" + else: + label = "small" + suffix = "!" if value < 0 else "" + return f"{label}{suffix}" diff --git a/tests/test_diffcov_probe.py b/tests/test_diffcov_probe.py new file mode 100644 index 00000000..983613f0 --- /dev/null +++ b/tests/test_diffcov_probe.py @@ -0,0 +1,13 @@ +"""TEMPORARY — companion to messagefoundry/_diffcov_probe.py. DELETE BEFORE MERGE. + +Covers `probe_covered` and pointedly not `probe_uncovered`, so the diff-coverage job has a real diff +with a mix of covered and uncovered changed lines to annotate. +""" + +from messagefoundry._diffcov_probe import probe_covered + + +def test_probe_covered_doubles() -> None: + assert probe_covered(21) == 42 + assert probe_covered(0) == 0 + assert probe_covered(-3) == -6