Skip to content

Conversation

@chesterkmr
Copy link
Contributor

@chesterkmr chesterkmr commented Jun 22, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced process tracker to display end-user verification statuses with corresponding icons.
    • Added support for stricter status validation in end-user verification checks.
  • Improvements

    • Updated tracker items to show end-user names and verification statuses instead of child workflows.
    • Added project context support to workflow creation and API plugins.
  • Bug Fixes

    • Streamlined handling of verification status icons for improved accuracy and consistency.
  • Style

    • Minor update to Checkbox component styling for improved class order.
  • Chores

    • Updated internal dependencies and refactored import statements for better code organization.
    • Added temporary console logging for document arrays in the documents hook.

@changeset-bot
Copy link

changeset-bot bot commented Jun 22, 2025

⚠️ No Changeset found

Latest commit: 87c67d2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 22, 2025

Warning

Rate limit exceeded

@chesterkmr has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 8cd0821 and 87c67d2.

📒 Files selected for processing (2)
  • apps/backoffice-v2/src/common/components/molecules/ProcessTracker/trackers/ubo-flows/hooks/useUBOFlowsTrackerItems/helpers/get-end-user-flow-status.ts (1 hunks)
  • apps/backoffice-v2/src/common/components/molecules/ProcessTracker/trackers/ubo-flows/hooks/useUBOFlowsTrackerItems/useUBOFlowsTrackerItems.ts (1 hunks)

Walkthrough

This update introduces strict typing and icon mapping for end user individual verification check statuses, modifies UBO flow tracking to use end user data and their verification statuses, and extends workflow and plugin infrastructure to support a projectId property throughout the workflow lifecycle. Minor refactors and logging were also added.

Changes

File(s) / Path(s) Change Summary
.../molecules/ProcessTracker/constants.tsx Added endUserFlowStatusToIcon mapping for verification statuses to icons.
.../ProcessTracker/trackers/ubo-flows/UBOFlowsTracker.tsx Changed hook input from childWorkflows to endUsers for tracker items.
.../trackers/ubo-flows/hooks/useUBOFlowsTrackerItems/helpers/get-end-user-flow-status.ts Added getEndUserFlowStatus helper to map end user status to icon.
.../trackers/ubo-flows/hooks/useUBOFlowsTrackerItems/helpers/get-ubo-flow-status-by-tags.ts Deleted helper function getUBOFlowStatusByTags.
.../trackers/ubo-flows/hooks/useUBOFlowsTrackerItems/useUBOFlowsTrackerItems.ts Refactored to use endUsers, update mapping logic, and use new status-to-icon helper.
.../domains/individuals/fetchers.ts Added EndUserIndividualVerificationChecksStatus constant and stricter status typing in schema.
.../lib/blocks/hooks/useDocumentBlocks/hooks/useDocuments/useDocuments.ts Added a console log for ubosDocuments.
packages/ui/src/components/atoms/inputs/Checkbox/Checkbox.tsx Reordered CSS classes in Checkbox component.
packages/workflow-core/src/lib/create-workflow.ts Added projectId parameter to createWorkflow and forwarded to runner.
packages/workflow-core/src/lib/plugins/external-plugin/api-plugin/api-plugin.ts Added optional projectId property, constructor param, and included in API request payload.
packages/workflow-core/src/lib/plugins/external-plugin/types.ts Added optional projectId to IApiPluginParams interface.
packages/workflow-core/src/lib/plugins/external-plugin/vendor-consts.ts Added workflowRuntimeDataId field to Veriff KYC session request mapping.
packages/workflow-core/src/lib/types.ts Added optional projectId to WorkflowOptions and WorkflowRunnerArgs interfaces.
packages/workflow-core/src/lib/workflow-runner.ts Added private #__projectId, updated constructor and plugin instantiation to support projectId.
services/workflows-service/prisma/data-migrations Updated subproject commit reference.
services/workflows-service/src/document/document.service.ts Grouped imports from @/prisma/prisma.util.
services/workflows-service/src/workflow/workflow.service.ts Passed projectId to workflow creation and event handling.

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant UBOFlowsTracker
    participant useUBOFlowsTrackerItems
    participant getEndUserFlowStatus

    UI->>UBOFlowsTracker: Render
    UBOFlowsTracker->>useUBOFlowsTrackerItems: Call with endUsers
    useUBOFlowsTrackerItems->>getEndUserFlowStatus: For each endUser, get status icon
    getEndUserFlowStatus-->>useUBOFlowsTrackerItems: Return icon
    useUBOFlowsTrackerItems-->>UBOFlowsTracker: Return tracker items with icons
    UBOFlowsTracker-->>UI: Render tracker with updated items
Loading
sequenceDiagram
    participant WorkflowService
    participant createWorkflow
    participant WorkflowRunner
    participant ApiPlugin

    WorkflowService->>createWorkflow: Call with projectId
    createWorkflow->>WorkflowRunner: Instantiate with projectId
    WorkflowRunner->>ApiPlugin: Instantiate with projectId
    ApiPlugin->>ApiPlugin: Include projectId in API request payload
