Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Remove v1_enabled flag from resolver integrations (#14145)

Tim O'Farrell6464eaed3c0f
diff --git a/enterprise/integrations/github/github_view.py b/enterprise/integrations/github/github_view.py
index 656c26586a..d481be8a8a 100644
--- a/enterprise/integrations/github/github_view.py
+++ b/enterprise/integrations/github/github_view.py
@@ -14,11 +14,9 @@ from integrations.resolver_org_router import resolve_org_for_repo
from integrations.types import ResolverViewInterface, UserData
from integrations.utils import (
ENABLE_PROACTIVE_CONVERSATION_STARTERS,
- ENABLE_V1_GITHUB_RESOLVER,
HOST,
HOST_URL,
get_oh_labels,
- get_user_v1_enabled_setting,
has_exact_mention,
)
from jinja2 import Environment
@@ -27,7 +25,6 @@ from server.auth.token_manager import TokenManager
from server.config import get_config
from storage.org_store import OrgStore
from storage.proactive_conversation_store import ProactiveConversationStore
-from storage.saas_conversation_store import SaasConversationStore
from storage.saas_secrets_store import SaasSecretsStore
from openhands.agent_server.models import SendMessageRequest
@@ -49,15 +46,10 @@ from openhands.storage.data_models.conversation_metadata import (
ConversationTrigger,
)
from openhands.utils.async_utils import call_sync_from_async
-from openhands.utils.conversation_summary import get_default_conversation_title
OH_LABEL, INLINE_OH_LABEL = get_oh_labels(HOST)
-async def is_v1_enabled_for_github_resolver(user_id: str) -> bool:
- return await get_user_v1_enabled_setting(user_id) and ENABLE_V1_GITHUB_RESOLVER
-
-
async def get_user_proactive_conversation_setting(user_id: str | None) -> bool:
"""Get the user's proactive conversation setting.
@@ -105,7 +97,6 @@ class GithubIssue(ResolverViewInterface):
title: str
description: str
previous_comments: list[Comment]
- v1_enabled: bool
def _get_branch_name(self) -> str | None:
return getattr(self, 'branch_name', None)
@@ -153,10 +144,6 @@ class GithubIssue(ResolverViewInterface):
return user_secrets.custom_secrets if user_secrets else None
async def initialize_new_conversation(self) -> ConversationMetadata:
- self.v1_enabled = await is_v1_enabled_for_github_resolver(
- self.user_info.keycloak_user_id
- )
-
# Resolve target org based on claimed git organizations
self.resolved_org_id = await resolve_org_for_repo(
provider='github',
@@ -164,42 +151,13 @@ class GithubIssue(ResolverViewInterface):
keycloak_user_id=self.user_info.keycloak_user_id,
)
- logger.info(
- f'[GitHub V1]: User flag found for {self.user_info.keycloak_user_id} is {self.v1_enabled}'
- )
- if self.v1_enabled:
- # Create dummy conversationm metadata
- # Don't save to conversation store
- # V1 conversations are stored in a separate table
- self.conversation_id = uuid4().hex
- return ConversationMetadata(
- conversation_id=self.conversation_id,
- selected_repository=self.full_repo_name,
- )
-
- # Create the conversation store with resolver org routing
- # (bypasses initialize_conversation to avoid threading enterprise-only
- # resolver_org_id through the generic OSS interface)
- store = await SaasConversationStore.get_resolver_instance(
- get_config(),
- self.user_info.keycloak_user_id,
- self.resolved_org_id,
- )
-
- conversation_id = uuid4().hex
- conversation_metadata = ConversationMetadata(
- trigger=ConversationTrigger.RESOLVER,
- conversation_id=conversation_id,
- title=get_default_conversation_title(conversation_id),
- user_id=self.user_info.keycloak_user_id,
+ # All conversations use V1 app conversation service
+ # V1 conversations are stored in a separate table, not in SaasConversationStore
+ self.conversation_id = uuid4().hex
+ return ConversationMetadata(
+ conversation_id=self.conversation_id,
selected_repository=self.full_repo_name,
- selected_branch=self._get_branch_name(),
- git_provider=ProviderType.GITHUB,
)
- await store.save_metadata(conversation_metadata)
-
- self.conversation_id = conversation_id
- return conversation_metadata
async def create_new_conversation(
self,
@@ -813,7 +771,6 @@ class GithubFactory:
title='',
description='',
previous_comments=[],
- v1_enabled=False,
)
elif GithubFactory.is_issue_comment(message):
@@ -839,7 +796,6 @@ class GithubFactory:
title='',
description='',
previous_comments=[],
- v1_enabled=False,
)
elif GithubFactory.is_pr_comment(message):
@@ -881,7 +837,6 @@ class GithubFactory:
title='',
description='',
previous_comments=[],
- v1_enabled=False,
)
elif GithubFactory.is_inline_pr_comment(message):
@@ -915,7 +870,6 @@ class GithubFactory:
title='',
description='',
previous_comments=[],
- v1_enabled=False,
)
else:
diff --git a/enterprise/integrations/gitlab/gitlab_view.py b/enterprise/integrations/gitlab/gitlab_view.py
index b1c6d79443..1d0fc32f57 100644
--- a/enterprise/integrations/gitlab/gitlab_view.py
+++ b/enterprise/integrations/gitlab/gitlab_view.py
@@ -6,16 +6,13 @@ from integrations.resolver_context import ResolverUserContext
from integrations.resolver_org_router import resolve_org_for_repo
from integrations.types import ResolverViewInterface, UserData
from integrations.utils import (
- ENABLE_V1_GITLAB_RESOLVER,
HOST,
get_oh_labels,
- get_user_v1_enabled_setting,
has_exact_mention,
)
from jinja2 import Environment
from server.auth.token_manager import TokenManager
from server.config import get_config
-from storage.saas_conversation_store import SaasConversationStore
from storage.saas_secrets_store import SaasSecretsStore
from openhands.agent_server.models import SendMessageRequest
@@ -36,17 +33,12 @@ from openhands.storage.data_models.conversation_metadata import (
ConversationMetadata,
ConversationTrigger,
)
-from openhands.utils.conversation_summary import get_default_conversation_title
OH_LABEL, INLINE_OH_LABEL = get_oh_labels(HOST)
CONFIDENTIAL_NOTE = 'confidential_note'
NOTE_TYPES = ['note', CONFIDENTIAL_NOTE]
-async def is_v1_enabled_for_gitlab_resolver(user_id: str) -> bool:
- return await get_user_v1_enabled_setting(user_id) and ENABLE_V1_GITLAB_RESOLVER
-
-
# =================================================
# SECTION: Factory to create appriorate Gitlab view
# =================================================
@@ -68,7 +60,6 @@ class GitlabIssue(ResolverViewInterface):
description: str
previous_comments: list[Comment]
is_mr: bool
- v1_enabled: bool
def _get_branch_name(self) -> str | None:
return getattr(self, 'branch_name', None)
@@ -115,9 +106,6 @@ class GitlabIssue(ResolverViewInterface):
return user_secrets.custom_secrets if user_secrets else None
async def initialize_new_conversation(self) -> ConversationMetadata:
- # v1_enabled is already set at construction time in the factory method
- # This is the source of truth for the conversation type
-
# Resolve target org based on claimed git organizations
self.resolved_org_id = await resolve_org_for_repo(
provider='gitlab',
@@ -125,39 +113,13 @@ class GitlabIssue(ResolverViewInterface):
keycloak_user_id=self.user_info.keycloak_user_id,
)
- if self.v1_enabled:
- # Create dummy conversation metadata
- # Don't save to conversation store
- # V1 conversations are stored in a separate table
- self.conversation_id = uuid4().hex
- return ConversationMetadata(
- conversation_id=self.conversation_id,
- selected_repository=self.full_repo_name,
- )
-
- # Create the conversation store with resolver org routing
- # (bypasses initialize_conversation to avoid threading enterprise-only
- # resolver_org_id through the generic OSS interface)
- store = await SaasConversationStore.get_resolver_instance(
- get_config(),
- self.user_info.keycloak_user_id,
- self.resolved_org_id,
- )
-
- conversation_id = uuid4().hex
- conversation_metadata = ConversationMetadata(
- trigger=ConversationTrigger.RESOLVER,
- conversation_id=conversation_id,
- title=get_default_conversation_title(conversation_id),
- user_id=self.user_info.keycloak_user_id,
+ # All conversations use V1 app conversation service
+ # V1 conversations are stored in a separate table, not in SaasConversationStore
+ self.conversation_id = uuid4().hex
+ return ConversationMetadata(
+ conversation_id=self.conversation_id,
selected_repository=self.full_repo_name,
- selected_branch=self._get_branch_name(),
- git_provider=ProviderType.GITLAB,
)
- await store.save_metadata(conversation_metadata)
-
- self.conversation_id = conversation_id
- return conversation_metadata
async def create_new_conversation(
self,
@@ -450,16 +412,6 @@ class GitlabFactory:
user_id=user_id, username=username, keycloak_user_id=keycloak_user_id
)
- # Check v1_enabled at construction time - this is the source of truth
- v1_enabled = (
- await is_v1_enabled_for_gitlab_resolver(keycloak_user_id)
- if keycloak_user_id
- else False
- )
- logger.info(
- f'[GitLab V1]: User flag found for {keycloak_user_id} is {v1_enabled}'
- )
-
if GitlabFactory.is_labeled_issue(message):
issue_iid = payload['object_attributes']['iid']
@@ -481,7 +433,6 @@ class GitlabFactory:
description='',
previous_comments=[],
is_mr=False,
- v1_enabled=v1_enabled,
)
elif GitlabFactory.is_issue_comment(message):
@@ -512,7 +463,6 @@ class GitlabFactory:
description='',
previous_comments=[],
is_mr=False,
- v1_enabled=v1_enabled,
)
elif GitlabFactory.is_mr_comment(message):
@@ -545,7 +495,6 @@ class GitlabFactory:
description='',
previous_comments=[],
is_mr=True,
- v1_enabled=v1_enabled,
)
elif GitlabFactory.is_mr_comment(message, inline=True):
@@ -586,7 +535,6 @@ class GitlabFactory:
description='',
previous_comments=[],
is_mr=True,
- v1_enabled=v1_enabled,
)
raise ValueError(f'Unhandled GitLab webhook event: {message}')
diff --git a/enterprise/integrations/slack/slack_types.py b/enterprise/integrations/slack/slack_types.py
index b2d4faedf6..94d247c33b 100644
--- a/enterprise/integrations/slack/slack_types.py
+++ b/enterprise/integrations/slack/slack_types.py
@@ -112,7 +112,6 @@ class SlackViewInterface(SlackMessageView, SummaryExtractionTracker, ABC):
should_extract: bool
send_summary_instruction: bool
conversation_id: str
- v1_enabled: bool
@abstractmethod
async def _get_instructions(self, jinja_env: Environment) -> tuple[str, str]:
diff --git a/enterprise/integrations/slack/slack_view.py b/enterprise/integrations/slack/slack_view.py
index a33f4da75e..c5dedfad4f 100644
--- a/enterprise/integrations/slack/slack_view.py
+++ b/enterprise/integrations/slack/slack_view.py
@@ -13,8 +13,6 @@ from integrations.slack.slack_types import (
from integrations.slack.slack_v1_callback_processor import SlackV1CallbackProcessor
from integrations.utils import (
CONVERSATION_URL,
- ENABLE_V1_SLACK_RESOLVER,
- get_user_v1_enabled_setting,
)
from jinja2 import Environment
from slack_sdk import WebClient
@@ -51,10 +49,6 @@ slack_conversation_store = SlackConversationStore.get_instance()
slack_team_store = SlackTeamStore.get_instance()
-async def is_v1_enabled_for_slack_resolver(user_id: str) -> bool:
- return await get_user_v1_enabled_setting(user_id) and ENABLE_V1_SLACK_RESOLVER
-
-
@dataclass
class SlackNewConversationView(SlackViewInterface):
bot_access_token: str
@@ -70,7 +64,6 @@ class SlackNewConversationView(SlackViewInterface):
send_summary_instruction: bool
conversation_id: str
team_id: str
- v1_enabled: bool
def _get_initial_prompt(self, text: str, blocks: list[dict]):
bot_id = self._get_bot_id(blocks)
@@ -149,7 +142,7 @@ class SlackNewConversationView(SlackViewInterface):
'Attempting to start conversation without confirming selected repo from user'
)
- async def save_slack_convo(self, v1_enabled: bool = False):
+ async def save_slack_convo(self):
if self.slack_to_openhands_user:
user_info: SlackUser = self.slack_to_openhands_user
@@ -161,7 +154,6 @@ class SlackNewConversationView(SlackViewInterface):
'keycloak_user_id': user_info.keycloak_user_id,
'org_id': user_info.org_id,
'parent_id': self.thread_ts or self.message_ts,
- 'v1_enabled': v1_enabled,
},
)
slack_conversation = SlackConversation(
@@ -171,7 +163,7 @@ class SlackNewConversationView(SlackViewInterface):
org_id=user_info.org_id,
parent_id=self.thread_ts
or self.message_ts, # conversations can start in a thread reply as well; we should always references the parent's (root level msg's) message ID
- v1_enabled=v1_enabled,
+ v1_enabled=True, # All conversations are V1
)
await slack_conversation_store.create_slack_conversation(slack_conversation)
@@ -268,7 +260,7 @@ class SlackNewConversationView(SlackViewInterface):
)
logger.info(f'[Slack V1]: Created new conversation: {self.conversation_id}')
- await self.save_slack_convo(v1_enabled=True)
+ await self.save_slack_convo()
def get_response_msg(self) -> str:
user_info: SlackUser = self.slack_to_openhands_user
@@ -516,7 +508,6 @@ class SlackFactory:
conversation_id=conversation.conversation_id,
slack_conversation=conversation,
team_id=team_id,
- v1_enabled=False,
)
elif SlackFactory.did_user_select_repo_from_form(message):
@@ -534,7 +525,6 @@ class SlackFactory:
send_summary_instruction=True,
conversation_id='',
team_id=team_id,
- v1_enabled=False,
)
else:
@@ -552,7 +542,6 @@ class SlackFactory:
send_summary_instruction=True,
conversation_id='',
team_id=team_id,
- v1_enabled=False,
)
diff --git a/enterprise/integrations/utils.py b/enterprise/integrations/utils.py
index 970bc14288..b3c5302dc0 100644
--- a/enterprise/integrations/utils.py
+++ b/enterprise/integrations/utils.py
@@ -6,7 +6,6 @@ import re
from jinja2 import Environment, FileSystemLoader
from server.constants import WEB_HOST
-from storage.org_store import OrgStore
from openhands.core.logger import openhands_logger as logger
from openhands.core.schema.agent import AgentState
@@ -82,20 +81,6 @@ ENABLE_SOLVABILITY_ANALYSIS = (
os.getenv('ENABLE_SOLVABILITY_ANALYSIS', 'false').lower() == 'true'
)
-# Toggle for V1 GitHub resolver feature
-ENABLE_V1_GITHUB_RESOLVER = (
- os.getenv('ENABLE_V1_GITHUB_RESOLVER', 'false').lower() == 'true'
-)
-
-ENABLE_V1_SLACK_RESOLVER = (
- os.getenv('ENABLE_V1_SLACK_RESOLVER', 'false').lower() == 'true'
-)
-
-# Toggle for V1 GitLab resolver feature
-ENABLE_V1_GITLAB_RESOLVER = (
- os.getenv('ENABLE_V1_GITLAB_RESOLVER', 'false').lower() == 'true'
-)
-
OPENHANDS_RESOLVER_TEMPLATES_DIR = (
os.getenv('OPENHANDS_RESOLVER_TEMPLATES_DIR')
or 'openhands/integrations/templates/resolver/'
@@ -127,26 +112,6 @@ def get_summary_instruction():
return summary_instruction
-async def get_user_v1_enabled_setting(user_id: str | None) -> bool:
- """Get the user's V1 conversation API setting.
-
- Args:
- user_id: The keycloak user ID
-
- Returns:
- True if V1 conversations are enabled for this user, False otherwise
- """
- if not user_id:
- return False
-
- org = await OrgStore.get_current_org_from_keycloak_user_id(user_id)
-
- if not org or org.v1_enabled is None:
- return False
-
- return org.v1_enabled
-
-
def has_exact_mention(text: str, mention: str) -> bool:
"""Check if the text contains an exact mention (not part of a larger word).
diff --git a/enterprise/tests/unit/integrations/github/test_github_view_v1_initial_user_message.py b/enterprise/tests/unit/integrations/github/test_github_view_v1_initial_user_message.py
index 0ad22da82e..2aa73dd5d2 100644
--- a/enterprise/tests/unit/integrations/github/test_github_view_v1_initial_user_message.py
+++ b/enterprise/tests/unit/integrations/github/test_github_view_v1_initial_user_message.py
@@ -77,7 +77,6 @@ class TestGithubViewV1InitialUserMessage:
title='ignored',
description='ignored',
previous_comments=[],
- v1_enabled=True,
comment_body='please fix this',
comment_id=999,
)
@@ -131,7 +130,6 @@ class TestGithubViewV1InitialUserMessage:
title='ignored',
description='ignored',
previous_comments=[],
- v1_enabled=True,
comment_body='nit: rename variable',
comment_id=1001,
branch_name='feature-branch',
@@ -187,7 +185,6 @@ class TestGithubViewV1InitialUserMessage:
title='ignored',
description='ignored',
previous_comments=[],
- v1_enabled=True,
comment_body='please add a null check',
comment_id=1002,
branch_name='feature-branch',
diff --git a/enterprise/tests/unit/integrations/gitlab/test_gitlab_manager.py b/enterprise/tests/unit/integrations/gitlab/test_gitlab_manager.py
index 458c6d5076..9779a7a574 100644
--- a/enterprise/tests/unit/integrations/gitlab/test_gitlab_manager.py
+++ b/enterprise/tests/unit/integrations/gitlab/test_gitlab_manager.py
@@ -35,7 +35,6 @@ def mock_gitlab_view():
description='Test description',
previous_comments=[],
is_mr=False,
- v1_enabled=True,
)
diff --git a/enterprise/tests/unit/integrations/jira/conftest.py b/enterprise/tests/unit/integrations/jira/conftest.py
index d465903eb3..e4019e5331 100644
--- a/enterprise/tests/unit/integrations/jira/conftest.py
+++ b/enterprise/tests/unit/integrations/jira/conftest.py
@@ -215,7 +215,6 @@ def new_conversation_view(
conversation_id='conv-123',
_decrypted_api_key='decrypted_key',
)
- view.v1_enabled = False
return view
diff --git a/enterprise/tests/unit/integrations/slack/test_slack_view.py b/enterprise/tests/unit/integrations/slack/test_slack_view.py
index 8a84448b65..ba5949aa92 100644
--- a/enterprise/tests/unit/integrations/slack/test_slack_view.py
+++ b/enterprise/tests/unit/integrations/slack/test_slack_view.py
@@ -69,7 +69,6 @@ def slack_new_conversation_view(mock_slack_user, mock_user_auth):
send_summary_instruction=True,
conversation_id='',
team_id='T1234567890',
- v1_enabled=True,
)
@@ -99,7 +98,6 @@ def slack_update_conversation_view_v1(mock_slack_user, mock_user_auth):
conversation_id=conversation_id,
slack_conversation=mock_conversation,
team_id='T1234567890',
- v1_enabled=True,
)
@@ -111,18 +109,15 @@ def slack_update_conversation_view_v1(mock_slack_user, mock_user_auth):
class TestV1ConversationCreation:
"""Test V1 conversation creation in Slack integration."""
- @patch('integrations.slack.slack_view.is_v1_enabled_for_slack_resolver')
@patch.object(SlackNewConversationView, '_create_v1_conversation')
async def test_v1_conversation_creation(
self,
mock_create_v1,
- mock_is_v1_enabled,
slack_new_conversation_view,
mock_jinja_env,
):
"""Test that V1 conversations are created correctly."""
# Setup mocks
- mock_is_v1_enabled.return_value = True
mock_create_v1.return_value = None
# Execute
@@ -132,7 +127,6 @@ class TestV1ConversationCreation:
# Verify
assert result == slack_new_conversation_view.conversation_id
- assert slack_new_conversation_view.v1_enabled is True
mock_create_v1.assert_called_once()
diff --git a/enterprise/tests/unit/test_get_user_v1_enabled_setting.py b/enterprise/tests/unit/test_get_user_v1_enabled_setting.py
deleted file mode 100644
index a91fb9590a..0000000000
--- a/enterprise/tests/unit/test_get_user_v1_enabled_setting.py
+++ /dev/null
@@ -1,136 +0,0 @@
-"""Unit tests for get_user_v1_enabled_setting and is_v1_enabled_for_github_resolver functions."""
-
-import os
-from unittest.mock import AsyncMock, MagicMock, patch
-
-import pytest
-from integrations.github.github_view import (
- get_user_v1_enabled_setting,
- is_v1_enabled_for_github_resolver,
-)
-
-
-def mock_org():
- """Create a mock org object."""
- org = MagicMock()
- org.v1_enabled = True # Default to True, can be overridden in tests
- return org
-
-
-def mock_dependencies(mock_org):
- """Fixture that patches all the common dependencies."""
- with patch(
- 'integrations.utils.OrgStore.get_current_org_from_keycloak_user_id',
- new_callable=AsyncMock,
- return_value=mock_org,
- ) as mock_get_org:
- yield {
- 'get_org': mock_get_org,
- 'org': mock_org,
- }
-
-
-class TestIsV1EnabledForGithubResolver:
- """Test cases for is_v1_enabled_for_github_resolver function.
-
- This function returns True only if BOTH the environment variable
- ENABLE_V1_GITHUB_RESOLVER is true AND the user's org has v1_enabled=True.
- """
-
- @pytest.mark.asyncio
- @pytest.mark.parametrize(
- 'env_var_enabled,user_setting_enabled,expected_result',
- [
- (False, True, False), # Env var disabled, user enabled -> False
- (True, False, False), # Env var enabled, user disabled -> False
- (True, True, True), # Both enabled -> True
- (False, False, False), # Both disabled -> False
- ],
- )
- async def test_v1_enabled_combinations(
- self, mock_dependencies, env_var_enabled, user_setting_enabled, expected_result
- ):
- """Test all combinations of environment variable and user setting values."""
- mock_dependencies['org'].v1_enabled = user_setting_enabled
-
- with patch(
- 'integrations.github.github_view.ENABLE_V1_GITHUB_RESOLVER', env_var_enabled
- ):
- result = await is_v1_enabled_for_github_resolver('test_user_id')
- assert result is expected_result
-
- @pytest.mark.asyncio
- @pytest.mark.parametrize(
- 'env_var_value,env_var_bool,expected_result',
- [
- ('false', False, False), # Environment variable 'false' -> False
- ('true', True, True), # Environment variable 'true' -> True
- ],
- )
- async def test_environment_variable_integration(
- self, mock_dependencies, env_var_value, env_var_bool, expected_result
- ):
- """Test that the function properly reads the ENABLE_V1_GITHUB_RESOLVER environment variable."""
- mock_dependencies['org'].v1_enabled = True
-
- with patch.dict(
- os.environ, {'ENABLE_V1_GITHUB_RESOLVER': env_var_value}
- ), patch('integrations.utils.os.getenv', return_value=env_var_value), patch(
- 'integrations.github.github_view.ENABLE_V1_GITHUB_RESOLVER', env_var_bool
- ):
- result = await is_v1_enabled_for_github_resolver('test_user_id')
- assert result is expected_result
-
-
-class TestGetUserV1EnabledSetting:
- """Test cases for get_user_v1_enabled_setting function.
-
- This function only returns the user's org v1_enabled setting.
- It does NOT check the ENABLE_V1_GITHUB_RESOLVER environment variable.
- """
-
- @pytest.mark.asyncio
- async def test_function_calls_correct_methods(self, mock_dependencies):
- """Test that the function calls the correct methods with correct parameters."""
- mock_dependencies['org'].v1_enabled = True
-
- result = await get_user_v1_enabled_setting('test_user_123')
-
- # Verify the result
- assert result is True
-
- # Verify correct methods were called with correct parameters
- mock_dependencies['get_org'].assert_called_once_with('test_user_123')
-
- @pytest.mark.asyncio
- async def test_returns_user_setting_true(self, mock_dependencies):
- """Test that the function returns True when org.v1_enabled is True."""
- mock_dependencies['org'].v1_enabled = True
- result = await get_user_v1_enabled_setting('test_user_123')
- assert result is True
-
- @pytest.mark.asyncio
- async def test_returns_user_setting_false(self, mock_dependencies):
- """Test that the function returns False when org.v1_enabled is False."""
- mock_dependencies['org'].v1_enabled = False
- result = await get_user_v1_enabled_setting('test_user_123')
- assert result is False
-
- @pytest.mark.asyncio
- async def test_no_org_returns_false(self, mock_dependencies):
- """Test that the function returns False when no org is found."""
- # Mock get_current_org_from_keycloak_user_id to return None (no org found)
- mock_dependencies['get_org'].return_value = None
-
- result = await get_user_v1_enabled_setting('test_user_123')
- assert result is False
-
- @pytest.mark.asyncio
- async def test_org_v1_enabled_none_returns_false(self, mock_dependencies):
- """Test that the function returns False when org.v1_enabled is None."""
- mock_dependencies['org'].v1_enabled = None
-
- result = await get_user_v1_enabled_setting('test_user_123')
- assert result is False
diff --git a/enterprise/tests/unit/test_github_view.py b/enterprise/tests/unit/test_github_view.py
index 040858de9f..78ebc285c0 100644
--- a/enterprise/tests/unit/test_github_view.py
+++ b/enterprise/tests/unit/test_github_view.py
@@ -118,45 +118,8 @@ class TestGithubV1ConversationRouting(TestCase):
title='Test Issue',
description='Test issue description',
previous_comments=[],
- v1_enabled=False,
)
- @pytest.mark.asyncio
- @patch('integrations.github.github_view.initialize_conversation')
- @patch('integrations.github.github_view.get_user_v1_enabled_setting')
- async def test_initialize_sets_v1_enabled_from_setting_when_false(
- self, mock_get_v1_setting, mock_initialize_conversation
- ):
- """Test that initialize_new_conversation sets v1_enabled from get_user_v1_enabled_setting."""
- mock_get_v1_setting.return_value = False
- mock_initialize_conversation.return_value = MagicMock(
- conversation_id='new-conversation-id'
- )
-
- github_issue = self._create_github_issue()
- await github_issue.initialize_new_conversation()
-
- # Verify get_user_v1_enabled_setting was called with correct user ID
- mock_get_v1_setting.assert_called_once_with('test-keycloak-id')
- # Verify v1_enabled was set to False
- self.assertFalse(github_issue.v1_enabled)
-
- @pytest.mark.asyncio
- @patch('integrations.github.github_view.get_user_v1_enabled_setting')
- async def test_initialize_sets_v1_enabled_from_setting_when_true(
- self, mock_get_v1_setting
- ):
- """Test that initialize_new_conversation sets v1_enabled to True when setting returns True."""
- mock_get_v1_setting.return_value = True
-
- github_issue = self._create_github_issue()
- await github_issue.initialize_new_conversation()
-
- # Verify get_user_v1_enabled_setting was called with correct user ID
- mock_get_v1_setting.assert_called_once_with('test-keycloak-id')
- # Verify v1_enabled was set to True
- self.assertTrue(github_issue.v1_enabled)
-
@pytest.mark.asyncio
@patch.object(GithubIssue, '_create_v1_conversation')
async def test_create_new_conversation_routes_to_v1(self, mock_create_v1):
@@ -164,7 +127,6 @@ class TestGithubV1ConversationRouting(TestCase):
mock_create_v1.return_value = None
github_issue = self._create_github_issue()
- github_issue.v1_enabled = True
# Mock parameters
jinja_env = MagicMock()
@@ -216,24 +178,21 @@ class TestGithubOrgRouting(TestCase):
title='',
description='',
previous_comments=[],
- v1_enabled=True,
)
@pytest.mark.asyncio
@patch('integrations.github.github_view.get_app_conversation_service')
@patch('integrations.github.github_view.resolve_org_for_repo')
- @patch('integrations.github.github_view.get_user_v1_enabled_setting')
async def test_v1_passes_resolver_org_id_to_resolver_user_context(
- self, mock_v1_setting, mock_resolve_org, mock_get_service
+ self, mock_resolve_org, mock_get_service
):
"""V1 path passes resolved org_id to ResolverUserContext."""
# Arrange
- mock_v1_setting.return_value = True
mock_resolve_org.return_value = self.resolved_org_id
github_issue = self._create_github_issue()
- # Initialize to set resolved_org_id and v1_enabled
+ # Initialize to set resolved_org_id
await github_issue.initialize_new_conversation()
# Assert
@@ -242,13 +201,11 @@ class TestGithubOrgRouting(TestCase):
@pytest.mark.asyncio
@patch('integrations.github.github_view.get_app_conversation_service')
@patch('integrations.github.github_view.resolve_org_for_repo')
- @patch('integrations.github.github_view.get_user_v1_enabled_setting')
async def test_no_claim_passes_none_resolver_org_id(
- self, mock_v1_setting, mock_resolve_org, mock_get_service
+ self, mock_resolve_org, mock_get_service
):
"""When no claim exists, resolver_org_id is None (falls back to personal workspace)."""
# Arrange
- mock_v1_setting.return_value = True
mock_resolve_org.return_value = None
github_issue = self._create_github_issue()
diff --git a/enterprise/tests/unit/test_gitlab_view.py b/enterprise/tests/unit/test_gitlab_view.py
index 644807bf6f..3b2d344423 100644
--- a/enterprise/tests/unit/test_gitlab_view.py
+++ b/enterprise/tests/unit/test_gitlab_view.py
@@ -48,7 +48,6 @@ class TestGitlabOrgRouting(TestCase):
description='',
previous_comments=[],
is_mr=False,
- v1_enabled=True,
)
@pytest.mark.asyncio
diff --git a/enterprise/tests/unit/test_slack_integration.py b/enterprise/tests/unit/test_slack_integration.py
index 147e812b39..1403e287cb 100644
--- a/enterprise/tests/unit/test_slack_integration.py
+++ b/enterprise/tests/unit/test_slack_integration.py
@@ -64,7 +64,6 @@ def slack_new_conversation_view(mock_slack_user, mock_user_auth):
send_summary_instruction=True,
conversation_id='',
team_id='T1234567890',
- v1_enabled=False,
)