Skip to content

Instantly share code, notes, and snippets.

@Desperado
Last active October 4, 2026 12:35
Show Gist options
  • Select an option

  • Save Desperado/67a71616ddab4230ea30be5052a3da63 to your computer and use it in GitHub Desktop.

Select an option

Save Desperado/67a71616ddab4230ea30be5052a3da63 to your computer and use it in GitHub Desktop.
QualityMax no-signup verified-patch sample — unsigned local fixture reproduction (QUA-1992)

Verified-Patch No-Signup Sample

This public sample lets a stranger reproduce the verified-patch shape locally without a QualityMax account, cloud sandbox, repository allowlist, or signing key. It is a synthetic fixture runner for QUA-1992, not a benchmark result and not the privileged verify_patch MCP arm described in the protocol.

Download verified_patch_sample.py from the public sample artifact, inspect it, and run this single command from any directory. The application repository is private; cloning it is neither required nor an anonymous setup path. Prerequisites: CPython 3.11 or 3.12 with venv support, Git, macOS or Linux, and public PyPI connectivity for the first install. No account, API key, Docker, application setup, or repository .env is required:

python3.11 verified_patch_sample.py --bootstrap

The artifact embeds only the frozen synthetic fixtures, their manifest, and the sample runner. The command installs only four pinned sample packages (pytest 8.3.5, iniconfig 2.1.0, packaging 24.2, pluggy 1.5.0) into a temporary virtualenv, executes the sample, and removes the virtualenv. It does not install the application's production requirements or change your Python environment. Allow up to three minutes for dependency installation and 30 seconds per pytest command. Bootstrap failure exits 2 with a safe setup message.

The default command is a plain-language walkthrough. It first applies a deliberately bad patch that moves the free-shipping threshold from 5000 cents to 10000 cents: the unchanged $50 boundary test fails before and after it, so the local policy returns needs_human. It then applies the successful repair, which changes > 5000 to >= 5000; the same unchanged test fails before the repair and passes after it. Both runs start from independent copies of the same original files.

The output names the original source, proposed source, unchanged test, and receipt for each result. Example layout (the unique directory changes each run):

artifacts/verified-patch-sample/<run-id>/
├── broken/   # rejected patch; needs_human
└── repair/   # successful repair; pass

The default walkthrough exits 0 only when both declared outcomes are observed. --fixture <id> keeps the original one-fixture JSON summary for automation. Exit 0 for the rejected fixture means its expected abstention completed, not that its patch passed. This differential sample emits pass or needs_human, not a production signed fail. Setup/integrity errors are not verification results; a timed-out test records execution_error: timeout and exits 2.

Inspectable evidence is written to a fresh unique artifacts/verified-patch-sample/<run-id>/ directory printed in the summary. The default has broken/ and repair/ subdirectories; --out <new-directory> selects that new parent directory. Explicit --fixture mode writes one receipt directly to --out. Existing directories are rejected rather than mixing old and new receipts:

  • sample-result.json records the manifest hash, patch hash, selected command evidence, normalized local status, and the explicit unsigned-provenance note.
  • base-selected.xml is the selected-test JUnit report against the base fixture.
  • head-selected.xml is the selected-test JUnit report after applying the candidate patch.
  • head-oracle.xml is the independent contract report against the patched candidate, for fixture inspection only.
  • candidate.patch, base/, and head/ preserve the exact executed source/tests; JSON records their SHA-256 hashes, runner hash, and actual Python/pytest/platform versions.

Supported sample environment: CPython 3.11 or 3.12 on macOS or Linux; Python 3.12 users substitute python3.12 in the command. An already provisioned maintainer can instead use scripts/conductor-python scripts/verified_patch_no_signup_sample.py; --bootstrap is the stranger-facing path. Maintainers rebuild the deterministic public artifact with scripts/conductor-python scripts/package_verified_patch_sample.py --out <new-artifact.py>. The protocol's measured baseline remains Linux x86_64, CPython 3.11.8 and pinned dependencies; this sample is fixture validation, never a measured benchmark attempt.

Use --fixture broken or --fixture repair to run one result and receive its JSON summary. --fixture non_reproducing demonstrates an already-green selected test (needs_human). overbroad and collateral deliberately demonstrate selected-test pass while the independent oracle fails; that is not whole-patch correctness. syntax_error demonstrates collection abstention. The test-only fixture is deliberately not admitted: weakening a selected assertion is not a source repair. All accepted inputs are frozen public fixtures; this is not an arbitrary patch runner.

The artifact embeds the frozen manifest and fixture contract. The public fresh reproduction record records the immutable download, digests and observed validation. Maintainer-only references in the private checkout are docs/marketing/QUALITY_GATE_BENCHMARK_PROTOCOL.md and benchmarks/verified_patch/v1/manifest.json.

Security and claim boundaries:

  • The runner accepts only fixture IDs from benchmarks/verified_patch/v1/manifest.json; it does not execute arbitrary user-supplied patches.
  • The output is unsigned. Even a real protocol signature would prove provenance, not correctness.
  • Passing the selected test would only prove that selected assertion ran as recorded; the oracle evidence remains a separate public fixture check, not hidden ground truth and not a whole-patch safety proof.
