From 708aa73f5db816fcf58412085c20676871337f35 Mon Sep 17 00:00:00 2001 From: chaoz23 Date: Tue, 18 Aug 2026 20:56:55 -0700 Subject: [PATCH] fix: stream-claim detection rejected correct documentation The gate decided which stream a SKILL.md claims by asking whether the word "stderr" appeared anywhere in the paragraph. That works only while the documentation is wrong. A correct doc names both streams -- "every envelope prints JSON on stdout; stderr carries only argparse usage errors" -- and the old test saw "stderr", concluded stderr was the claim, and reported STREAM_MISMATCH against a file that was now accurate. It rejected exactly the fix it exists to prompt. A gate that blocks the correct change is worse than one that misses a defect: it teaches you to bypass it. The claim is the stream governed by the printing verb, not any stream mentioned. Detection now matches (prints|emits|writes|outputs) ... (stdout| stderr) within a clause, falling back to the old heuristic when no verb is found. Verified both directions against real files: dmcheck's SKILL.md at origin/main still resolves to "stderr" and still reports STREAM_MISMATCH, while the corrected text resolves to "stdout" and clears -- with MISSING_PIPE and HONEST_LANE_OVERLOAD still reported, so the fix narrows nothing else. Co-Authored-By: Claude Opus 5 --- scripts/family_conformance.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/family_conformance.py b/scripts/family_conformance.py index 3cd186d..ad27e6e 100755 --- a/scripts/family_conformance.py +++ b/scripts/family_conformance.py @@ -220,10 +220,21 @@ def record(code: int, ctx: str, is_tight: bool = False) -> None: stream_claim = None for _, para in paragraphs: low = para.lower() - if ("stderr" in low or "stdout" in low) and any( - w in low for w in ("fail", "error", "envelope", "invalid", "print")): - stream_claim = ("stderr" if "stderr" in low else "stdout", para) - break + if "stderr" not in low and "stdout" not in low: + continue + if not any(w in low for w in + ("fail", "error", "envelope", "invalid", "print", "emit")): + continue + # Which stream is claimed to CARRY the payload? Merely *mentioning* a + # stream is not the claim -- an accurate doc names both ("prints JSON on + # stdout; stderr carries only usage errors"), and a naive "stderr appears, + # so stderr is claimed" test rejects exactly the documentation we want. + # The claim is the stream governed by the printing verb. + m = re.search(r"(?:prints?|emits?|writes?|outputs?)\b[^.]{0,60}?" + r"\b(stdout|stderr)\b", low) + stream_claim = ((m.group(1) if m else + ("stderr" if "stderr" in low else "stdout")), para) + break return {"documented": documented, "tight": tight, "honest": honest, "usage": usage, "stream_claim": stream_claim}