Loading

Possibly related PRs

  • ballerine-io/ballerine#3309: Adds optional individualVerificationsChecks to EndUserSchema, structuring verification check data; directly related to this PR's changes in verification check handling and schema.

Suggested reviewers

  • Omri-Levy

Poem

Hopping through the workflow fields,
Now with project IDs revealed,
End users checked, their icons show,
Status mapped for all to know.
With stricter types and plugins new,
This rabbit cheers the work you do! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/workflow-core/src/lib/plugins/external-plugin/api-plugin/api-plugin.ts (1)

100-103: Consider conditional inclusion of projectId in request payload.

The current implementation spreads projectId unconditionally, which could add undefined values to the API request payload. Consider including it only when defined:

-        {
-          ...requestPayload,
-          projectId: this.projectId,
-        },
+        {
+          ...requestPayload,
+          ...(this.projectId && { projectId: this.projectId }),
+        },

This ensures clean API requests without undefined fields.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b8d1a2 and 8cd0821.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (17)
  • apps/backoffice-v2/src/common/components/molecules/ProcessTracker/constants.tsx (2 hunks)
  • apps/backoffice-v2/src/common/components/molecules/ProcessTracker/trackers/ubo-flows/UBOFlowsTracker.tsx (1 hunks)
  • apps/backoffice-v2/src/common/components/molecules/ProcessTracker/trackers/ubo-flows/hooks/useUBOFlowsTrackerItems/helpers/get-end-user-flow-status.ts (1 hunks)
  • apps/backoffice-v2/src/common/components/molecules/ProcessTracker/trackers/ubo-flows/hooks/useUBOFlowsTrackerItems/helpers/get-ubo-flow-status-by-tags.ts (0 hunks)
  • apps/backoffice-v2/src/common/components/molecules/ProcessTracker/trackers/ubo-flows/hooks/useUBOFlowsTrackerItems/useUBOFlowsTrackerItems.ts (1 hunks)
  • apps/backoffice-v2/src/domains/individuals/fetchers.ts (2 hunks)
  • apps/backoffice-v2/src/lib/blocks/hooks/useDocumentBlocks/hooks/useDocuments/useDocuments.ts (1 hunks)
  • packages/ui/src/components/atoms/inputs/Checkbox/Checkbox.tsx (1 hunks)
  • packages/workflow-core/src/lib/create-workflow.ts (2 hunks)
  • packages/workflow-core/src/lib/plugins/external-plugin/api-plugin/api-plugin.ts (3 hunks)
  • packages/workflow-core/src/lib/plugins/external-plugin/types.ts (1 hunks)
  • packages/workflow-core/src/lib/plugins/external-plugin/vendor-consts.ts (1 hunks)
  • packages/workflow-core/src/lib/types.ts (2 hunks)
  • packages/workflow-core/src/lib/workflow-runner.ts (4 hunks)
  • services/workflows-service/prisma/data-migrations (1 hunks)
  • services/workflows-service/src/document/document.service.ts (1 hunks)
  • services/workflows-service/src/workflow/workflow.service.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • apps/backoffice-v2/src/common/components/molecules/ProcessTracker/trackers/ubo-flows/hooks/useUBOFlowsTrackerItems/helpers/get-ubo-flow-status-by-tags.ts
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: test_linux
  • GitHub Check: format
  • GitHub Check: spell_check
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: lint
🔇 Additional comments (23)
packages/ui/src/components/atoms/inputs/Checkbox/Checkbox.tsx (1)

13-13: Cosmetic class order change
Reordering the CSS classes here is purely cosmetic and has no effect on styling or functionality.

services/workflows-service/src/document/document.service.ts (1)

45-48: Group imports from the same module
Consolidating defaultPrismaTransactionOptions and beginTransactionIfNotExistCurry into a single import reduces repetition and improves readability.

services/workflows-service/prisma/data-migrations (1)

1-1: Bump data-migrations submodule commit
The subproject pointer is updated to 493a22283db566fbcd5381e71c6709223950370b. Please verify that all new Prisma migrations in this commit have been reviewed, tested, and are applied in your CI/deployment pipelines.

packages/workflow-core/src/lib/plugins/external-plugin/types.ts (1)

32-32: LGTM! Clean interface extension for project context.

The optional projectId property addition enables API plugins to be project-aware while maintaining backward compatibility.

packages/workflow-core/src/lib/create-workflow.ts (1)

16-16: LGTM! Proper parameter threading for project context.

The projectId parameter is cleanly extracted and passed through to the WorkflowRunner constructor, maintaining the function's structure while enabling project-scoped workflows.

Also applies to: 30-30

packages/workflow-core/src/lib/types.ts (1)

90-90: LGTM! Consistent interface extensions for project support.

