Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions infra/tests/test_connection_sharing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
4 changes: 3 additions & 1 deletion infra/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down
6 changes: 4 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading