Skip to content

[COLLAB-CON-1]: getFlowConnections query#1337

Open
kevinkim-ogp wants to merge 2 commits intodevelop-v2from
collab-conn/get-flow-connections-query
Open

[COLLAB-CON-1]: getFlowConnections query#1337
kevinkim-ogp wants to merge 2 commits intodevelop-v2from
collab-conn/get-flow-connections-query

Conversation

@kevinkim-ogp
Copy link
Copy Markdown
Contributor

@kevinkim-ogp kevinkim-ogp commented Nov 25, 2025

TL;DR

Added a new getFlowConnections query to fetch shared connection.

What changed?

  • Created a new GraphQL query resolver getFlowConnections that returns connections associated with a specific flow
  • Added a new GraphQL type SharedFlowConnection to represent flow connections in the schema
  • Implemented handling for both regular connections and table connections
  • Added comprehensive tests to verify the functionality works correctly for different connection types
  • Updated the query resolvers to include the new resolver

How to test?

  1. Query the GraphQL endpoint with:
    query {
      getFlowConnections(flowId: "your-flow-id") {
        flowId
        connectionId
        connectionType
        appName
        appIconUrl
        addedBy
        connectionName
      }
    }
  2. Verify that regular connections (like Slack, Telegram) returned with the correct information
  3. Verify that Tile connections are returned with the correct Tile name

Note

Introduces getFlowConnections to return a flow’s shared connections (apps and tables) with app metadata and contributor info, updating schema/resolvers and adding tests.

  • GraphQL:
    • New Query: getFlowConnections(flowId: String!) returning [SharedFlowConnection!]!.
    • New Type: SharedFlowConnection with flowId, connectionId, connectionType, appName, appIconUrl, addedBy, connectionName.
    • Resolver: Implements queries/get-flow-connections.ts:
      • Authorizes via currentUser.withAccessibleFlows(requiredRole: 'editor').
      • Fetches from FlowConnections with connection, table, and user relations.
      • Maps app metadata from App.findAll(); uses tiles for table connections.
      • Filters out entries without a loaded connection or table.
    • Wiring: Adds resolver to query-resolvers.ts and schema.
  • Model:
    • Adds optional user?: User property to FlowConnections.
  • Tests:
    • Adds unit tests for regular connections, table connections, and mixed results in __tests__/queries/get-flow-connections.test.ts.

Written by Cursor Bugbot for commit fc3338d. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown
Contributor Author

kevinkim-ogp commented Nov 25, 2025


How to use the Graphite Merge Queue

Add the label lfg to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kevinkim-ogp kevinkim-ogp changed the title feat: getFlowConnections [COLLAB-CONN]: getFlowConnections query Nov 26, 2025
@kevinkim-ogp kevinkim-ogp changed the title [COLLAB-CONN]: getFlowConnections query [COLLAB-CONN-1]: getFlowConnections query Nov 26, 2025
@kevinkim-ogp kevinkim-ogp changed the title [COLLAB-CONN-1]: getFlowConnections query [COLLAB-CON-1]: getFlowConnections query Nov 26, 2025
@kevinkim-ogp kevinkim-ogp force-pushed the collab-conn/get-flow-connections-query branch from edbf3a8 to fc3338d Compare November 26, 2025 14:07
@kevinkim-ogp kevinkim-ogp marked this pull request as ready for review November 27, 2025 01:56
@kevinkim-ogp kevinkim-ogp requested a review from a team as a code owner November 27, 2025 01:56
@kevinkim-ogp
Copy link
Copy Markdown
Contributor Author

bugbot run

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment thread packages/backend/src/graphql/queries/get-flow-connections.ts Outdated
Comment thread packages/backend/src/graphql/queries/get-flow-connections.ts