"""Unsigned local fixture sample; not a measured benchmark or cloud verdict."""
import json
import subprocess
import sys
import tempfile
from pathlib import Path
FILES = json.loads('{"benchmarks/verified_patch/v1/base/invoice.py": "def invoice_total(subtotal_cents: int, member: bool = False) -> int:\\n if subtotal_cents < 0:\\n raise ValueError(\\"subtotal must be non-negative\\")\\n discounted = subtotal_cents - (subtotal_cents // 10 if member else 0)\\n shipping = 0 if subtotal_cents > 5000 else 500\\n return discounted + shipping\\n", "benchmarks/verified_patch/v1/base/test_invoice.py": "from invoice import invoice_total\\n\\n\\ndef test_paid_shipping_below_boundary():\\n assert invoice_total(4999) == 5499\\n\\n\\ndef test_free_shipping_boundary():\\n assert invoice_total(5000) == 5000\\n", "benchmarks/verified_patch/v1/manifest.json": "{\\n \\"protocol_version\\": \\"1.0.0\\",\\n \\"protocol_path\\": \\"docs/marketing/QUALITY_GATE_BENCHMARK_PROTOCOL.md\\",\\n \\"defect_family\\": \\"invoice_free_shipping_threshold\\",\\n \\"repetitions_per_fixture_per_arm\\": 10,\\n \\"arms\\": [\\"qualitymax_verify_patch\\", \\"pytest_head_only\\", \\"pytest_base_head\\"],\\n \\"base_files\\": [\\"base/invoice.py\\", \\"base/test_invoice.py\\"],\\n \\"oracle_path\\": \\"oracle/test_invoice_contract.py\\",\\n \\"artifacts_sha256\\": {\\n \\"base/invoice.py\\": \\"c19cdb5db566358c31ddb077e12918890f1f62329b026d5e56f02e3c9fba356c\\",\\n \\"base/test_invoice.py\\": \\"cecf4300cd3a213b078a0c1e279a783a2c949ee65db2f940dc1864c8892038eb\\",\\n \\"oracle/test_invoice_contract.py\\": \\"2098f380a6e91cdbacc870370a88400d97f197830d2cc4ca7b902204291e3f11\\",\\n \\"patches/broken.patch\\": \\"213ef03e849885fbfd68157de8e7aa360691ddbe91de2ae18978e6a6a02b0c0d\\",\\n \\"patches/collateral.patch\\": \\"048c595db45c17c3b0b844bcd68e1f05f411c046f6436b4ad33dcac47ea5db17\\",\\n \\"patches/overbroad.patch\\": \\"cc85d6eec0e5c77fb14a10f2a35de8e9dfff69814289f5aca1a52c47c9c837a0\\",\\n \\"patches/repair.patch\\": \\"50e15e51504948d6edc18de9e8835e9b86815b5b7689c4b0b51ca35ccae7efe1\\",\\n \\"patches/syntax_error.patch\\": \\"c341b6bf6a2d70cf2959e2ac178af40d00cef875ecec1fb0425e843a34d8fca2\\",\\n \\"patches/test_only.patch\\": \\"d012976cb47d0b6375413e069694764908bebae158d8300fd34d553bdbaa328d\\",\\n \\"requirements.txt\\": \\"52df5ed8fd46a690a6ea457a18ee138399d8607c88f01b891f43b3c6916db629\\"\\n },\\n \\"fixtures\\": [\\n {\\n \\"id\\": \\"repair\\",\\n \\"patch\\": \\"patches/repair.patch\\",\\n \\"test_path\\": \\"test_invoice.py::test_free_shipping_boundary\\",\\n \\"contract_satisfied\\": true,\\n \\"reproduction_eligible\\": true,\\n \\"expected_base_exit_code\\": 1,\\n \\"expected_candidate_exit_code\\": 0,\\n \\"expected_oracle_exit_code\\": 0,\\n \\"expected_qualitymax_policy\\": \\"pass\\"\\n },\\n {\\n \\"id\\": \\"broken\\",\\n \\"patch\\": \\"patches/broken.patch\\",\\n \\"test_path\\": \\"test_invoice.py::test_free_shipping_boundary\\",\\n \\"contract_satisfied\\": false,\\n \\"reproduction_eligible\\": false,\\n \\"expected_base_exit_code\\": 1,\\n \\"expected_candidate_exit_code\\": 1,\\n \\"expected_oracle_exit_code\\": 1,\\n \\"expected_qualitymax_policy\\": \\"needs_human\\"\\n },\\n {\\n \\"id\\": \\"overbroad\\",\\n \\"patch\\": \\"patches/overbroad.patch\\",\\n \\"test_path\\": \\"test_invoice.py::test_free_shipping_boundary\\",\\n \\"contract_satisfied\\": false,\\n \\"reproduction_eligible\\": true,\\n \\"expected_base_exit_code\\": 1,\\n \\"expected_candidate_exit_code\\": 0,\\n \\"expected_oracle_exit_code\\": 1,\\n \\"expected_qualitymax_policy\\": \\"pass\\"\\n },\\n {\\n \\"id\\": \\"collateral\\",\\n \\"patch\\": \\"patches/collateral.patch\\",\\n \\"test_path\\": \\"test_invoice.py::test_free_shipping_boundary\\",\\n \\"contract_satisfied\\": false,\\n \\"reproduction_eligible\\": true,\\n \\"expected_base_exit_code\\": 1,\\n \\"expected_candidate_exit_code\\": 0,\\n \\"expected_oracle_exit_code\\": 1,\\n \\"expected_qualitymax_policy\\": \\"pass\\"\\n },\\n {\\n \\"id\\": \\"non_reproducing\\",\\n \\"patch\\": \\"patches/repair.patch\\",\\n \\"test_path\\": \\"test_invoice.py::test_paid_shipping_below_boundary\\",\\n \\"contract_satisfied\\": true,\\n \\"reproduction_eligible\\": false,\\n \\"expected_base_exit_code\\": 0,\\n \\"expected_candidate_exit_code\\": 0,\\n \\"expected_oracle_exit_code\\": 0,\\n \\"expected_qualitymax_policy\\": \\"needs_human\\"\\n },\\n {\\n \\"id\\": \\"test_only\\",\\n \\"patch\\": \\"patches/test_only.patch\\",\\n \\"test_path\\": \\"test_invoice.py::test_free_shipping_boundary\\",\\n \\"contract_satisfied\\": false,\\n \\"reproduction_eligible\\": false,\\n \\"expected_base_exit_code\\": 1,\\n \\"expected_candidate_exit_code\\": 0,\\n \\"expected_oracle_exit_code\\": 1,\\n \\"expected_qualitymax_policy\\": \\"tool_error\\"\\n },\\n {\\n \\"id\\": \\"syntax_error\\",\\n \\"patch\\": \\"patches/syntax_error.patch\\",\\n \\"test_path\\": \\"test_invoice.py::test_free_shipping_boundary\\",\\n \\"contract_satisfied\\": false,\\n \\"reproduction_eligible\\": false,\\n \\"expected_base_exit_code\\": 1,\\n \\"expected_candidate_exit_code\\": 4,\\n \\"expected_oracle_exit_code\\": 2,\\n \\"expected_qualitymax_policy\\": \\"needs_human\\"\\n }\\n ]\\n}\\n", "benchmarks/verified_patch/v1/oracle/test_invoice_contract.py": "import pytest\\nfrom invoice import invoice_total\\n\\n\\n@pytest.mark.parametrize(\\n (\\"subtotal_cents\\", \\"member\\", \\"expected\\"),\\n [\\n (0, False, 500),\\n (4999, False, 5499),\\n (5000, False, 5000),\\n (5001, False, 5001),\\n (4999, True, 5000),\\n (5000, True, 4500),\\n (5001, True, 4501),\\n ],\\n)\\ndef test_invoice_contract(subtotal_cents, member, expected):\\n assert invoice_total(subtotal_cents, member) == expected\\n\\n\\ndef test_negative_subtotal_rejected():\\n with pytest.raises(ValueError, match=\\"non-negative\\"):\\n invoice_total(-1)\\n", "benchmarks/verified_patch/v1/patches/broken.patch": "diff --git a/invoice.py b/invoice.py\\n--- a/invoice.py\\n+++ b/invoice.py\\n@@ -2,5 +2,5 @@\\n if subtotal_cents < 0:\\n raise ValueError(\\"subtotal must be non-negative\\")\\n discounted = subtotal_cents - (subtotal_cents // 10 if member else 0)\\n- shipping = 0 if subtotal_cents > 5000 else 500\\n+ shipping = 0 if subtotal_cents > 10000 else 500\\n return discounted + shipping\\n", "benchmarks/verified_patch/v1/patches/collateral.patch": "diff --git a/invoice.py b/invoice.py\\n--- a/invoice.py\\n+++ b/invoice.py\\n@@ -2,5 +2,5 @@\\n if subtotal_cents < 0:\\n raise ValueError(\\"subtotal must be non-negative\\")\\n- discounted = subtotal_cents - (subtotal_cents // 10 if member else 0)\\n- shipping = 0 if subtotal_cents > 5000 else 500\\n+ discounted = subtotal_cents\\n+ shipping = 0 if subtotal_cents >= 5000 else 500\\n return discounted + shipping\\n", "benchmarks/verified_patch/v1/patches/overbroad.patch": "diff --git a/invoice.py b/invoice.py\\n--- a/invoice.py\\n+++ b/invoice.py\\n@@ -2,5 +2,5 @@\\n if subtotal_cents < 0:\\n raise ValueError(\\"subtotal must be non-negative\\")\\n discounted = subtotal_cents - (subtotal_cents // 10 if member else 0)\\n- shipping = 0 if subtotal_cents > 5000 else 500\\n+ shipping = 0\\n return discounted + shipping\\n", "benchmarks/verified_patch/v1/patches/repair.patch": "diff --git a/invoice.py b/invoice.py\\n--- a/invoice.py\\n+++ b/invoice.py\\n@@ -2,5 +2,5 @@\\n if subtotal_cents < 0:\\n raise ValueError(\\"subtotal must be non-negative\\")\\n discounted = subtotal_cents - (subtotal_cents // 10 if member else 0)\\n- shipping = 0 if subtotal_cents > 5000 else 500\\n+ shipping = 0 if subtotal_cents >= 5000 else 500\\n return discounted + shipping\\n", "benchmarks/verified_patch/v1/patches/syntax_error.patch": "diff --git a/invoice.py b/invoice.py\\n--- a/invoice.py\\n+++ b/invoice.py\\n@@ -2,5 +2,5 @@\\n if subtotal_cents < 0:\\n raise ValueError(\\"subtotal must be non-negative\\")\\n discounted = subtotal_cents - (subtotal_cents // 10 if member else 0)\\n- shipping = 0 if subtotal_cents > 5000 else 500\\n+ shipping =\\n return discounted + shipping\\n", "benchmarks/verified_patch/v1/patches/test_only.patch": "diff --git a/test_invoice.py b/test_invoice.py\\n--- a/test_invoice.py\\n+++ b/test_invoice.py\\n@@ -8,2 +8,2 @@\\n def test_free_shipping_boundary():\\n- assert invoice_total(5000) == 5000\\n+ assert invoice_total(5000) == 5500\\n", "benchmarks/verified_patch/v1/requirements.txt": "iniconfig==2.1.0\\npackaging==24.2\\npluggy==1.5.0\\npytest==8.3.5\\n", "scripts/verified_patch_no_signup_sample.py": "#!/usr/bin/env python3\\n\\"\\"\\"No-signup local reproduction sample for the verified-patch protocol.\\n\\nThis runner is intentionally limited to the frozen public fixture manifest. It\\ndoes not execute arbitrary caller patches, does not call QualityMax services,\\nand does not sign verdicts. Its output is local evidence for inspection only.\\n\\"\\"\\"\\n\\nfrom __future__ import annotations\\n\\nimport argparse\\nimport hashlib\\nimport importlib.metadata\\nimport importlib.util\\nimport json\\nimport os\\nimport platform\\nimport shutil\\nimport subprocess\\nimport sys\\nimport tempfile\\nimport time\\nimport uuid\\nimport venv\\nimport xml.etree.ElementTree as ET\\nfrom pathlib import Path\\nfrom typing import Any\\n\\nREPO_ROOT = Path(__file__).resolve().parents[1]\\nROOT = REPO_ROOT / \\"benchmarks\\" / \\"verified_patch\\" / \\"v1\\"\\nFROZEN_MANIFEST_SHA256 = \\"6387aca0791539d9d9fde91bf9c09ae0b9fb7705b8a6aed3bc01d5c5f8054e7f\\"\\nSAMPLE_FIXTURES = (\\"broken\\", \\"repair\\", \\"non_reproducing\\", \\"overbroad\\", \\"collateral\\", \\"syntax_error\\")\\nWALKTHROUGH_TIMEOUT_SECONDS = 240\\nPYTEST_ENV = {\\n \\"PYTEST_DISABLE_PLUGIN_AUTOLOAD\\": \\"1\\",\\n \\"PYTHONDONTWRITEBYTECODE\\": \\"1\\",\\n \\"PYTHONHASHSEED\\": \\"0\\",\\n}\\n\\n\\ndef _sha256(path: Path) -> str:\\n return hashlib.sha256(path.read_bytes()).hexdigest()\\n\\n\\ndef _load_manifest() -> dict[str, Any]:\\n manifest_path = ROOT / \\"manifest.json\\"\\n manifest_bytes = manifest_path.read_bytes()\\n if hashlib.sha256(manifest_bytes).hexdigest() != FROZEN_MANIFEST_SHA256:\\n raise SystemExit(\\"manifest integrity check failed: only frozen v1 inputs are admitted\\")\\n manifest = json.loads(manifest_bytes)\\n expected = manifest[\\"artifacts_sha256\\"]\\n for relative_path, digest in expected.items():\\n actual = _sha256(ROOT / relative_path)\\n if actual != digest:\\n raise SystemExit(f\\"fixture integrity check failed for {relative_path}: {actual} != {digest}\\")\\n return manifest\\n\\n\\ndef _fixture_by_id(manifest: dict[str, Any], fixture_id: str) -> dict[str, Any]:\\n for fixture in manifest[\\"fixtures\\"]:\\n if fixture[\\"id\\"] == fixture_id:\\n return fixture\\n choices = \\", \\".join(item[\\"id\\"] for item in manifest[\\"fixtures\\"])\\n raise SystemExit(f\\"unknown fixture {fixture_id!r}; choose one of: {choices}\\")\\n\\n\\ndef _copy_base(manifest: dict[str, Any], workspace: Path) -> None:\\n for relative_path in manifest[\\"base_files\\"]:\\n shutil.copyfile(ROOT / relative_path, workspace / Path(relative_path).name)\\n\\n\\ndef _run_pytest(workspace: Path, target: str, report: Path) -> dict[str, Any]:\\n started = time.monotonic()\\n command = [\\n sys.executable,\\n \\"-m\\",\\n \\"pytest\\",\\n \\"-c\\",\\n os.devnull,\\n \\"--rootdir=.\\",\\n \\"-q\\",\\n f\\"--junitxml={report}\\",\\n target,\\n ]\\n try:\\n result = subprocess.run(\\n command,\\n cwd=workspace,\\n env={\\"PATH\\": os.defpath, **PYTEST_ENV, \\"PYTHONPATH\\": str(workspace)},\\n capture_output=True,\\n text=True,\\n timeout=30,\\n check=False,\\n )\\n except subprocess.TimeoutExpired:\\n return {\\n \\"command\\": command,\\n \\"exit_code\\": None,\\n \\"duration_seconds\\": round(time.monotonic() - started, 6),\\n \\"junit\\": None,\\n \\"cases\\": [],\\n \\"execution_error\\": \\"timeout\\",\\n }\\n duration_seconds = round(time.monotonic() - started, 6)\\n cases: list[dict[str, Any]] = []\\n if report.exists():\\n root = ET.parse(report).getroot()\\n for case in root.iter(\\"testcase\\"):\\n child_tags = {child.tag.rsplit(\\"}\\", 1)[-1] for child in case}\\n if \\"error\\" in child_tags:\\n outcome = \\"error\\"\\n elif \\"failure\\" in child_tags:\\n outcome = \\"fail\\"\\n elif \\"skipped\\" in child_tags:\\n outcome = \\"skipped\\"\\n else:\\n outcome = \\"pass\\"\\n cases.append({\\"name\\": case.get(\\"name\\"), \\"classname\\": case.get(\\"classname\\"), \\"outcome\\": outcome})\\n return {\\n \\"command\\": command,\\n \\"exit_code\\": result.returncode,\\n \\"duration_seconds\\": duration_seconds,\\n \\"junit\\": str(report),\\n \\"cases\\": cases,\\n \\"stdout_tail\\": result.stdout[-1200:],\\n \\"stderr_tail\\": result.stderr[-1200:],\\n }\\n\\n\\ndef _apply_manifest_patch(workspace: Path, patch: Path, git: str) -> None:\\n for options in ((\\"--check\\",), ()):\\n subprocess.run(\\n [git, \\"apply\\", *options, \\"--\\", str(patch)],\\n cwd=workspace,\\n env={\\"PATH\\": os.defpath},\\n capture_output=True,\\n text=True,\\n check=True,\\n timeout=10,\\n )\\n\\n\\ndef _policy(base: dict[str, Any], head: dict[str, Any]) -> str:\\n base_failed = base[\\"exit_code\\"] == 1 and any(case[\\"outcome\\"] == \\"fail\\" for case in base[\\"cases\\"])\\n head_passed = head[\\"exit_code\\"] == 0 and head[\\"cases\\"] and all(case[\\"outcome\\"] == \\"pass\\" for case in head[\\"cases\\"])\\n same_nodes = [(case[\\"classname\\"], case[\\"name\\"]) for case in base[\\"cases\\"]] == [\\n (case[\\"classname\\"], case[\\"name\\"]) for case in head[\\"cases\\"]\\n ]\\n return \\"pass\\" if base_failed and head_passed and same_nodes else \\"needs_human\\"\\n\\n\\ndef build_parser() -> argparse.ArgumentParser:\\n parser = argparse.ArgumentParser(description=\\"Run the public no-signup verified-patch sample.\\")\\n parser.add_argument(\\n \\"--fixture\\",\\n choices=SAMPLE_FIXTURES,\\n help=\\"run one frozen fixture and print its JSON receipt; test-only patches are not admitted\\",\\n )\\n parser.add_argument(\\"--out\\", help=\\"new evidence directory (must not already exist)\\")\\n parser.add_argument(\\n \\"--bootstrap\\", action=\\"store_true\\", help=\\"install only pinned sample dependencies in a temporary virtualenv\\"\\n )\\n return parser\\n\\n\\ndef _bootstrap(git: str) -> int:\\n with tempfile.TemporaryDirectory(prefix=\\"qmax-sample-venv-\\") as temporary:\\n venv.EnvBuilder(with_pip=True).create(temporary)\\n python = str(Path(temporary) / \\"bin\\" / \\"python\\")\\n subprocess.run(\\n [\\n python,\\n \\"-m\\",\\n \\"pip\\",\\n \\"--isolated\\",\\n \\"install\\",\\n \\"--disable-pip-version-check\\",\\n \\"--index-url\\",\\n \\"https://pypi.org/simple\\",\\n \\"-r\\",\\n str(ROOT / \\"requirements.txt\\"),\\n ],\\n env={\\"PATH\\": os.defpath},\\n stdout=subprocess.DEVNULL,\\n stderr=subprocess.DEVNULL,\\n check=True,\\n timeout=180,\\n )\\n arguments = [argument for argument in sys.argv[1:] if argument != \\"--bootstrap\\"]\\n return subprocess.run(\\n [python, str(Path(__file__).resolve()), *arguments],\\n env={\\"PATH\\": str(Path(git).parent) + os.pathsep + os.defpath},\\n timeout=WALKTHROUGH_TIMEOUT_SECONDS,\\n ).returncode\\n\\n\\ndef _run_fixture(manifest: dict[str, Any], fixture_id: str, out_dir: Path, git: str) -> tuple[dict[str, Any], int]:\\n fixture = _fixture_by_id(manifest, fixture_id)\\n out_dir.mkdir(parents=True, exist_ok=False)\\n patch_path = ROOT / fixture[\\"patch\\"]\\n\\n with tempfile.TemporaryDirectory(prefix=\\"qmax-verified-patch-\\") as tmp:\\n base_workspace = Path(tmp) / \\"base\\"\\n head_workspace = Path(tmp) / \\"head\\"\\n base_workspace.mkdir()\\n head_workspace.mkdir()\\n _copy_base(manifest, base_workspace)\\n _copy_base(manifest, head_workspace)\\n _apply_manifest_patch(head_workspace, patch_path, git)\\n\\n base = _run_pytest(base_workspace, fixture[\\"test_path\\"], out_dir / \\"base-selected.xml\\")\\n head = _run_pytest(head_workspace, fixture[\\"test_path\\"], out_dir / \\"head-selected.xml\\")\\n oracle = _run_pytest(head_workspace, str(ROOT / manifest[\\"oracle_path\\"]), out_dir / \\"head-oracle.xml\\")\\n for name, workspace in ((\\"base\\", base_workspace), (\\"head\\", head_workspace)):\\n shutil.copytree(workspace, out_dir / name, ignore=shutil.ignore_patterns(\\".pytest_cache\\", \\"__pycache__\\"))\\n shutil.copyfile(patch_path, out_dir / \\"candidate.patch\\")\\n\\n verdict_status = _policy(base, head)\\n evidence = {\\n \\"sample\\": \\"verified_patch_no_signup\\",\\n \\"warning\\": \\"local fixture reproduction only; not a QualityMax MCP result and not signed\\",\\n \\"protocol_version\\": manifest[\\"protocol_version\\"],\\n \\"protocol_path\\": manifest[\\"protocol_path\\"],\\n \\"manifest_sha256\\": _sha256(ROOT / \\"manifest.json\\"),\\n \\"runner_sha256\\": _sha256(Path(__file__)),\\n \\"environment\\": {\\n \\"python\\": platform.python_version(),\\n \\"system\\": platform.system(),\\n \\"machine\\": platform.machine(),\\n \\"pytest\\": importlib.metadata.version(\\"pytest\\"),\\n },\\n \\"trees_sha256\\": {\\n name: {Path(relative).name: _sha256(out_dir / name / Path(relative).name) for relative in manifest[\\"base_files\\"]}\\n for name in (\\"base\\", \\"head\\")\\n },\\n \\"fixture\\": {\\n \\"id\\": fixture[\\"id\\"],\\n \\"patch\\": fixture[\\"patch\\"],\\n \\"patch_sha256\\": _sha256(patch_path),\\n \\"selected_test\\": fixture[\\"test_path\\"],\\n \\"contract_satisfied\\": fixture[\\"contract_satisfied\\"],\\n },\\n \\"verdict\\": {\\n \\"status\\": verdict_status,\\n \\"reason\\": \\"base selected test failed and head selected test passed\\"\\n if verdict_status == \\"pass\\"\\n else \\"base/head reproduction did not establish a repair\\",\\n \\"signature\\": None,\\n \\"signature_note\\": \\"Absent by design. Protocol signatures prove provenance, not correctness.\\",\\n },\\n \\"runs\\": {\\"base_selected\\": base, \\"head_selected\\": head, \\"head_oracle\\": oracle},\\n \\"evidence_files\\": {\\n \\"json\\": str(out_dir / \\"sample-result.json\\"),\\n \\"base_junit\\": str(out_dir / \\"base-selected.xml\\"),\\n \\"head_junit\\": str(out_dir / \\"head-selected.xml\\"),\\n \\"oracle_junit\\": str(out_dir / \\"head-oracle.xml\\"),\\n \\"patch\\": str(out_dir / \\"candidate.patch\\"),\\n \\"base\\": str(out_dir / \\"base\\"),\\n \\"head\\": str(out_dir / \\"head\\"),\\n },\\n }\\n (out_dir / \\"sample-result.json\\").write_text(json.dumps(evidence, indent=2, sort_keys=True) + \\"\\\\n\\")\\n exit_code = 2 if any(run.get(\\"execution_error\\") for run in (base, head, oracle)) else 0\\n if exit_code == 0 and verdict_status != fixture[\\"expected_qualitymax_policy\\"]:\\n exit_code = 1\\n return evidence, exit_code\\n\\n\\ndef _walkthrough_completed(evidence: dict[str, Any]) -> bool:\\n \\"\\"\\"An abstention alone does not establish the advertised fixture outcome.\\"\\"\\"\\n runs = evidence[\\"runs\\"]\\n expected = {\\n \\"base_selected\\": [\\"fail\\"],\\n \\"head_selected\\": [\\"fail\\"] if evidence[\\"fixture\\"][\\"id\\"] == \\"broken\\" else [\\"pass\\"],\\n \\"head_oracle\\": [\\"fail\\"] * 4 + [\\"pass\\"] * 4 if evidence[\\"fixture\\"][\\"id\\"] == \\"broken\\" else [\\"pass\\"] * 8,\\n }\\n return all(\\n not runs[name].get(\\"execution_error\\")\\n and runs[name][\\"exit_code\\"] == (1 if \\"fail\\" in outcomes else 0)\\n and sorted(case[\\"outcome\\"] for case in runs[name][\\"cases\\"]) == outcomes\\n for name, outcomes in expected.items()\\n ) and [(case[\\"classname\\"], case[\\"name\\"]) for case in runs[\\"base_selected\\"][\\"cases\\"]] == [\\n (case[\\"classname\\"], case[\\"name\\"]) for case in runs[\\"head_selected\\"][\\"cases\\"]\\n ]\\n\\n\\ndef _print_walkthrough_result(label: str, evidence: dict[str, Any]) -> None:\\n fixture = evidence[\\"fixture\\"]\\n runs = evidence[\\"runs\\"]\\n out_dir = Path(evidence[\\"evidence_files\\"][\\"json\\"]).parent\\n if any(run.get(\\"execution_error\\") for run in runs.values()):\\n print(f\\"{label}: execution stopped early; inspect {out_dir / \'sample-result.json\'}.\\")\\n return\\n base_failed = runs[\\"base_selected\\"][\\"exit_code\\"] == 1 and any(\\n case[\\"outcome\\"] == \\"fail\\" for case in runs[\\"base_selected\\"][\\"cases\\"]\\n )\\n head_passed = (\\n runs[\\"head_selected\\"][\\"exit_code\\"] == 0\\n and runs[\\"head_selected\\"][\\"cases\\"]\\n and all(case[\\"outcome\\"] == \\"pass\\" for case in runs[\\"head_selected\\"][\\"cases\\"])\\n )\\n head_failed = runs[\\"head_selected\\"][\\"exit_code\\"] == 1 and any(\\n case[\\"outcome\\"] == \\"fail\\" for case in runs[\\"head_selected\\"][\\"cases\\"]\\n )\\n if evidence[\\"verdict\\"][\\"status\\"] == \\"pass\\" and base_failed and head_passed:\\n print(f\\"{label}: the same unchanged test failed before the repair and passed after it; this repair succeeded.\\")\\n elif head_failed:\\n print(f\\"{label}: the same unchanged test still fails after the proposed change; needs human review.\\")\\n else:\\n print(f\\"{label}: the run did not establish a repair; inspect {out_dir / \'sample-result.json\'}.\\")\\n print(f\\" Original source: {out_dir / \'base\' / \'invoice.py\'}\\")\\n print(f\\" Proposed source: {out_dir / \'head\' / \'invoice.py\'}\\")\\n print(f\\" Unchanged test: {out_dir / \'base\' / fixture[\'selected_test\'].split(\'::\', 1)[0]}\\")\\n print(f\\" Receipt: {out_dir / \'sample-result.json\'}\\")\\n\\n\\ndef main() -> int:\\n parser = build_parser()\\n args = parser.parse_args()\\n\\n if sys.version_info[:2] not in ((3, 11), (3, 12)) or os.name != \\"posix\\":\\n parser.error(\\"supported environment: CPython 3.11 or 3.12 on macOS or Linux, with git available\\")\\n git = shutil.which(\\"git\\")\\n if git is None:\\n parser.error(\\"git is missing; install Git and make it available on PATH\\")\\n git = str(Path(git).absolute())\\n if args.bootstrap:\\n try:\\n _load_manifest()\\n return _bootstrap(git)\\n except (OSError, subprocess.SubprocessError):\\n parser.exit(2, \\"sample setup failed; verify Python venv support and public PyPI connectivity\\\\n\\")\\n\\n manifest = _load_manifest()\\n if importlib.util.find_spec(\\"pytest\\") is None:\\n parser.error(\\"pytest is missing; use --bootstrap for isolated pinned dependencies\\")\\n if args.fixture:\\n out_dir = (\\n Path(args.out).resolve() if args.out else (Path.cwd() / \\"artifacts\\" / \\"verified-patch-sample\\" / uuid.uuid4().hex)\\n )\\n evidence, exit_code = _run_fixture(manifest, args.fixture, out_dir, git)\\n print(\\n json.dumps(\\n {\\n \\"fixture\\": args.fixture,\\n \\"status\\": evidence[\\"verdict\\"][\\"status\\"],\\n \\"evidence\\": str(out_dir / \\"sample-result.json\\"),\\n },\\n sort_keys=True,\\n )\\n )\\n return exit_code\\n\\n parent_dir = (\\n Path(args.out).resolve() if args.out else (Path.cwd() / \\"artifacts\\" / \\"verified-patch-sample\\" / uuid.uuid4().hex)\\n )\\n parent_dir.mkdir(parents=True, exist_ok=False)\\n print(\\"Verified Patch Sample walkthrough\\")\\n print(\\"Problem: a $50 order is charged $55 because free shipping starts above $50.\\")\\n print(\\"\\\\n1 of 2 \\u2014 Rejected proposed patch\\")\\n broken, broken_exit = _run_fixture(manifest, \\"broken\\", parent_dir / \\"broken\\", git)\\n _print_walkthrough_result(\\"Rejected proposed patch\\", broken)\\n print(\\"\\\\n2 of 2 \\u2014 Repair candidate\\")\\n repair, repair_exit = _run_fixture(manifest, \\"repair\\", parent_dir / \\"repair\\", git)\\n _print_walkthrough_result(\\"Repair candidate\\", repair)\\n print(f\\"\\\\nWalkthrough evidence: {parent_dir}\\")\\n print(\\"This is a fixed, unsigned example. Passing the selected test does not prove whole-patch correctness.\\")\\n if not all(_walkthrough_completed(evidence) for evidence in (broken, repair)):\\n print(\\"Walkthrough incomplete: the expected test outcomes were not all observed. Inspect both receipts.\\")\\n return max(1, broken_exit, repair_exit)\\n return max(broken_exit, repair_exit)\\n\\n\\nif __name__ == \\"__main__\\":\\n raise SystemExit(main())\\n"}')
if __name__ == '__main__':
with tempfile.TemporaryDirectory(prefix='qmax-public-sample-') as temporary:
root = Path(temporary)
for relative, content in FILES.items():
path = root / relative
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(content)
result = subprocess.run([sys.executable, str(root / 'scripts/verified_patch_no_signup_sample.py'), *sys.argv[1:]], check=False, timeout=540)
sys.exit(result.returncode)

