test(b-gate): the mutant that survived -- a docstring that NAMES the door is not touching it
Mutant M12 against the delivered tree: let _meaningful return the whole body, so a string standing alone counts. 85 of 85 GREEN. That is a finding, not a pass: the repair's own rule -- "the gate never reads a string that stands alone" -- had no arm watching it, and without one the fix would have drifted back to "mentioning the door is touching it", which is the same defect one floor in. The arm carries its rc-0 control first (a real probe WITH a docstring still counts), then breaks each half on its own: a probe whose docstring names the real door while its call drives another module, and one whose docstring names the step while its call passes another word. Both must be refused, each with its own reason. 12 of 12 mutants now felled, control 86 of 86. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
9eec31b7da
commit
75cb142252
1 changed files with 31 additions and 3 deletions
|
|
@ -158,18 +158,22 @@ def _write_probe(
|
|||
door: str = "fakesrc.driver",
|
||||
needle: str = "gjoer_noe",
|
||||
asserts: bool = True,
|
||||
docstring: str = "",
|
||||
nodeid: str = _FAKE_PROBE,
|
||||
) -> str:
|
||||
"""En probe som DRIVER døren: kaller kommandoen og asserter på det den gjorde.
|
||||
|
||||
Hvert av de tre trekkene gaten måler kan skrus av her, ett om gangen: hvilken dør den rører
|
||||
(``door``), hvilket steg den navngir (``needle``), og om den asserter i det hele tatt."""
|
||||
Hvert av de fire trekkene gaten måler kan skrus av her, ett om gangen: hvilken dør den rører
|
||||
(``door``), hvilket steg den navngir (``needle``), om den asserter i det hele tatt, og hva
|
||||
den bare OMTALER uten å røre (``docstring``)."""
|
||||
file_part, _, name = nodeid.partition("::")
|
||||
said = f' """{docstring}"""\n' if docstring else ""
|
||||
body = (
|
||||
"import subprocess\n"
|
||||
"import sys\n\n\n"
|
||||
f"def {name}(tmp_path):\n"
|
||||
f' proc = subprocess.run([sys.executable, "-m", "{door}", "--steg", "{needle}"])\n'
|
||||
+ said
|
||||
+ f' proc = subprocess.run([sys.executable, "-m", "{door}", "--steg", "{needle}"])\n'
|
||||
+ (" assert proc.returncode == 0\n" if asserts else " return proc\n")
|
||||
)
|
||||
_write(root / file_part, body)
|
||||
|
|
@ -1143,6 +1147,30 @@ def test_a_probe_that_drives_the_door_without_naming_the_step_proves_the_door_on
|
|||
assert any("navngir ikke steget" in x for x in row.exceptions), row.exceptions
|
||||
|
||||
|
||||
def test_a_probe_that_only_mentions_the_door_or_the_step_proves_neither(tmp_path: Path) -> None:
|
||||
"""FUNN 19.09, mutant M12 overlevde: leses HELE probens kropp, holder det å NEVNE døren og
|
||||
steget i docstringen. Da er «rører døren» en omtale igjen, ikke en atferd — nøyaktig feilen
|
||||
ett hakk lenger inne. Gaten leser derfor aldri en streng som står alene."""
|
||||
src = _fake_src(tmp_path, chat_client=False)
|
||||
_write_probe(tmp_path, docstring="en ekte probe, den kaller fakesrc.driver med gjoer_noe")
|
||||
row = gate.score_toolbox(_one_step(), src, _fake_run_path(), _FAKE_PASSED, tmp_path)
|
||||
assert (row.k, row.n) == (1, 1), row.exceptions
|
||||
|
||||
_write_probe(
|
||||
tmp_path,
|
||||
door="fakesrc.enhelt_annen_modul",
|
||||
docstring="denne proben kjører fakesrc.driver",
|
||||
)
|
||||
row = gate.score_toolbox(_one_step(), src, _fake_run_path(), _FAKE_PASSED, tmp_path)
|
||||
assert (row.k, row.n) == (0, 1), row.exceptions
|
||||
assert any("rører ikke døren" in x for x in row.exceptions), row.exceptions
|
||||
|
||||
_write_probe(tmp_path, needle="et_annet_navn", docstring="beviser steget gjoer_noe")
|
||||
row = gate.score_toolbox(_one_step(), src, _fake_run_path(), _FAKE_PASSED, tmp_path)
|
||||
assert (row.k, row.n) == (0, 1), row.exceptions
|
||||
assert any("navngir ikke steget" in x for x in row.exceptions), row.exceptions
|
||||
|
||||
|
||||
def test_a_probe_that_asserts_nothing_is_not_a_behaviour_probe(tmp_path: Path) -> None:
|
||||
src = _fake_src(tmp_path, chat_client=False)
|
||||
_write_probe(tmp_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue