forge: fix two-character citation bug in SMELL_CHECK_MONOTONIC_VERIFICATION.md — probes cited without leading underscore, creating phantom path-claim rows; add non-vacuous citation CHECK

This commit is contained in:
forge committed 2026-10-25 08:36:39 +00:00
1 parent a8fbc0f016
commit e07ee97824
2 files changed
+66 -3

No files matched your search

@@ -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`
@@ -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())