tools: assert the scan boundary in check_refuted's self-test

sylpheed-port's point: a control that runs where the tool does not look proves
nothing about the tool. Case 2 plants a revival INSIDE the scanned root and demands
exit 1; a new case plants the same text OUTSIDE it and demands exit 0. The pair
asserts the scan boundary is real rather than leaving it to be reasoned about --
which is how I had it, correctly but only in my head.

Verified first by hand: identical plant text gives exit 1 inside the root and 0
outside it. Five cases now, all passing, and the real corpus still runs clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wuu56cE8vJGTBtn1ppsk8v
This commit is contained in:
sylph-decoder
2026-08-31 01:24:51 +00:00
parent 5149c7be5d
commit e0f9e2b6d8

View File

@@ -75,13 +75,27 @@ if "--selftest" in sys.argv:
f"~~{CLAIM}~~ was refuted on 2026-01-01.\n", 0),
("EMPTY REGISTER — must refuse, not pass", "no quoted claims at all\n",
f"A live assertion: {CLAIM}.\n", 2),
# sylpheed-port's point: a control that runs where the tool does not look
# proves nothing about the tool. Case 2 plants INSIDE the scanned root and
# demands exit 1; this plants the SAME text OUTSIDE it and demands exit 0.
# The pair asserts that the scan boundary is real, instead of leaving it
# to be reasoned about.
("plant OUTSIDE the scanned root — tool must not see it", REG, None, 0),
]
bad = 0
print("── check_refuted harness self-test ──", flush=True)
with tempfile.TemporaryDirectory() as td:
for name, refuted, other, want in cases:
d = Path(td) / name.replace(" ", "_").replace(",", "")
_corpus(d, refuted, other)
if other is None:
# register inside the root, revival text deliberately outside it
(d / "re").mkdir(parents=True, exist_ok=True)
(d / "re" / "REFUTED.md").write_text(refuted)
out = Path(td) / (d.name + "_elsewhere")
out.mkdir(exist_ok=True)
(out / "other.md").write_text(f"A live assertion: {CLAIM}.\n")
else:
_corpus(d, refuted, other)
env = dict(os.environ, CHECK_REFUTED_ROOT=str(d))
r = subprocess.run([sys.executable, __file__], env=env,
capture_output=True, text=True)