Skip to content

fix(integrations): resolve OAuth connect UI by service id instead of display name#5001

Merged
waleedlatif1 merged 3 commits into
stagingfrom
worktree-fix-jsm-credential-display
Jun 12, 2026
Merged

fix(integrations): resolve OAuth connect UI by service id instead of display name#5001
waleedlatif1 merged 3 commits into
stagingfrom
worktree-fix-jsm-credential-display

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes Jira Service Management (and Google Slides, Monday) showing the API-key "Add to Sim" path on the integration detail page instead of the OAuth connect flow and the connected Jira account
  • Root cause: resolveOAuthServiceForIntegration matched the integration's display name against OAuth service names, which breaks whenever they differ ("Jira Service Management" vs "Jira", "Google Slides" vs "Google Drive", "Monday" vs "Monday.com")
  • The catalog generator now extracts the serviceId the block declares on its oauth-input subBlock into integrations.json (oauthServiceId), and fails loudly if an OAuth block is missing one
  • resolveOAuthServiceForIntegration resolves through the new getServiceConfigByServiceId lookup instead of name matching; all previously-working integrations resolve to the same service as before

Type of Change

  • Bug fix

Testing

  • Added oauth-service.test.ts with a catalog-wide invariant that every OAuth integration resolves to a registered OAuth service, plus regression cases for the three previously-broken integrations
  • Added getServiceConfigByServiceId cases to lib/oauth/utils.test.ts
  • Verified via script that the new resolution returns the identical service as name matching for every integration that previously resolved

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 12, 2026 6:22pm

Request Review

@cursor

cursor Bot commented Jun 12, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches integration connect and credential display paths used across the workspace; behavior is broad but guarded by catalog-wide tests and build-time validation for missing service ids.

Overview
Fixes OAuth connect UI for integrations whose display name does not match the registered OAuth service (e.g. Jira Service Management → Jira, Google Slides → Google Drive).

Catalog & resolution: The docs generator now pulls serviceId from each block’s oauth-input subBlock into integrations.json as oauthServiceId, and fails the build if an OAuth block lacks one. resolveOAuthServiceForIntegration uses that id via new getServiceConfigByServiceId instead of scanning OAUTH_PROVIDERS by service display name.

Workspace UI: Integration detail pages match connected credentials by providerId (not service name). Connected credential headers pick the canonical integration tile when several blocks share one OAuth service.

Tests: oauth-service.test.ts pins slug → providerId for the full OAuth catalog; utils.test.ts covers service-id lookup.

Reviewed by Cursor Bugbot for commit fa21369. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes OAuth connect UI regression for Jira Service Management, Google Slides, and Monday by replacing fragile display-name matching with a deterministic service-id lookup. The oauthServiceId (sourced from each block's oauth-input subBlock) is now baked into integrations.json at generation time and used as the single source of truth for resolving OAuth service configs.

  • Root-cause fix in resolveOAuthServiceForIntegration: switched from iterating OAUTH_PROVIDERS and comparing service names to a direct getServiceConfigByServiceId(integration.oauthServiceId) call; the generator now throws loudly if an OAuth block is missing a serviceId, preventing silent regressions.
  • Credential filter in integration-block-detail.tsx updated to compare providerId directly instead of serviceName, eliminating the same class of display-name mismatch.
  • Brand tile lookup in connected-credential-detail.tsx now finds all integrations sharing a provider, prefers the one whose name matches the service (canonical), and falls back gracefully to the first candidate for shared-service cases.

Confidence Score: 5/5

Safe to merge — the change is a targeted ID-based lookup replacing a broken name-based one, all previously-working integrations map to the same services as before, and the catalog-wide invariant test makes future regressions loud.

Every OAuth integration now resolves through an explicit oauthServiceId key embedded in the generated catalog. The generator hard-fails for any new block that omits serviceId, so the class of bug being fixed cannot re-enter silently. The test suite pins the expected providerId for all 43 OAuth integrations and verifies the three previously broken cases explicitly.

No files require special attention. scripts/generate-docs.ts is the most complex change but the brace-matching logic is well-contained and covered by the catalog invariant test.

Important Files Changed

Filename Overview
apps/sim/lib/integrations/oauth-service.ts Core fix: replaces fragile name-based matching with deterministic oauthServiceId lookup via new getServiceConfigByServiceId helper; also adds resolveOAuthServiceForSlug convenience wrapper
apps/sim/lib/oauth/utils.ts Adds getServiceConfigByServiceId — looks up a service by its services map key (not by providerId), correctly distinguishing e.g. key "gmail" from providerId "google-email"
scripts/generate-docs.ts Adds extractOAuthServiceId with string/comment-blanked brace matching and a hard-fail on missing serviceId for OAuth blocks; minor: the initial type: 'oauth-input' regex runs on the original content rather than the blanked copy, so it could in theory match inside a string literal or comment (no real-world impact given current block files)
apps/sim/app/workspace/[workspaceId]/integrations/[block]/integration-block-detail.tsx Credential filter now compares providerId directly instead of serviceName, making it immune to display-name mismatches
apps/sim/app/workspace/[workspaceId]/integrations/connected/[credentialId]/connected-credential-detail.tsx Rebuilds integrationBlockType lookup using resolveOAuthServiceForIntegration; prefers the integration whose name matches the service name (canonical), falls back to the first candidate — deterministic for all current services
apps/sim/lib/integrations/oauth-service.test.ts New test file with a catalog-wide invariant, pinned slug→providerId regression table for all 43 OAuth integrations, and checks for the three originally broken cases (Jira Service Management, Google Slides, Monday)
apps/sim/lib/oauth/utils.test.ts Adds tests for getServiceConfigByServiceId covering happy paths, the gmailgoogle-email key/providerId distinction, and null-return for unknown ids

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Integration entry\n(e.g. 'Jira Service Management')"] -->|"authType === 'oauth'"| B["Read oauthServiceId\n(e.g. 'jira')"]
    B --> C["getServiceConfigByServiceId('jira')"]
    C --> D["OAUTH_PROVIDERS\nprovider.services['jira']"]
    D -->|"found"| E["OAuthServiceMatch\nproviderId: 'jira'\nserviceName: 'Jira'"]
    D -->|"not found"| F["return null\n(falls back to API-key path)"]
    E --> G["ConnectOAuthModal\n(correct OAuth flow)"]
    H["OLD: name matching"] -->|"'Jira Service Management'\n!== 'Jira'"| F
    style H fill:#f99,stroke:#c00
    style G fill:#9f9,stroke:#090
    style F fill:#fcc,stroke:#c00
Loading

Reviews (2): Last reviewed commit: "fix(docs-gen): blank string literals and..." | Re-trigger Greptile

Comment thread scripts/generate-docs.ts
…grations; fix credential branding reverse lookup
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1 waleedlatif1 merged commit 636bd74 into staging Jun 12, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the worktree-fix-jsm-credential-display branch June 12, 2026 18:38

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit fa21369. Configure here.

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.

1 participant