From aec8ac90ec6b12b32fbe28f5b417d1d14da5e501 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Fri, 14 Aug 2026 23:54:00 -0700 Subject: [PATCH] [eric] test: the server-owned refusal asserts the value did not change, so it stops depending on whose laptop runs it --- backend/tests/test_settings_meta_endpoint.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/tests/test_settings_meta_endpoint.py b/backend/tests/test_settings_meta_endpoint.py index e8d7143c..5da646dc 100644 --- a/backend/tests/test_settings_meta_endpoint.py +++ b/backend/tests/test_settings_meta_endpoint.py @@ -103,9 +103,17 @@ def test_benign_write_applies(client, reset_settings): def test_unknown_and_server_owned_fields_are_refused(client, reset_settings): + from backend.apps.settings.settings import load_settings + + # Attempt a mode the machine is NOT already on, and assert the value is UNCHANGED. The old + # version wrote "openswarm-pro" and asserted the result was not "openswarm-pro", which fails on + # any developer already on Pro even though the refusal worked perfectly: it made the suite depend + # on whose laptop it ran on, and "did not change" is the property that was meant all along. + before = load_settings().connection_mode + attempt = "own_key" if before == "openswarm-pro" else "openswarm-pro" r = client.post("/api/settings-meta/write", json={"changes": { "not_a_real_field": 1, - "connection_mode": "openswarm-pro", + "connection_mode": attempt, "openswarm_bearer_token": "forged", }}) assert r.status_code == 200, r.text @@ -114,8 +122,7 @@ def test_unknown_and_server_owned_fields_are_refused(client, reset_settings): assert out["connection_mode"]["status"] == "refused" assert out["openswarm_bearer_token"]["status"] == "refused" # And the server-owned field is genuinely untouched on disk. - from backend.apps.settings.settings import load_settings - assert load_settings().connection_mode != "openswarm-pro" + assert load_settings().connection_mode == before def test_cannot_suicide_but_disconnects_others(client, reset_settings, session_on_anthropic_key):