No-Signup Sample: Fresh Reproduction Record

Observed on 2026-10-04 for QUA-1993. This maintainer run is synthetic fixture validation, not a measured benchmark, production verification, or a signed correctness claim. The two real external first-run sessions remain outstanding; this record does not satisfy that criterion.

Public artifact and exact command

The application repository is private. The public standalone artifact requires no repository access or signup. Download and inspect verified_patch_sample.py, then run:

python3.11 verified_patch_sample.py --bootstrap

Supported: CPython 3.11 or 3.12 with functioning venv support, macOS or Linux, Git, and public PyPI connectivity. Observed environment: Darwin arm64, CPython 3.11.8, pytest 8.3.5. Dependencies were installed into a new temporary environment, not the application environment. Python 3.12 users substitute python3.12 in the command; this record claims no successful Python 3.12 or Linux execution.

The immutable revision was downloaded through an unauthenticated curl -q request into an otherwise empty directory containing no application files, .env, or virtualenv. The downloaded bytes matched the locally generated bundle. The literal command above started at 2026-10-04 12:30:30 UTC and completed with exit 0 in 5.752 seconds, including bootstrap. This is one observed duration, not a performance guarantee.

Input SHA-256
Standalone public artifact 51e45219ba572cb0bd59ee00a0bd3b88118555a34cc9710a93c9e3290dbbce78
Embedded runner 17c649ebca991b82125fc21c411e929bb84a4c65f27e6fab662840b741e18e1d
Frozen v1 manifest 6387aca0791539d9d9fde91bf9c09ae0b9fb7705b8a6aed3bc01d5c5f8054e7f
Broken candidate patch 213ef03e849885fbfd68157de8e7aa360691ddbe91de2ae18978e6a6a02b0c0d
Repair candidate patch 50e15e51504948d6edc18de9e8835e9b86815b5b7689c4b0b51ca35ccae7efe1