const filteredFlowConnections = rawFlowConnections.filter(
(flowConnection) => flowConnection.connection || flowConnection.table,
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Filter doesn't match connectionType, causing undefined connectionName

The filter keeps records where connection OR table exists, but the subsequent logic uses connectionType to determine which relation to read from. If connectionType is 'table' but only connection exists (or vice versa), the record passes the filter but connectionName becomes undefined. The GraphQL schema declares connectionName: String! as non-nullable, so returning undefined will cause a runtime error. The filter needs to verify the correct relation exists based on connectionType.

Additional Locations (1)

Fix in Cursor Fix in Web

@kevinkim-ogp kevinkim-ogp force-pushed the collab-conn/get-flow-connections-query branch from fc3338d to 611b51a Compare January 7, 2026 00:31
Comment thread packages/backend/src/graphql/queries/get-flow-connections.ts Outdated
Copy link
Copy Markdown
Contributor

@pregnantboy pregnantboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works. Only main thing to change is the permission check for flow not correct. and the later filters for connectionType can be better refactored

const flowConnections = await Promise.all(
filteredFlowConnections.map(async (flowConnection) => {
let connectionName = flowConnection?.connection?.formattedData?.screenName
if (flowConnection.connectionType === 'table') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (flowConnection.connectionType === 'table') {
if (flowConnection.connectionType === 'table' && flowConnection.table) {

if (flowConnection.connectionType === 'table') {
appKey = 'tiles'
}
const app = apps.find((app: IApp) => app.key === appKey)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const app = apps.find((app: IApp) => app.key === appKey)
const app = apps.find((app: IApp) => app.key === (flowConnection.connectionType === 'table' ?
'tiles' : appKey))

@kevinkim-ogp kevinkim-ogp force-pushed the collab-conn/get-flow-connections-query branch from dacae29 to 7cafb8e Compare March 27, 2026 02:04
Copy link
Copy Markdown
Contributor

@pregnantboy pregnantboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kevinkim-ogp kevinkim-ogp force-pushed the collab-conn/get-flow-connections-query branch from 7cafb8e to b8d7229 Compare March 31, 2026 01:23
@kevinkim-ogp kevinkim-ogp changed the base branch from develop-v2 to graphite-base/1337 April 6, 2026 23:37
@kevinkim-ogp kevinkim-ogp force-pushed the collab-conn/get-flow-connections-query branch from b8d7229 to d8fab6f Compare April 6, 2026 23:37
@kevinkim-ogp kevinkim-ogp changed the base branch from graphite-base/1337 to trunk/collab-conn April 6, 2026 23:37
@kevinkim-ogp kevinkim-ogp deleted the branch develop-v2 April 7, 2026 00:32
@kevinkim-ogp kevinkim-ogp reopened this Apr 7, 2026
@kevinkim-ogp kevinkim-ogp changed the base branch from trunk/collab-conn to graphite-base/1337 April 7, 2026 15:31
@kevinkim-ogp kevinkim-ogp changed the base branch from graphite-base/1337 to develop-v2 April 7, 2026 15:31
@kevinkim-ogp kevinkim-ogp force-pushed the collab-conn/get-flow-connections-query branch from d8fab6f to ab163df Compare April 15, 2026 11:46
@kevinkim-ogp kevinkim-ogp force-pushed the collab-conn/get-flow-connections-query branch from ab163df to 65d7019 Compare April 16, 2026 15:14
Comment on lines +51 to +60
const appKey = flowConnection.connection?.key
const app = apps.find(
(app: IApp) =>
app.key ===
(flowConnection.connectionType === 'table' ? 'tiles' : appKey),
)

if (!app) {
throw new Error(`App not found for key: ${appKey}`)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message will be misleading for table connections. When connectionType === 'table', appKey is undefined (since flowConnection.connection doesn't exist), but the actual key being searched for is 'tiles'. The error will say "App not found for key: undefined" instead of "App not found for key: tiles".

Fix:

const appKey = flowConnection.connectionType === 'table' 
  ? 'tiles' 
  : flowConnection.connection?.key

const app = apps.find((app: IApp) => app.key === appKey)

if (!app) {
  throw new Error(`App not found for key: ${appKey}`)
}

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@kevinkim-ogp kevinkim-ogp mentioned this pull request Apr 17, 2026
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants