Skip to content

Conversation

@Udit-takkar
Copy link
Contributor

@Udit-takkar Udit-takkar commented Jan 21, 2026

What does this PR do?

Fixes #20153

Screen.Recording.2026-01-22.at.12.23.10.AM.mov

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Enable auto-translation on a workflow step (EMAIL_ATTENDEE, SMS_ATTENDEE, or WHATSAPP_ATTENDEE)
  2. Save the workflow
  3. Verify translations are generated asynchronously
  4. Create a booking and verify attendee receives notification in their browser language

Updates since last revision

  • Removed redundant @@index([workflowStepId, field, targetLocale]) from Prisma schema and migration file. The @@unique constraint on the same columns already provides efficient lookups, so the separate index added unnecessary storage overhead and write latency.

Human Review Checklist

  • Verify migration SQL is valid after redundant index removal
  • Review translation array handling in translateWorkflowStepData.ts (Cubic flagged potential locale misalignment at confidence 7/10 - not addressed per instructions to only fix 9/10+ confidence issues)

Summary by cubic

Adds auto-translation for attendee workflow notifications (email and SMS) with pre-generated translations and locale-aware delivery. Organization users can enable this per step; messages are translated via Lingo.dev and applied at send time.

  • New Features

    • UI: "Auto-translate for attendees" checkbox for org users on attendee actions.
    • DB: New WorkflowStepTranslation model and enum; WorkflowStep gains autoTranslateEnabled and sourceLocale.
    • Tasker: translateWorkflowStepData pre-translates reminder body and email subject to 19 locales.
    • Services: EmailWorkflowService and smsReminderManager load translations by attendee locale before templating.
    • API: Update handler saves toggle/sourceLocale and enqueues translation on create/update; schema updated.
    • Repository: WorkflowStepTranslationRepository for upsert/find operations.
  • Migration

    • Run Prisma migration.
    • Translations generate asynchronously after saving a step with auto-translate enabled.

Written for commit 8fc5576. Summary will update on new commits.


Link to Devin run: https://app.devin.ai/sessions/5af578f52c7f411da5021f301f032832
Requested by: unknown ()


Open with Devin

@github-actions github-actions bot added the ❗️ migrations contains migration files label Jan 21, 2026
@github-actions github-actions bot added ai area: AI, cal.ai consumer Medium priority Created by Linear-GitHub Sync workflows area: workflows, automations labels Jan 21, 2026
@Udit-takkar Udit-takkar marked this pull request as ready for review January 21, 2026 19:11
@Udit-takkar Udit-takkar requested a review from a team as a code owner January 21, 2026 19:11
@graphite-app graphite-app bot added enterprise area: enterprise, audit log, organisation, SAML, SSO core area: core, team members only labels Jan 21, 2026
@graphite-app graphite-app bot requested review from a team January 21, 2026 19:12
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 31 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/prisma/migrations/20260121145242_add_workflow_step_translation/migration.sql">

<violation number="1" location="packages/prisma/migrations/20260121145242_add_workflow_step_translation/migration.sql:23">
P2: Redundant index: The `@@index` on `[workflowStepId, field, targetLocale]` duplicates the `@@unique` constraint on the same columns. A unique index already provides efficient lookups, so the separate `@@index` adds storage overhead and write latency without benefit.

Remove the `@@index([workflowStepId, field, targetLocale])` directive from the Prisma schema at `packages/prisma/schema.prisma:2414`.</violation>
</file>

<file name="packages/features/tasker/tasks/translateWorkflowStepData.ts">

<violation number="1" location="packages/features/tasker/tasks/translateWorkflowStepData.ts:57">
P2: The filtered translations array reindexes results, so `targetLocales[index]` can point to the wrong locale whenever a translation is null. This will save translations under incorrect locales. Map with the original index before filtering so the locale stays aligned.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

targetLocales.map((targetLocale) => LingoDotDevService.localizeText(text, userLocale, targetLocale))
);

const validTranslations = translations
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 21, 2026

Choose a reason for hiding this comment

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

P2: The filtered translations array reindexes results, so targetLocales[index] can point to the wrong locale whenever a translation is null. This will save translations under incorrect locales. Map with the original index before filtering so the locale stays aligned.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/features/tasker/tasks/translateWorkflowStepData.ts, line 57:

<comment>The filtered translations array reindexes results, so `targetLocales[index]` can point to the wrong locale whenever a translation is null. This will save translations under incorrect locales. Map with the original index before filtering so the locale stays aligned.</comment>

<file context>
@@ -0,0 +1,104 @@
+      targetLocales.map((targetLocale) => LingoDotDevService.localizeText(text, userLocale, targetLocale))
+    );
+
+    const validTranslations = translations
+      .filter((trans): trans is string => trans !== null)
+      .map((trans, index) => ({
</file context>
Fix with Cubic

@github-actions
Copy link
Contributor

Devin AI is addressing Cubic AI's review feedback

A Devin session has been created to address the issues identified by Cubic AI.

View Devin Session

The @@index on [workflowStepId, field, targetLocale] duplicates the @@unique
constraint on the same columns. A unique index already provides efficient
lookups, so the separate @@index adds storage overhead and write latency
without benefit.

Addresses Cubic AI review feedback (confidence 9/10).

Co-Authored-By: unknown <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai area: AI, cal.ai consumer core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO Medium priority Created by Linear-GitHub Sync ❗️ migrations contains migration files size/XXL workflows area: workflows, automations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-5320] Workflow AI translation

2 participants