Both WorkflowOptions and WorkflowRunnerArgs interfaces are extended with optional projectId properties, ensuring type consistency across the workflow creation pipeline.

Also applies to: 106-106

services/workflows-service/src/workflow/workflow.service.ts (2)

382-382: LGTM! Proper project context propagation in workflow formatting.

The projectId is correctly passed from the workflow object when creating the workflow service instance, ensuring project scope is maintained.


2201-2201: LGTM! Consistent project context in event handling.

The currentProjectId is properly passed when creating the workflow service instance during event processing, maintaining project scope throughout the workflow lifecycle.

packages/workflow-core/src/lib/plugins/external-plugin/vendor-consts.ts (1)

911-911: LGTM - Field mapping addition looks correct.

The addition of workflowRuntimeDataId to the request mapping is consistent with the existing pattern. Note that the field name differs from the source value (workflowRuntimeId) - ensure this naming is intentional for API compatibility.

packages/workflow-core/src/lib/plugins/external-plugin/api-plugin/api-plugin.ts (1)

42-42: LGTM - Property addition follows correct pattern.

The optional projectId property is properly typed and initialized.

packages/workflow-core/src/lib/workflow-runner.ts (4)

93-93: LGTM - Private field follows naming convention.

The private field declaration is consistent with the existing class structure.


117-117: LGTM - Constructor parameter properly typed.

The optional projectId parameter is correctly added to the constructor signature.


142-144: LGTM - Clear initialization with helpful comment.

The initialization is straightforward and the comment provides good context about the projectId's purpose.


223-223: LGTM - ProjectId properly threaded to API plugins.

The projectId is correctly passed to API plugin constructors, completing the integration with the plugin system.

apps/backoffice-v2/src/common/components/molecules/ProcessTracker/trackers/ubo-flows/UBOFlowsTracker.tsx (1)

7-7: ```shell
#!/bin/bash

Locate the definition and usages of useUBOFlowsTrackerItems for verification

rg --no-heading --with-filename --line-number "useUBOFlowsTrackerItems" -A5 -B2


</details>
<details>
<summary>apps/backoffice-v2/src/common/components/molecules/ProcessTracker/constants.tsx (2)</summary>

`12-12`: **LGTM - Proper import of domain constants.**

Good practice importing the status constants from the domain layer to maintain consistency and type safety.

---

`115-120`: **LGTM - Well-structured icon mapping.**

The `endUserFlowStatusToIcon` mapping follows established patterns and provides:
- Logical icon choices for each status
- Proper fallback with DEFAULT
- Consistency with existing Icon constants

</details>
<details>
<summary>apps/backoffice-v2/src/domains/individuals/fetchers.ts (2)</summary>

`19-23`: **LGTM - Excellent type safety improvement.**

The `EndUserIndividualVerificationChecksStatus` constant provides strict typing for verification check statuses, following good domain modeling practices.

---

`39-45`: **LGTM - Proper schema validation with strict literals.**

The updated status field provides excellent type safety by:
- Using `z.literal()` for exact string matching
- Restricting values to only the defined constants
- Making the field optional as appropriate
- Preventing invalid status values at runtime

</details>
<details>
<summary>apps/backoffice-v2/src/common/components/molecules/ProcessTracker/trackers/ubo-flows/hooks/useUBOFlowsTrackerItems/useUBOFlowsTrackerItems.ts (4)</summary>

`9-12`: **LGTM! Clean implementation of the new mapping logic.**

The mapping logic correctly:
- Maps over the new `endUsers` parameter
- Uses `valueOrNA` to safely handle null/undefined names
- Leverages the new `getEndUserFlowStatus` helper for icon determination

The implementation is clean and follows React best practices.

---

`15-15`: **LGTM! Dependency array correctly updated.**

The dependency array properly reflects the new `endUsers` parameter, ensuring the memoized value recomputes when the end users data changes.

---

`6-6`: **Verify all callers use the new function signature.**

The function signature change from `childWorkflows` to `endUsers` looks correct and aligns with the architectural shift to track end user verification statuses.




```shell
#!/bin/bash
# Description: Verify all callers have been updated to use the new signature
# Expected: All usages should pass endUsers instead of childWorkflows

# Search for all usages of useUBOFlowsTrackerItems
rg "useUBOFlowsTrackerItems" -A 2 -B 2

4-4: Verify the helper function exists and is properly implemented.

The new getEndUserFlowStatus helper function is being imported. Please ensure it exists and handles all expected end user verification statuses correctly.

#!/bin/bash
# Description: Verify the getEndUserFlowStatus helper function exists and examine its implementation
# Expected: Function should exist and properly map end user statuses to icons

# Check if the helper function file exists and examine its contents
fd -t f "get-end-user-flow-status" --exec cat {}

# Also search for any references to the old function to ensure complete migration
rg "getUBOFlowStatusByTags" -A 3

.object({
status: z.string(),
status: z
.union([
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.union([
.enum(

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.

3 participants