Skip to content

feat(block): Conditionally hide impersonateUser field from block, add service account prompting#3966

Merged
TheodoreSpeaks merged 4 commits intostagingfrom
feat/service-account-prompting
Apr 7, 2026
Merged

feat(block): Conditionally hide impersonateUser field from block, add service account prompting#3966
TheodoreSpeaks merged 4 commits intostagingfrom
feat/service-account-prompting

Conversation

@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator

@TheodoreSpeaks TheodoreSpeaks commented Apr 5, 2026

Summary

  1. Currently impersonateUser always shows as a param in the block, even when its conditionally hidden by the useReactiveCondition. Extracted this to a helper method to be used in both locations.
  2. Copilot struggles with setting google service account credentials. That's because the block definition prompt only shows auth as google, not google-service-account. Added a service-account-type to the auth block to specific google, and we can extend this to other service account types in the future.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • Validated copilot can successfully use google service accounts
  • Validated impersonateUser only shows up in block view when account selected is a service account.

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)

Screenshots/Videos

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 5, 2026

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Apr 6, 2026 9:08pm

Request Review

@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator Author

@BugBot review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 5, 2026

PR Summary

Medium Risk
Changes credential requirement metadata used by Copilot/tooling and alters subblock visibility logic via a new shared reactive-conditions hook, which could affect what configuration fields are shown or what auth prompts are generated.

Overview
Adds a shared useReactiveConditions hook and wires it into both the editor subblock layout and canvas WorkflowBlock rendering so subblocks can be dynamically hidden based on watched field values (e.g., selected credential type).

Updates Copilot get_blocks_metadata transformation to derive the OAuth service from the oauth-input subblock’s serviceId (instead of the block id) and to additionally advertise service-account support via requiredCredentials.serviceAccountType when available.

Reviewed by Cursor Bugbot for commit fac34dc. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

✅ 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 fac34dc. Configure here.

@TheodoreSpeaks TheodoreSpeaks changed the title Feat/service account prompting feat(block): Conditionally hide impersonateUser field from block, add service account prompting Apr 6, 2026
@TheodoreSpeaks TheodoreSpeaks marked this pull request as ready for review April 6, 2026 23:07
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 6, 2026

Greptile Summary

This PR fixes two bugs in the Google service account (impersonateUser) UX: the field was always visible in the workflow canvas block view (now correctly filtered via the shared useReactiveConditions hook), and Copilot was unable to prompt for service account credentials (now the block metadata includes a serviceAccountType field when service account auth is supported).

  • Reactive condition extraction: The inline useReactiveConditions function from use-editor-subblock-layout.ts is promoted to a shared hook at @/hooks/use-reactive-conditions, eliminating duplication between the editor panel and the canvas workflow block.
  • Canvas block view fix: workflow-block.tsx now applies hiddenByReactiveCondition to filter subblocks in subBlockRowsData, matching the behavior that already existed in the editor panel and fixing the impersonateUser field always showing on the canvas.
  • Copilot service account metadata: get-blocks-metadata-tool.ts now calls getServiceAccountProviderForProviderId with the OAuth subblock's serviceId and, if a service account provider exists, exposes it as serviceAccountType in the Copilot block metadata so Copilot can guide users to use google-service-account credentials correctly.

Confidence Score: 5/5

Safe to merge — targeted bug fixes with no breaking changes

All changes are targeted bug fixes. The reactive condition extraction is a pure refactor with identical behavior. The workflow-block.tsx change correctly applies the same filtering logic already in the editor panel. The Copilot metadata change safely adds an optional field. No P0/P1 issues found; the single P2 is a minor documentation gap, not a current defect.

No files require special attention

Important Files Changed

Filename Overview
apps/sim/hooks/use-reactive-conditions.ts Shared reactive condition hook extracted from inline impl in use-editor-subblock-layout; returns Set of hidden subblock IDs based on credential type
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-editor-subblock-layout.ts Replaced inline useReactiveConditions function with import of shared hook; no logic changes, pure refactor
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx Added reactive condition filtering to canvas block view to fix impersonateUser field always showing regardless of selected credential type
apps/sim/lib/copilot/tools/server/blocks/get-blocks-metadata-tool.ts Added serviceAccountType to OAuth requiredCredentials when a block supports service account auth, enabling Copilot to correctly prompt for Google service account credentials

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Block subBlocks config] --> B[useReactiveConditions hook]
    B --> C{subblock with\nreactiveCondition?}
    C -- No --> D[Return empty Set]
    C -- Yes --> E[Watch credential field\nvia useSubBlockStore]
    E --> F[Fetch credential type\nvia useWorkspaceCredential]
    F --> G{credential.type\n=== requiredType?}
    G -- Match --> H[Condition met]
    G -- No match --> I[Add subblock ID\nto hidden Set]
    H --> J[Return hidden Set]
    I --> J
    J --> K[workflow-block.tsx\nsubBlockRowsData filter]
    J --> L[use-editor-subblock-layout\nvisibleSubBlocks filter]
    K --> M[Canvas: impersonateUser\nhidden correctly]
    L --> N[Editor panel: impersonateUser\nhidden correctly]
Loading

Reviews (1): Last reviewed commit: "Fix lint" | Re-trigger Greptile

@TheodoreSpeaks TheodoreSpeaks merged commit 8c8c627 into staging Apr 7, 2026
11 checks passed
@TheodoreSpeaks TheodoreSpeaks deleted the feat/service-account-prompting branch April 7, 2026 00:24
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