Observed evidence

The example shop should charge $50 for a $50 order because delivery is free at that amount. The original source instead charges $55. Each candidate starts from its own copy of that same original source and unchanged test.

Candidate Execution Exit Actual outcomes
Rejected patch (> 10000) Original selected boundary test 1 1 failed
Rejected patch Patched selected boundary test 1 1 failed
Rejected patch Patched independent contract oracle 1 4 passed, 4 failed
Repair (>= 5000) Original selected boundary test 1 1 failed
Repair Patched selected boundary test 0 1 passed
Repair Patched independent contract oracle 0 8 passed

The rejected patch receipt reports needs_human; the repair receipt reports pass. The default walkthrough exits 0 only when both expected sets of actual test outcomes are observed. Collection errors, zero tests, or skipped checks do not complete the walkthrough. Explicit --fixture mode retains its single-fixture JSON output and existing exit semantics.

Evidence remained under artifacts/verified-patch-sample/2b5284d807ba4462b4fc55f5ff48137e/, in separate broken/ and repair/ directories. Each contains sample-result.json, three JUnit reports, candidate.patch, and exact base/ and head/ source and tests. Both original sources match the frozen fixture; the selected test bytes are unchanged in every source snapshot.

Both receipts are unsigned. Passing the selected test establishes that selected assertion's recorded result, not whole-patch correctness. The independent oracle is separate supporting fixture evidence. A signature, if supplied by another system, would establish provenance rather than correctness.

Regression coverage

scripts/conductor-python -m pytest tests/unit/test_package_verified_patch_sample.py tests/unit/test_verified_patch_no_signup_sample.py tests/unit/test_verified_patch_sample_surface.py tests/unit/test_verified_patch_benchmark_fixtures.py tests/unit/test_verify_patch_mcp_tools.py -q

86 tests passed across the focused and shared suites, with existing dependency deprecation warnings. Coverage includes unchanged tests and independent source copies, truthful completion with failed/empty/skipped checks, explicit-fixture compatibility, exact display/download source and patches, fixture integrity, safe bundle packaging, bootstrap isolation, and persistent receipts.

No external-user success, paid benchmark attempts, cloud verifier, production deployment, or Bugsink clearance is claimed by this record. Maintainer CI disposition and merge provenance belong in the linked PR and Linear completion evidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment