diff --git a/infra/tests/test_connection_sharing.py b/infra/tests/test_connection_sharing.py index 988238d..423ae04 100644 --- a/infra/tests/test_connection_sharing.py +++ b/infra/tests/test_connection_sharing.py @@ -243,6 +243,28 @@ def test_private_connection_not_in_picker(self): self.assertNotContains(page, "Private Conn") self.assertNotContains(page, f'value="{private_model.id}"') + def test_enabled_connection_still_in_picker(self): + # Guards against over-filtering: a normal enabled connection is offered. + page = self.client.get("/experiments/new/") + self.assertContains(page, "Shared GPT") + self.assertContains(page, f'value="{self.model.id}"') + + def test_disabled_connection_hidden_from_picker(self): + # A disabled connection's models can't be picked for new runs. + self.conn.enabled = False + self.conn.save() + page = self.client.get("/experiments/new/") + self.assertNotContains(page, "Shared GPT") + self.assertNotContains(page, f'value="{self.model.id}"') + + def test_disabled_shared_connection_hidden_from_picker(self): + # A disabled *shared* connection is also hidden from the consumer workspace. + self.conn.enabled = False + self.conn.save() + page = self.client.get("/experiments/new/") + self.assertNotContains(page, "Shared GPT") + self.assertNotContains(page, f'value="{self.model.id}"') + class PingSharedConnectionTests(TestCase): """Pinging a shared connection is allowed for consumers; foreign ones 404.""" diff --git a/infra/ui.py b/infra/ui.py index a4c4591..47a2dda 100644 --- a/infra/ui.py +++ b/infra/ui.py @@ -717,7 +717,9 @@ def get_context_data(self, **kw): # Connections the picker offers: this workspace's own plus any shared # into it (public / admin-shared / explicitly shared). Each carries a # sharing label so users can tell at a glance where a model comes from. - connections = visible_connections_for(self.request.user, p) + # Disabled connections are hidden entirely — their models can't be + # picked for new runs (the /connections/ page still lists them, badged). + connections = [c for c in visible_connections_for(self.request.user, p) if c.enabled] for conn in connections: conn.share_label = connection_share_label(conn) conn.is_shared = conn.project_id != p.id diff --git a/pyproject.toml b/pyproject.toml index eb37318..8e452bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ dependencies = [ # package metadata, so the engine must be a registry dependency. 0.2.0 is # the first release containing run_scenario_reps (n_repetitions support); # 0.2.1 adds the native on_turn per-phase progress callback. - "simpleaudit==0.2.3", + "simpleaudit==0.3.0", "cronsim==2.7", "psutil>=7.2.2", ] diff --git a/uv.lock b/uv.lock index 20370dc..78d7b72 100644 --- a/uv.lock +++ b/uv.lock @@ -2384,7 +2384,7 @@ wheels = [ [[package]] name = "simpleaudit" -version = "0.2.3" +version = "0.3.0" source = { editable = "../SimpleAudit" } dependencies = [ { name = "any-llm-sdk" }, @@ -2402,9 +2402,11 @@ requires-dist = [ { name = "grpcio", marker = "extra == 'tracing'", specifier = ">=1.60" }, { name = "matplotlib", marker = "extra == 'plot'", specifier = ">=3.5.0" }, { name = "opentelemetry-proto", marker = "extra == 'tracing'", specifier = ">=1.20" }, - { name = "pytest", marker = "extra == 'dev'", specifier = ">=7.0.0" }, + { name = "pytest", marker = "extra == 'dev'", specifier = ">=8,<9" }, { name = "pytest-asyncio", marker = "extra == 'dev'", specifier = ">=0.21.0" }, { name = "pytest-cov", marker = "extra == 'dev'", specifier = ">=4.0.0" }, + { name = "pytest-testmon", marker = "extra == 'dev'", specifier = ">=2,<3" }, + { name = "pytest-xdist", marker = "extra == 'dev'", specifier = ">=3.6,<3.8" }, { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.1.0" }, { name = "simpleaudit", extras = ["plot", "visualize", "dev"], marker = "extra == 'all'" }, { name = "tqdm", specifier = ">=4.66.0" },