# Hand mutants over the lines this card added after the Tier-M sweep (card t_31b3943a).
# Worktree at d03b410 + this card's src+test files; each mutant is applied, the new gate must fail, then reverted.
== M1: suites._record_backend_selection drops the passed-over note (if passed_over -> if False)
F                                                                        [100%]
=================================== FAILURES ===================================
__ test_an_auto_run_records_the_bundle_it_selected_and_the_one_it_passed_over __

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-11271/test_an_auto_run_records_the_b0')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f32399339d0>

    def test_an_auto_run_records_the_bundle_it_selected_and_the_one_it_passed_over(
            tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch) -> None:
        """A box with a CPU *and* an accelerator bundle: the report must say which one ran.
    
        Reported from the operator's Vulkan host (card t_31b3943a, coordinator note): `bench --suite
        latency --backend auto` without `--gpu-layers` measured CPU only, and neither the report nor
        the rendered table said a Vulkan bundle had been left unused. `auto` resolves to the locally
        installed bundles in `DEFAULT_BACKENDS` order (`cpu` first) and one run measures the first of
        them, so a reader must be able to tell "no accelerator here" from "not selected".
        """
        from tests.fake_engine import BenchModel
    
        bundles = {"cpu": tmp_path / "b11026-linux-x64-cpu",
                   "vulkan": tmp_path / "b11026-linux-x64-vulkan"}
        monkeypatch.setattr(harness, "backend_runtimes", lambda **kwargs: dict(bundles))
        config = harness.BenchConfig(suite="latency", model_path="/tmp/fake.gguf", runs=1,
                                    prefill_sizes=(64,))
    
        report = suites.run_suite(config, factory=lambda spec: BenchModel(spec))
    
        selection = report["backend_selection"]
        assert selection["requested"] == "auto"
        assert selection["selected"] == "cpu"                       # DEFAULT_BACKENDS order
        assert selection["available"] == ["cpu", "vulkan"]
        assert selection["missing"] == {}                           # nothing was unavailable here
        hint = [note for note in report["notes"] if "--backend vulkan" in note]
>       assert hint, report["notes"]
E       AssertionError: ["`waves` counts the decode batches a decision takes after the prefill (here: 1 suffix decode per question group + 1 p...efill_reused: true` once the prefix state cache is warm, which is why the decision tables isolate the question phase.']
E       assert []

tests/test_bench_placement.py:270: AssertionError
=========================== short test summary info ============================
FAILED tests/test_bench_placement.py::test_an_auto_run_records_the_bundle_it_selected_and_the_one_it_passed_over
1 failed, 12 deselected in 0.82s
M1_EXIT=1
== M2: harness.render_report prints the selection line for a single local bundle (> 1 -> > 0)
F                                                                        [100%]
=================================== FAILURES ===================================
__________ test_a_forced_backend_is_reported_as_such_not_as_a_choice ___________

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-11272/test_a_forced_backend_is_repor0')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fe8099df190>

    def test_a_forced_backend_is_reported_as_such_not_as_a_choice(
            tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch) -> None:
        """`--backend vulkan` is not a selection among bundles: the record must not blame `auto`."""
        from tests.fake_engine import BenchModel
    
        bundles = {"cpu": tmp_path / "b11026-linux-x64-cpu",
                   "vulkan": tmp_path / "b11026-linux-x64-vulkan"}
        monkeypatch.setattr(harness, "backend_runtimes", lambda **kwargs: dict(bundles))
        config = harness.BenchConfig(suite="quality", model_path="/tmp/fake.gguf", backend="vulkan",
                                    items=2)
    
        report = suites.run_suite(config, factory=lambda spec: BenchModel(spec))
    
        selection = report["backend_selection"]
        assert selection["requested"] == "vulkan"
        assert selection["selected"] == "vulkan"
        assert selection["available"] == ["vulkan"]                 # only what the run asked for
        assert not [note for note in report["notes"] if "--backend auto" in note]
>       assert "- backend selection" not in harness.render_report(report)   # a forced run is no choice
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AssertionError: assert '- backend selection' not in '### quality...PEC S-11).\n'
E         
E         '- backend selection' is contained here:
E           2 --json`
E           - backend selection: vulkan of the local bundles (vulkan) — one suite run measures one backend
E         ? +++++++++++++++++++
E           
E           **exact-match agreement**...
E         
E         ...Full output truncated (7 lines hidden), use '-vv' to show

tests/test_bench_placement.py:294: AssertionError
=========================== short test summary info ============================
FAILED tests/test_bench_placement.py::test_a_forced_backend_is_reported_as_such_not_as_a_choice
1 failed, 12 deselected in 0.35s
M2_EXIT=1
== reverted: both mutants removed, the same 13 gates must pass again
.............                                                            [100%]
13 passed in 0.59s
REVERTED_EXIT=0
