From a5a95320df10820a2f0231ca1f7836d4f814d7ee Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Mon, 29 Jun 2026 00:46:37 -0400 Subject: [PATCH] fix(test): disable switch explicitly now that auto-apply defaults ON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test_auto_apply_disabled_blocks_real_run assumed head_auto_apply_enabled defaulted False; it now defaults True (opt-out), so a real sweep is accepted (202). Set the switch off in the test to exercise the disabled→400 path. (run 1629) Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Ttrj5P7upUTueSfoJcxEqa --- tests/test_head_auto_apply.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_head_auto_apply.py b/tests/test_head_auto_apply.py index 4e835aa..c289ca0 100644 --- a/tests/test_head_auto_apply.py +++ b/tests/test_head_auto_apply.py @@ -117,7 +117,11 @@ def test_sweep_skips_ungraduated_head(db_sync): @pytest.mark.asyncio async def test_auto_apply_disabled_blocks_real_run(client, db): - # head_auto_apply_enabled defaults False → a real sweep is refused (400). + # With the master switch OFF, a real sweep is refused (400). (It defaults ON + # now — opt-out — so the test disables it explicitly to exercise this path.) + s = (await db.execute(select(MLSettings).where(MLSettings.id == 1))).scalar_one() + s.head_auto_apply_enabled = False + await db.commit() resp = await client.post("/api/heads/auto-apply", json={"dry_run": False}) assert resp.status_code == 400 assert (await resp.get_json())["error"] == "auto_apply_disabled"