From c1157659ea91dd9dd2c9e618b5913c42be8c5681 Mon Sep 17 00:00:00 2001 From: Sushant Gautam Date: Fri, 2 Oct 2026 07:33:29 +0200 Subject: [PATCH 1/2] fix(experiments): hide disabled connections from the model picker The New Experiment Models list was built from visible_connections_for(), which filters only by sharing rules and ignored the ModelConnection.enabled flag. A connection disabled on /connections/ still appeared (and its models could be picked), contradicting the 'disabled' badge there. Filter disabled connections out of the picker so their models can't be selected for new runs. --- infra/tests/test_connection_sharing.py | 22 ++++++++++++++++++++++ infra/ui.py | 4 +++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/infra/tests/test_connection_sharing.py b/infra/tests/test_connection_sharing.py index 988238d5..423ae04f 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 a4c45917..47a2ddae 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 From 03cb080b920ad5698862846a786a1da5c9a642b3 Mon Sep 17 00:00:00 2001 From: Sushant Gautam Date: Fri, 2 Oct 2026 07:33:31 +0200 Subject: [PATCH 2/2] chore(deps): bump simpleaudit engine to 0.3.0 The local editable ../SimpleAudit checkout is at 0.3.0 (matching the latest release), but Studio pinned ==0.2.3, causing a version mismatch. Bump the pin and re-lock. --- pyproject.toml | 2 +- uv.lock | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index eb37318e..8e452bd8 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 20370dc9..78d7b723 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" },