From 7c092c6a8085842578a1c22f2bfda237b7dc6a9c Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Wed, 11 Nov 2026 20:45:15 -0600 Subject: [PATCH 1/7] Harden C6 hard-direction mutant verdict checks --- .../c6-hard-direction-factorization.yml | 37 +++++++++-- .../test_hard_direction_workflow_contract.py | 65 +++++++++++++++++++ 2 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 tests/test_hard_direction_workflow_contract.py diff --git a/.github/workflows/c6-hard-direction-factorization.yml b/.github/workflows/c6-hard-direction-factorization.yml index 9016a5d41..042aa63f6 100644 --- a/.github/workflows/c6-hard-direction-factorization.yml +++ b/.github/workflows/c6-hard-direction-factorization.yml @@ -5,6 +5,7 @@ name: C6 hard-direction factorization (replay) paths: - 'frontiers/c6_hard_direction_factorization_20260930/**' - '.github/workflows/c6-hard-direction-factorization.yml' + - 'tests/test_hard_direction_workflow_contract.py' - 'frontiers/two_scale_cluster_geometry_20260929/RADIAL_TAIL.md' - 'frontiers/radial_rate_20260930/PROOF.md' - 'frontiers/spectral_cluster_closure_20260929/PROOF.md' @@ -27,13 +28,17 @@ jobs: - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 with: python-version: '3.11.16' + - name: Verify the failure contract in both interpreter modes + run: | + python -B -S -m unittest discover -s tests -p test_hard_direction_workflow_contract.py -v + python -B -O -S -m unittest discover -s tests -p test_hard_direction_workflow_contract.py -v - name: Verify manifest and main-resident pins, replay the exact lemma, closed forms and tables, reject mutants env: PYTHONDONTWRITEBYTECODE: '1' run: | set -euo pipefail python -B -S - <<'PY' - import hashlib, json, pathlib, subprocess, sys + import hashlib, json, math, pathlib, subprocess, sys root = pathlib.Path('frontiers/c6_hard_direction_factorization_20260930').resolve() manifest = json.loads((root / 'SOURCE_FILES.json').read_text())['files'] present = sorted(p.name for p in root.iterdir()) @@ -55,13 +60,33 @@ jobs: if len(data) != entry['bytes'] or hashlib.sha256(data).hexdigest() != entry['sha256'] or blob != entry['git_blob']: raise ValueError('consumed source identity mismatch on this tree: ' + entry['path']) script = str(root / 'factorization.py') + expected = { + 'drop-vandermonde': 'm_(3,0) = (7 - 4 sqrt2)/2', + 'hard-power-two': 'N_3(0) = 2 sqrt2', + 'drop-spectral-constant': 'c_1 = 1, c_2 = pi', + } + def pairs(items): + d = {} + for key, value in items: + if key in d: + raise ValueError('duplicate JSON key: ' + key) + d[key] = value + return d + def decode(out, code): + if out.returncode != code or out.stderr: + raise RuntimeError('unexpected child exit or stderr') + return json.loads(out.stdout, object_pairs_hook=pairs, + parse_constant=lambda value: (_ for _ in ()).throw(ValueError(value))) for flags in (['-B', '-S'], ['-B', '-O', '-S']): out = subprocess.run([sys.executable, *flags, script, '--check'], cwd=root, capture_output=True, timeout=900) - if out.returncode != 0: - raise RuntimeError('check failed under ' + ' '.join(flags) + ': ' + out.stdout.decode()[-400:]) - for m in ['drop-vandermonde', 'hard-power-two', 'drop-spectral-constant']: - rc = subprocess.run([sys.executable, *flags, script, '--check', '--mutant', m], cwd=root, capture_output=True, timeout=900).returncode - if rc != 1: + baseline = decode(out, 0) + if (not isinstance(baseline, dict) or set(baseline) != {'check', 'R_3_0', 'closed_form', 'mutant'} + or baseline['check'] != 'ok' or baseline['mutant'] is not None + or any(type(baseline[k]) not in (int, float) or not math.isfinite(baseline[k]) for k in ('R_3_0', 'closed_form'))): + raise RuntimeError('unexpected baseline result') + for m, reason in expected.items(): + out = subprocess.run([sys.executable, *flags, script, '--check', '--mutant', m], cwd=root, capture_output=True, timeout=900) + if decode(out, 1) != {'check': 'FAIL', 'what': reason, 'mutant': m}: raise RuntimeError('mutant ' + m + ' not rejected') print(json.dumps({'scientific_effect': 'NONE', 'certified': False})) PY diff --git a/tests/test_hard_direction_workflow_contract.py b/tests/test_hard_direction_workflow_contract.py new file mode 100644 index 000000000..e4222e8b3 --- /dev/null +++ b/tests/test_hard_direction_workflow_contract.py @@ -0,0 +1,65 @@ +import pathlib +import subprocess +import sys +import tempfile +import unittest + + +class HardDirectionWorkflowContract(unittest.TestCase): + def test_adverse_child_outcomes_are_rejected(self): + workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() + start = workflow.index(" script = str(root / 'factorization.py')") + end = workflow.index(" print(json.dumps({'scientific_effect'", start) + block = '\n'.join(line[10:] for line in workflow[start:end].splitlines()) + harness = 'import pathlib,subprocess,sys,json,math\nroot=pathlib.Path(sys.argv[1])\n' + block + for failure in ('silent', 'wrong_reason', 'wrong_label', 'stderr', 'duplicate', 'invalid_json'): + for target in ('drop-vandermonde', 'hard-power-two', 'drop-spectral-constant'): + with self.subTest(failure=failure, target=target), tempfile.TemporaryDirectory() as tmp: + program = """import json,sys +mode = %r +target = %r +if '--mutant' not in sys.argv: + print(json.dumps({'check':'ok','R_3_0':1.0,'closed_form':1.0,'mutant':None})); sys.exit(0) +mutant=sys.argv[-1] +reasons={'drop-vandermonde':'m_(3,0) = (7 - 4 sqrt2)/2','hard-power-two':'N_3(0) = 2 sqrt2','drop-spectral-constant':'c_1 = 1, c_2 = pi'} +if mutant != target: + print(json.dumps({'check':'FAIL','what':reasons[mutant],'mutant':mutant})); sys.exit(1) +if mode == 'silent': sys.exit(1) +if mode == 'invalid_json': print('not json'); sys.exit(1) +if mode == 'duplicate': print('{"check":"FAIL","check":"FAIL"}'); sys.exit(1) +if mode == 'stderr': print('unexpected',file=sys.stderr) +print(json.dumps({'check':'FAIL','what': 'wrong' if mode == 'wrong_reason' else reasons[mutant], 'mutant': 'wrong' if mode == 'wrong_label' else mutant})) +sys.exit(1) +""" % (failure, target) + pathlib.Path(tmp, 'factorization.py').write_text(program) + child = subprocess.run([sys.executable, '-B', '-S', '-c', harness, tmp], capture_output=True) + self.assertNotEqual(child.returncode, 0, failure) + + def test_actual_checker_and_all_mutants(self): + workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() + start = workflow.index(" script = str(root / 'factorization.py')") + end = workflow.index(" print(json.dumps({'scientific_effect'", start) + block = '\n'.join(line[10:] for line in workflow[start:end].splitlines()) + root = pathlib.Path('frontiers/c6_hard_direction_factorization_20260930').resolve() + harness = 'import pathlib,subprocess,sys,json,math\nroot=pathlib.Path(sys.argv[1])\n' + block + child = subprocess.run([sys.executable, '-B', '-S', '-c', harness, str(root)], capture_output=True, timeout=120) + self.assertEqual(child.returncode, 0, child.stderr.decode()) + + def test_unrelated_child_crash_is_not_a_mutant_kill(self): + workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() + start = workflow.index(" script = str(root / 'factorization.py')") + end = workflow.index(" print(json.dumps({'scientific_effect'", start) + block = '\n'.join(line[10:] for line in workflow[start:end].splitlines()) + with tempfile.TemporaryDirectory() as tmp: + pathlib.Path(tmp, 'factorization.py').write_text( + "import json,sys\n" + "if '--mutant' in sys.argv: raise RuntimeError('unrelated failure')\n" + "print(json.dumps({'check':'ok','R_3_0':4.211645867438038,'closed_form':4.2116458674380395,'mutant':None}))\n" + ) + harness = 'import pathlib,subprocess,sys,json,math\nroot=pathlib.Path(sys.argv[1])\n' + block + child = subprocess.run([sys.executable, '-B', '-S', '-c', harness, tmp], capture_output=True) + self.assertNotEqual(child.returncode, 0, child.stdout.decode()) + + +if __name__ == '__main__': + unittest.main() From e4469d9d21edeecd5c168a8956cb5d76834fd2a8 Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Wed, 11 Nov 2026 23:05:02 -0600 Subject: [PATCH 2/7] Bind adverse tests to live guard traceback provenance --- .../test_hard_direction_workflow_contract.py | 54 ++++++++++++++++--- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/tests/test_hard_direction_workflow_contract.py b/tests/test_hard_direction_workflow_contract.py index e4222e8b3..5594b567d 100644 --- a/tests/test_hard_direction_workflow_contract.py +++ b/tests/test_hard_direction_workflow_contract.py @@ -1,4 +1,5 @@ import pathlib +import json import subprocess import sys import tempfile @@ -6,12 +7,34 @@ class HardDirectionWorkflowContract(unittest.TestCase): + @staticmethod + def guarded_run(block, root): + # Record the actual traceback while it is live, before unittest formats it. + driver = '''import json,math,pathlib,subprocess,sys +root=pathlib.Path(sys.argv[1]) +source=sys.stdin.read() +try: + exec(compile(source, '', 'exec')) +except BaseException as exc: + tb=exc.__traceback__ + frames=[] + while tb is not None: + code=tb.tb_frame.f_code + if code.co_filename == '': + frames.append([code.co_name,tb.tb_lineno]) + tb=tb.tb_next + print(json.dumps({'exception':type(exc).__name__,'message':str(exc),'frames':frames})) + sys.exit(42) +''' + result = subprocess.run([sys.executable, '-B', '-S', '-c', driver, str(root)], + input=block.encode(), capture_output=True, timeout=120) + return result + def test_adverse_child_outcomes_are_rejected(self): workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() start = workflow.index(" script = str(root / 'factorization.py')") end = workflow.index(" print(json.dumps({'scientific_effect'", start) block = '\n'.join(line[10:] for line in workflow[start:end].splitlines()) - harness = 'import pathlib,subprocess,sys,json,math\nroot=pathlib.Path(sys.argv[1])\n' + block for failure in ('silent', 'wrong_reason', 'wrong_label', 'stderr', 'duplicate', 'invalid_json'): for target in ('drop-vandermonde', 'hard-power-two', 'drop-spectral-constant'): with self.subTest(failure=failure, target=target), tempfile.TemporaryDirectory() as tmp: @@ -32,8 +55,24 @@ def test_adverse_child_outcomes_are_rejected(self): sys.exit(1) """ % (failure, target) pathlib.Path(tmp, 'factorization.py').write_text(program) - child = subprocess.run([sys.executable, '-B', '-S', '-c', harness, tmp], capture_output=True) - self.assertNotEqual(child.returncode, 0, failure) + child = self.guarded_run(block, tmp) + self.assertEqual(child.returncode, 42, child.stderr.decode()) + event = json.loads(child.stdout) + expected_type = {'silent':'JSONDecodeError', 'invalid_json':'JSONDecodeError', 'duplicate':'ValueError'}.get(failure, 'RuntimeError') + self.assertEqual(event['exception'], expected_type) + function, line = event['frames'][-1] + source_line = block.splitlines()[line - 1].strip() + if failure in ('silent', 'invalid_json'): + self.assertEqual((function, source_line), ('decode', 'return json.loads(out.stdout, object_pairs_hook=pairs,')) + elif failure == 'duplicate': + self.assertEqual(function, 'pairs') + self.assertIn("raise ValueError('duplicate JSON key:", source_line) + elif failure == 'stderr': + self.assertEqual(function, 'decode') + self.assertIn("raise RuntimeError('unexpected child exit or stderr')", source_line) + else: + self.assertEqual(function, '') + self.assertIn("raise RuntimeError('mutant ' + m + ' not rejected')", source_line) def test_actual_checker_and_all_mutants(self): workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() @@ -56,9 +95,12 @@ def test_unrelated_child_crash_is_not_a_mutant_kill(self): "if '--mutant' in sys.argv: raise RuntimeError('unrelated failure')\n" "print(json.dumps({'check':'ok','R_3_0':4.211645867438038,'closed_form':4.2116458674380395,'mutant':None}))\n" ) - harness = 'import pathlib,subprocess,sys,json,math\nroot=pathlib.Path(sys.argv[1])\n' + block - child = subprocess.run([sys.executable, '-B', '-S', '-c', harness, tmp], capture_output=True) - self.assertNotEqual(child.returncode, 0, child.stdout.decode()) + child = self.guarded_run(block, tmp) + self.assertEqual(child.returncode, 42, child.stderr.decode()) + event = json.loads(child.stdout) + function, line = event['frames'][-1] + self.assertEqual((event['exception'], function), ('RuntimeError', 'decode')) + self.assertIn("raise RuntimeError('unexpected child exit or stderr')", block.splitlines()[line - 1]) if __name__ == '__main__': From 265d1c433ebaf773e62257ce752db58bf2391b50 Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Thu, 12 Nov 2026 00:18:03 -0600 Subject: [PATCH 3/7] Exercise baseline and traceback-origin controls --- .../test_hard_direction_workflow_contract.py | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/test_hard_direction_workflow_contract.py b/tests/test_hard_direction_workflow_contract.py index 5594b567d..3294d85c0 100644 --- a/tests/test_hard_direction_workflow_contract.py +++ b/tests/test_hard_direction_workflow_contract.py @@ -30,6 +30,46 @@ def guarded_run(block, root): input=block.encode(), capture_output=True, timeout=120) return result + def test_traceback_records_unrelated_same_message_origin(self): + block = "raise RuntimeError('unexpected child exit or stderr')\n" + child = self.guarded_run(block, '.') + self.assertEqual(child.returncode, 42, child.stderr.decode()) + event = json.loads(child.stdout) + self.assertEqual(event['exception'], 'RuntimeError') + self.assertEqual(event['message'], 'unexpected child exit or stderr') + # Same text is insufficient: this originated at the module body, not decode. + self.assertEqual(event['frames'], [['', 1]]) + + def test_baseline_child_failures_are_not_admitted(self): + workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() + start = workflow.index(" script = str(root / 'factorization.py')") + end = workflow.index(" print(json.dumps({'scientific_effect'", start) + block = '\n'.join(line[10:] for line in workflow[start:end].splitlines()) + bad_programs = { + 'exit': 'raise SystemExit(1)', + 'stderr': "import sys; print('error', file=sys.stderr)", + 'wrong_schema': "print('{}')", + 'nonfinite': "print('{\\\"check\\\":\\\"ok\\\",\\\"R_3_0\\\":NaN,\\\"closed_form\\\":1,\\\"mutant\\\":null}')", + } + for case, program in bad_programs.items(): + with self.subTest(case=case), tempfile.TemporaryDirectory() as tmp: + pathlib.Path(tmp, 'factorization.py').write_text(program + '\n') + child = self.guarded_run(block, tmp) + self.assertEqual(child.returncode, 42, child.stderr.decode()) + event = json.loads(child.stdout) + function, line = event['frames'][-1] + source_line = block.splitlines()[line - 1] + if case in ('exit', 'stderr'): + self.assertEqual((event['exception'], function), ('RuntimeError', 'decode')) + self.assertIn('unexpected child exit or stderr', source_line) + elif case == 'wrong_schema': + self.assertEqual((event['exception'], function), ('RuntimeError', '')) + self.assertIn('unexpected baseline result', source_line) + else: + self.assertEqual(event['exception'], 'ValueError') + self.assertEqual(function, '') + self.assertIn('parse_constant=lambda value:', source_line) + def test_adverse_child_outcomes_are_rejected(self): workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() start = workflow.index(" script = str(root / 'factorization.py')") From 1ca778deff00be455a801f607bd267878ff7e1c0 Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Thu, 12 Nov 2026 06:04:47 -0600 Subject: [PATCH 4/7] Test optimized child execution in hard-direction guard --- .../test_hard_direction_workflow_contract.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_hard_direction_workflow_contract.py b/tests/test_hard_direction_workflow_contract.py index 3294d85c0..9f121be3d 100644 --- a/tests/test_hard_direction_workflow_contract.py +++ b/tests/test_hard_direction_workflow_contract.py @@ -114,6 +114,27 @@ def test_adverse_child_outcomes_are_rejected(self): self.assertEqual(function, '') self.assertIn("raise RuntimeError('mutant ' + m + ' not rejected')", source_line) + def test_optimized_child_failure_is_exercised(self): + workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() + start = workflow.index(" script = str(root / 'factorization.py')") + end = workflow.index(" print(json.dumps({'scientific_effect'", start) + block = '\n'.join(line[10:] for line in workflow[start:end].splitlines()) + with tempfile.TemporaryDirectory() as tmp: + pathlib.Path(tmp, 'factorization.py').write_text( + "import json,sys\n" + "if sys.flags.optimize: raise RuntimeError('optimized child failure')\n" + "reasons={'drop-vandermonde':'m_(3,0) = (7 - 4 sqrt2)/2','hard-power-two':'N_3(0) = 2 sqrt2','drop-spectral-constant':'c_1 = 1, c_2 = pi'}\n" + "if '--mutant' in sys.argv:\n" + " m=sys.argv[-1]; print(json.dumps({'check':'FAIL','what':reasons[m],'mutant':m})); sys.exit(1)\n" + "print(json.dumps({'check':'ok','R_3_0':1.0,'closed_form':1.0,'mutant':None}))\n" + ) + child = self.guarded_run(block, tmp) + self.assertEqual(child.returncode, 42, child.stderr.decode()) + event = json.loads(child.stdout) + function, line = event['frames'][-1] + self.assertEqual((event['exception'], function), ('RuntimeError', 'decode')) + self.assertIn("raise RuntimeError('unexpected child exit or stderr')", block.splitlines()[line - 1]) + def test_actual_checker_and_all_mutants(self): workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() start = workflow.index(" script = str(root / 'factorization.py')") From 7db3695018cd6504e195c0c5e8057e76261aa2cb Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Thu, 12 Nov 2026 08:42:34 -0600 Subject: [PATCH 5/7] Test normal child execution in hard-direction guard --- .../test_hard_direction_workflow_contract.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_hard_direction_workflow_contract.py b/tests/test_hard_direction_workflow_contract.py index 9f121be3d..60d2d6cc4 100644 --- a/tests/test_hard_direction_workflow_contract.py +++ b/tests/test_hard_direction_workflow_contract.py @@ -135,6 +135,27 @@ def test_optimized_child_failure_is_exercised(self): self.assertEqual((event['exception'], function), ('RuntimeError', 'decode')) self.assertIn("raise RuntimeError('unexpected child exit or stderr')", block.splitlines()[line - 1]) + def test_normal_child_failure_is_exercised(self): + workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() + start = workflow.index(" script = str(root / 'factorization.py')") + end = workflow.index(" print(json.dumps({'scientific_effect'", start) + block = '\n'.join(line[10:] for line in workflow[start:end].splitlines()) + with tempfile.TemporaryDirectory() as tmp: + pathlib.Path(tmp, 'factorization.py').write_text( + "import json,sys\n" + "if not sys.flags.optimize: raise RuntimeError('normal child failure')\n" + "reasons={'drop-vandermonde':'m_(3,0) = (7 - 4 sqrt2)/2','hard-power-two':'N_3(0) = 2 sqrt2','drop-spectral-constant':'c_1 = 1, c_2 = pi'}\n" + "if '--mutant' in sys.argv:\n" + " m=sys.argv[-1]; print(json.dumps({'check':'FAIL','what':reasons[m],'mutant':m})); sys.exit(1)\n" + "print(json.dumps({'check':'ok','R_3_0':1.0,'closed_form':1.0,'mutant':None}))\n" + ) + child = self.guarded_run(block, tmp) + self.assertEqual(child.returncode, 42, child.stderr.decode()) + event = json.loads(child.stdout) + function, line = event['frames'][-1] + self.assertEqual((event['exception'], function), ('RuntimeError', 'decode')) + self.assertIn("raise RuntimeError('unexpected child exit or stderr')", block.splitlines()[line - 1]) + def test_actual_checker_and_all_mutants(self): workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() start = workflow.index(" script = str(root / 'factorization.py')") From 51ee3c3295e8dd3869b649c36bd1a71cd38dfde3 Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Thu, 12 Nov 2026 11:09:11 -0600 Subject: [PATCH 6/7] Test every hard-direction mutant in both child modes --- .../test_hard_direction_workflow_contract.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_hard_direction_workflow_contract.py b/tests/test_hard_direction_workflow_contract.py index 60d2d6cc4..6e6ed4d85 100644 --- a/tests/test_hard_direction_workflow_contract.py +++ b/tests/test_hard_direction_workflow_contract.py @@ -156,6 +156,30 @@ def test_normal_child_failure_is_exercised(self): self.assertEqual((event['exception'], function), ('RuntimeError', 'decode')) self.assertIn("raise RuntimeError('unexpected child exit or stderr')", block.splitlines()[line - 1]) + def test_each_mutant_is_exercised_in_each_child_mode(self): + workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() + start = workflow.index(" script = str(root / 'factorization.py')") + end = workflow.index(" print(json.dumps({'scientific_effect'", start) + block = '\n'.join(line[10:] for line in workflow[start:end].splitlines()) + for optimized in (0, 1): + for target in ('drop-vandermonde', 'hard-power-two', 'drop-spectral-constant'): + with self.subTest(optimized=optimized, target=target), tempfile.TemporaryDirectory() as tmp: + program = '''import json,sys +reasons={'drop-vandermonde':'m_(3,0) = (7 - 4 sqrt2)/2','hard-power-two':'N_3(0) = 2 sqrt2','drop-spectral-constant':'c_1 = 1, c_2 = pi'} +if '--mutant' not in sys.argv: + print(json.dumps({'check':'ok','R_3_0':1.0,'closed_form':1.0,'mutant':None})); sys.exit(0) +m=sys.argv[-1] +if sys.flags.optimize == %r and m == %r: raise RuntimeError('target child crash') +print(json.dumps({'check':'FAIL','what':reasons[m],'mutant':m})); sys.exit(1) +''' % (optimized, target) + pathlib.Path(tmp, 'factorization.py').write_text(program) + child = self.guarded_run(block, tmp) + self.assertEqual(child.returncode, 42, child.stderr.decode()) + event = json.loads(child.stdout) + function, line = event['frames'][-1] + self.assertEqual((event['exception'], function), ('RuntimeError', 'decode')) + self.assertIn("raise RuntimeError('unexpected child exit or stderr')", block.splitlines()[line - 1]) + def test_actual_checker_and_all_mutants(self): workflow = pathlib.Path('.github/workflows/c6-hard-direction-factorization.yml').read_text() start = workflow.index(" script = str(root / 'factorization.py')") From 2cbde50c80844b3ba428bb6004acab42fe89bd36 Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Thu, 12 Nov 2026 14:46:54 -0600 Subject: [PATCH 7/7] Reject boolean baseline numeric fields in contract tests --- tests/test_hard_direction_workflow_contract.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_hard_direction_workflow_contract.py b/tests/test_hard_direction_workflow_contract.py index 6e6ed4d85..dc8ba6f1d 100644 --- a/tests/test_hard_direction_workflow_contract.py +++ b/tests/test_hard_direction_workflow_contract.py @@ -49,6 +49,8 @@ def test_baseline_child_failures_are_not_admitted(self): 'exit': 'raise SystemExit(1)', 'stderr': "import sys; print('error', file=sys.stderr)", 'wrong_schema': "print('{}')", + 'bool_number': "import json; print(json.dumps({'check':'ok','R_3_0':True,'closed_form':1,'mutant':None}))", + 'bool_closed_form': "import json; print(json.dumps({'check':'ok','R_3_0':1,'closed_form':True,'mutant':None}))", 'nonfinite': "print('{\\\"check\\\":\\\"ok\\\",\\\"R_3_0\\\":NaN,\\\"closed_form\\\":1,\\\"mutant\\\":null}')", } for case, program in bad_programs.items(): @@ -62,7 +64,7 @@ def test_baseline_child_failures_are_not_admitted(self): if case in ('exit', 'stderr'): self.assertEqual((event['exception'], function), ('RuntimeError', 'decode')) self.assertIn('unexpected child exit or stderr', source_line) - elif case == 'wrong_schema': + elif case in ('wrong_schema', 'bool_number', 'bool_closed_form'): self.assertEqual((event['exception'], function), ('RuntimeError', '')) self.assertIn('unexpected baseline result', source_line) else: