-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: missing connectors section #5387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR fixes a missing connectors section in the user settings modal by implementing federated OAuth connector support across multiple components. The changes add the ability for users to view and manage federated connectors (like Slack OAuth integrations) in their user settings, regardless of which page they access the settings from.
The core fix involves three main components:
-
SidebarWrapper.tsx - Adds the
useFederatedOAuthStatus
hook and passes federated connector data (federatedConnectors
andrefetchFederatedConnectors
) along withccPairs
to the UserSettingsModal. This ensures the connectors section is visible when accessing settings from the assistants page. -
ChatPage.tsx - Similarly integrates the federated OAuth status hook to provide complete connector information to the UserSettingsModal when accessed from the chat interface.
-
Comprehensive testing infrastructure - Adds a new end-to-end test (
federated_slack.spec.ts
) that validates the complete federated Slack connector workflow, from admin creation through user OAuth interaction to settings visibility. The test ensures that federated connectors properly appear in user settings after admin configuration.
The implementation follows existing patterns in the codebase where the UserSettingsModal conditionally shows a 'Connectors' tab based on the hasConnectors
variable, which depends on both regular connectors (ccPairs
) and federated connectors being provided as props. Without these changes, users would experience inconsistent behavior where the connectors section might be missing depending on their entry point to the settings modal.
Additionally, the PR includes necessary CI/CD updates to support federated connector testing by adding Slack OAuth credentials (SLACK_CLIENT_ID
and SLACK_CLIENT_SECRET
) to the Playwright test environment, enabling comprehensive end-to-end testing of the OAuth flow.
Confidence score: 4/5
- This PR addresses a clear user interface inconsistency with well-structured changes that follow existing patterns in the codebase
- Score reflects solid implementation approach but some concerns about test reliability due to hardcoded timeouts and potentially fragile selectors in the new e2e test
- Pay close attention to
web/tests/e2e/connectors/federated_slack.spec.ts
for potential test stability issues with environment variables and timing-dependent assertions
5 files reviewed, 1 comment
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 issues found across 5 files
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
|
||
# for federated slack tests | ||
SLACK_CLIENT_ID: ${{ secrets.SLACK_CLIENT_ID }} | ||
SLACK_CLIENT_SECRET: ${{ secrets.SLACK_CLIENT_SECRET }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Secrets are defined at workflow-level env, exposing them to every step and action; scope them to the Playwright test step to minimize exposure.
Prompt for AI agents
Address the following comment on .github/workflows/pr-playwright-tests.yml at line 15:
<comment>Secrets are defined at workflow-level env, exposing them to every step and action; scope them to the Playwright test step to minimize exposure.</comment>
<file context>
@@ -9,6 +9,11 @@ env:
+
+ # for federated slack tests
+ SLACK_CLIENT_ID: ${{ secrets.SLACK_CLIENT_ID }}
+ SLACK_CLIENT_SECRET: ${{ secrets.SLACK_CLIENT_SECRET }}
+
MOCK_LLM_RESPONSE: true
</file context>
web/admin2_auth.json
Outdated
{ | ||
"name": "fastapiusersauth", | ||
"value": "h3qhacpHbE4_09HcOLlVW4lSee48m1UbjYTUiKYwNiw", | ||
"value": "AAdfmA4NT0BXdlg80K3xVuLGVPPPqH7JfzVk82otIw0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid committing a real authentication cookie/token value; rely on global-setup to generate storage state at runtime or store a placeholder to prevent leaking credentials.
Prompt for AI agents
Address the following comment on web/admin2_auth.json at line 5:
<comment>Avoid committing a real authentication cookie/token value; rely on global-setup to generate storage state at runtime or store a placeholder to prevent leaking credentials.</comment>
<file context>
@@ -2,10 +2,10 @@
{
"name": "fastapiusersauth",
- "value": "h3qhacpHbE4_09HcOLlVW4lSee48m1UbjYTUiKYwNiw",
+ "value": "AAdfmA4NT0BXdlg80K3xVuLGVPPPqH7JfzVk82otIw0",
"domain": "localhost",
"path": "/",
</file context>
"value": "AAdfmA4NT0BXdlg80K3xVuLGVPPPqH7JfzVk82otIw0", | |
"value": "<redacted>", |
const { | ||
connectors: federatedConnectorOAuthStatus, | ||
refetch: refetchFederatedConnectors, | ||
} = useFederatedOAuthStatus(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant fetch: useFederatedOAuthStatus is invoked here and again inside FederatedOAuthModal, leading to duplicate network requests. Consider lifting the hook to ChatPage and passing data to the modal, or memoizing/centralizing the fetch.
Prompt for AI agents
Address the following comment on web/src/app/chat/components/ChatPage.tsx at line 168:
<comment>Redundant fetch: useFederatedOAuthStatus is invoked here and again inside FederatedOAuthModal, leading to duplicate network requests. Consider lifting the hook to ChatPage and passing data to the modal, or memoizing/centralizing the fetch.</comment>
<file context>
@@ -161,6 +162,10 @@ export function ChatPage({
+ const {
+ connectors: federatedConnectorOAuthStatus,
+ refetch: refetchFederatedConnectors,
+ } = useFederatedOAuthStatus();
const { user, isAdmin } = useUser();
</file context>
|
||
test.use({ storageState: "admin_auth.json" }); | ||
|
||
const SLACK_CLIENT_ID = process.env.SLACK_CLIENT_ID || ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fail fast or skip the test if SLACK_CLIENT_ID is not set; defaulting to "" silently misconfigures the flow.
Prompt for AI agents
Address the following comment on web/tests/e2e/connectors/federated_slack.spec.ts at line 7:
<comment>Fail fast or skip the test if SLACK_CLIENT_ID is not set; defaulting to "" silently misconfigures the flow.</comment>
<file context>
@@ -0,0 +1,108 @@
+
+test.use({ storageState: "admin_auth.json" });
+
+const SLACK_CLIENT_ID = process.env.SLACK_CLIENT_ID || "";
+const SLACK_CLIENT_SECRET = process.env.SLACK_CLIENT_SECRET || "";
+
</file context>
|
||
async function navigateToUserSettings(page: Page) { | ||
// Wait for any existing modals to close | ||
await page.waitForTimeout(1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid fixed delay; wait for a specific element/state signaling the UI is ready.
Prompt for AI agents
Address the following comment on web/tests/e2e/connectors/federated_slack.spec.ts at line 35:
<comment>Avoid fixed delay; wait for a specific element/state signaling the UI is ready.</comment>
<file context>
@@ -0,0 +1,108 @@
+
+async function navigateToUserSettings(page: Page) {
+ // Wait for any existing modals to close
+ await page.waitForTimeout(1000);
+
+ // Wait for potential modal backdrop to disappear
</file context>
await createOrUpdateButton.click(); | ||
|
||
// Wait for success message or redirect | ||
await page.waitForTimeout(2000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed wait introduces flakiness; wait for a deterministic condition (e.g., success UI, navigation, or network idle) instead.
Prompt for AI agents
Address the following comment on web/tests/e2e/connectors/federated_slack.spec.ts at line 30:
<comment>Fixed wait introduces flakiness; wait for a deterministic condition (e.g., success UI, navigation, or network idle) instead.</comment>
<file context>
@@ -0,0 +1,108 @@
+ await createOrUpdateButton.click();
+
+ // Wait for success message or redirect
+ await page.waitForTimeout(2000);
+}
+
</file context>
await page.waitForLoadState("networkidle"); | ||
|
||
// Click on Slack connector tile (specifically the one with "Logo Slack" text, not "Slack Bots") | ||
await page.getByRole("link", { name: "Logo Slack" }).first().click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Selector depends on icon alt text; prefer a text-based matcher that remains stable and avoids coupling to alt values.
Prompt for AI agents
Address the following comment on web/tests/e2e/connectors/federated_slack.spec.ts at line 16:
<comment>Selector depends on icon alt text; prefer a text-based matcher that remains stable and avoids coupling to alt values.</comment>
<file context>
@@ -0,0 +1,108 @@
+ await page.waitForLoadState("networkidle");
+
+ // Click on Slack connector tile (specifically the one with "Logo Slack" text, not "Slack Bots")
+ await page.getByRole("link", { name: "Logo Slack" }).first().click();
+ await page.waitForLoadState("networkidle");
+
</file context>
|
||
// Check if the OAuth modal appears | ||
await expect( | ||
page.getByText(/improve answer quality by letting/i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assertion checks for text that does not exist in the OAuth modal; use a stable element like the "Skip for now" button to confirm the modal is shown.
Prompt for AI agents
Address the following comment on web/tests/e2e/connectors/federated_slack.spec.ts at line 85:
<comment>Assertion checks for text that does not exist in the OAuth modal; use a stable element like the "Skip for now" button to confirm the modal is shown.</comment>
<file context>
@@ -0,0 +1,108 @@
+
+ // Check if the OAuth modal appears
+ await expect(
+ page.getByText(/improve answer quality by letting/i)
+ ).toBeVisible({ timeout: 10000 });
+ await expect(page.getByText(/slack/i)).toBeVisible();
</file context>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Description
^
How Has This Been Tested?
[Describe the tests you ran to verify your changes]
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.