Skip to content

fix: sync Salesforce project links#716

Open
jaeyunha wants to merge 3 commits into
stagingfrom
issue-578-p2-salesforce-link-cases-to-issues
Open

fix: sync Salesforce project links#716
jaeyunha wants to merge 3 commits into
stagingfrom
issue-578-p2-salesforce-link-cases-to-issues

Conversation

@jaeyunha

Copy link
Copy Markdown
Member

Summary

  • queue Salesforce case updates when a linked project is initially linked or its status/priority changes
  • add Salesforce project URL custom-field sync support
  • repair integrations/settings and source-link UI regressions from the integration branch merge

Verification

  • pnpm lint
  • pnpm --filter @exponential/web test integrations-view.test.tsx
  • make check (blocked at web typecheck by legacy Better Auth/Drizzle imports missing dependencies)
  • pnpm api:test (blocked: go binary is not installed in this lane)

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c139f22b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +467 to +470
where provider='salesforce'
and status in ('connected','degraded')
and (external_id=$1 or metadata->>'orgId'=$1 or metadata->>'organizationId'=$1)
order by connected_at desc

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Scope Salesforce actions to the intended workspace

When the same Salesforce org is installed in more than one Exponential workspace, this resolver ignores any workspace slug/integration id and selects only by org id, ordered by the latest connection. A signed case action from one workspace can therefore search, create, or link issues/projects in whichever workspace connected that Salesforce org most recently; the action payload needs to carry and filter by a workspace/integration identifier.

Useful? React with 👍 / 👎.

Comment on lines +78 to +81
"issueId": after.ID,
"identifier": after.Identifier,
"priority": after.Priority,
"issueUrl": strings.TrimRight(configuredIssueAppURL(), "/") + "/team/" + url.PathEscape(link.TeamKey) + "/issue/" + url.PathEscape(after.Identifier),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Send the project URL when an issue joins a project

When only project_id changes on a Salesforce-linked issue, projectChanged makes this path enqueue a job, but the payload still has no projectUrl. Since salesforceCasePatchBody only writes the Salesforce project custom field from projectUrl, assigning or moving the issue to a project leaves the Case's project URL blank/stale until a separate project link or project status/priority edit happens.

Useful? React with 👍 / 👎.

Comment on lines 1113 to 1114
if got := setupRequirement("zendesk"); got != nil {
t.Fatalf("zendesk should be configurable from admin setup, got %#v", got)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fix the failing Zendesk setup expectation

This newly added assertion now fails because setupRequirement("zendesk") still returns a configuration_required object in handler.go, so the integrations Go test suite will fail in CI once the Go toolchain is available. Either update setupRequirement to allow the admin Zendesk setup flow or adjust this expectation.

Useful? React with 👍 / 👎.

@jaeyunha

Copy link
Copy Markdown
Member Author

Controller disposition for current head 2c139f2: validation-blocked / rebase required; do not merge as-is.

Evidence:

  • PR fix: sync Salesforce project links #716 targets staging but does not contain current origin/staging (origin/staging is not an ancestor of the PR head).
  • GitHub reports the PR as CONFLICTING; local merge simulation reproduces conflicts in apps/api/internal/integrations/handler_test.go, apps/api/internal/integrations/salesforce.go, apps/api/internal/integrations/salesforce_jobs.go, apps/api/internal/issues/sentry_sources.go, apps/web/src/app/(app)/settings/integrations/page.tsx, apps/web/src/components/issue-detail-view.tsx, and apps/web/tests/integrations-view.test.tsx.
  • No GitHub checks are reported, and the PR body only claims focused worker-side checks.

Required before merge: rebuild/rebase this branch onto current origin/staging, resolve the listed conflicts while preserving the Salesforce source-link/project sync contract, regenerate OpenAPI/SDK if the API contract changes, and rerun the focused Go/web/OpenAPI gates plus the broader repo gates as far as the environment allows.

jaeyunha and others added 3 commits June 16, 2026 23:37
…from code review

- Validate fetchSalesforceUserInfo endpoint against salesforceOAuthBaseURL()
  before making the outbound HTTP request to prevent SSRF via a crafted
  token.ID in the OAuth response.
- Remove the Authorization: Bearer fallback in salesforceSignedAction so
  HMAC signature verification is mandatory for every request; no static
  secret bypass is accepted.
- Move HTTP status checks before json.Decode in exchangeSalesforceOAuth
  and fetchSalesforceUserInfo; include response body in error messages so
  non-2xx failures are surfaced accurately.
- Assign getSalesforceSourceLink(event) to a const in the render path of
  issue-detail-view.tsx to avoid calling the function twice per render.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jaeyunha jaeyunha force-pushed the issue-578-p2-salesforce-link-cases-to-issues branch from 2c139f2 to 82613fc Compare June 17, 2026 06:53

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82613fc9ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

problem.Write(w, 500, "Update issue failed", err.Error())
return
}
if err := h.queueSalesforceAutomations(r.Context(), tx, p.WorkspaceID, existing, updated); err != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove duplicate Salesforce automation enqueue

For Salesforce-linked issues, queueSalesforceAutomations already runs immediately above this block; this second call walks the same links and blindly inserts another provider_job for each one. When a user changes an issue's status, priority, or project, the worker will PATCH the same Salesforce Case twice and record duplicate jobs/events, so the repeated call should be removed.

Useful? React with 👍 / 👎.

@jaeyunha

Copy link
Copy Markdown
Member Author

Controller disposition for current head 82613fc: validation-blocked; do not merge as-is.

Current blocker:

  • PR fix: sync Salesforce project links #716 is now mergeable, but it still implements only Salesforce project/status-link sync. The linked P2 Salesforce: link cases to issues/projects and surface realtime status #578 spec requires a complete Salesforce customer-feedback integration: case/customer_request create-link persistence, immutable Salesforce source metadata, admin OAuth/setup/reconnect/disconnect flows, privacy/private-team and provider-permission/degraded handling, completion follow-up behavior, and mocked Playwright admin + Case workflow coverage.
  • Diff evidence: current head touches project/status sync paths plus integration settings UI, OpenAPI provider enum, and SDK generation; it does not add customer_request persistence/API paths, Salesforce case-to-customer-request UI/API coverage, privacy/permission failure tests, or Playwright workflow coverage.
  • No GitHub checks are reported. Worker/body checks are noted but are not enough to close P2 Salesforce: link cases to issues/projects and surface realtime status #578.

Required before merge: either narrow this PR so it no longer claims to close #578, or extend it to cover the remaining #578 acceptance contract with focused Go/OpenAPI/SDK/web tests and mocked Playwright coverage.

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