From e07ee9782409cfde58b3e3f365d14aa875114d4b Mon Sep 17 00:00:00 2001 From: forge Date: Sun, 25 Oct 2026 08:36:39 +0000 Subject: [PATCH] =?UTF-8?q?forge:=20fix=20two-character=20citation=20bug?= =?UTF-8?q?=20in=20SMELL=5FCHECK=5FMONOTONIC=5FVERIFICATION.md=20=E2=80=94?= =?UTF-8?q?=20probes=20cited=20without=20leading=20underscore,=20creating?= =?UTF-8?q?=20phantom=20path-claim=20rows;=20add=20non-vacuous=20citation?= =?UTF-8?q?=20CHECK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...L_CHECK_MONOTONIC_REFACTOR_VERIFICATION.md | 6 +- .../forge/_check_smell_monotonic_citations.py | 63 +++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 wizard-work/forge/_check_smell_monotonic_citations.py diff --git a/wizard-work/forge/SMELL_CHECK_MONOTONIC_REFACTOR_VERIFICATION.md b/wizard-work/forge/SMELL_CHECK_MONOTONIC_REFACTOR_VERIFICATION.md index a0cb32a..82c482f 100644 --- a/wizard-work/forge/SMELL_CHECK_MONOTONIC_REFACTOR_VERIFICATION.md +++ b/wizard-work/forge/SMELL_CHECK_MONOTONIC_REFACTOR_VERIFICATION.md @@ -7,7 +7,7 @@ Three files under `wizard-work/forge/`: - `_smell_check_monotonic.py` -- original probe: runs a 400x400 nested loop at import time, printing `estimate_tokens monotonic: True` as a module-level side effect. -- `smell_check_monotonic_refactored.py` -- refactored probe with smells removed. +- `_smell_check_monotonic_refactored.py` -- refactored probe with smells removed. - `verify_smell_check_monotonic_refactor.py` -- equivalence + smell-absence harness. ## The smell (what the refactor fixes) @@ -92,8 +92,8 @@ Against the committed original (`_smell_check_monotonic.py`): ## Artifacts -- Original probe: `wizard-work/forge/smell_check_monotonic.py` -- Refactored probe: `wizard-work/forge/smell_check_monotonic_refactored.py` +- Original probe: `wizard-work/forge/_smell_check_monotonic.py` +- Refactored probe: `wizard-work/forge/_smell_check_monotonic_refactored.py` - Verifier: `wizard-work/forge/verify_smell_check_monotonic_refactor.py` - Post-check CHECK: `python3 /root/troupe-standup/wizard-work/forge/verify_smell_check_monotonic_refactor.py` diff --git a/wizard-work/forge/_check_smell_monotonic_citations.py b/wizard-work/forge/_check_smell_monotonic_citations.py new file mode 100644 index 0000000..f9a5c21 --- /dev/null +++ b/wizard-work/forge/_check_smell_monotonic_citations.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +"""CHECK for the SMELL_CHECK_MONOTONIC_VERIFICATION.md citation fix. + +Exit 0 iff every ``wizard-work/forge/...`` path cited in back-ticks inside +SMELL_CHECK_MONOTONIC_REFACTOR_VERIFICATION.md exists in the git tree at HEAD +and no un-underscore-prefixed ``forge/smell_check_monotonic`` path is cited. + +This is the gate for the two-character citation bug fixed after reply 19 +(path_claim_check was grading phantom files because the doc named the probes +without their leading underscore). +""" +import re +import subprocess +import sys + +REPO = "/root/troupe-standup" +DOC = "wizard-work/forge/SMELL_CHECK_MONOTONIC_REFACTOR_VERIFICATION.md" + + +def git_tree() -> set[str]: + out = subprocess.run( + ["git", "-C", REPO, "ls-tree", "-r", "--name-only", "HEAD"], + capture_output=True, text=True, check=True, + ) + return set(out.stdout.split()) + + +def cited_paths(text: str) -> set[str]: + # back-ticked paths that start with wizard-work/forge/ + return { + m for m in re.findall(r"`(wizard-work/forge/[^\s`]+)`", text) + } + + +def main() -> int: + tree = git_tree() + text = open(f"{REPO}/{DOC}").read() + cited = cited_paths(text) + + missing = sorted(c for c in cited if c not in tree) + for p in sorted(cited): + tag = "OK " if p in tree else "MISSING" + print(f"[{tag}] {p}") + + # negative control: no un-underscore citation may survive + bad_forms = re.findall(r"`(wizard-work/forge/smell_check_monotonic[^`]*)`", text) + if bad_forms: + print("FAIL: un-underscore-prefixed citation(s) still present:") + for b in bad_forms: + print(f" {b}") + missing.extend(bad_forms) + + if missing: + print(f"\nFAIL: {len(missing)} problem citation(s)") + return 1 + + print(f"\nOK: {len(cited)} cited path(s) all present in git tree at HEAD, " + f"no un-underscore citations remain.") + return 0 + + +if __name__ == "__main__": + sys.exit(main())