Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo environment #2384

Merged
merged 5 commits into from
May 16, 2024
Merged

Demo environment #2384

merged 5 commits into from
May 16, 2024

Conversation

Omri-Levy
Copy link
Contributor

@Omri-Levy Omri-Levy commented May 15, 2024

User description

Description

Elaborate on the subject, motivation, and context.

Related issues

  • Provide a link to each related issue.

Breaking changes

  • Describe the breaking changes that this pull request introduces.

How these changes were tested

  • Describe the tests that you ran to verify your changes, including devices, operating systems, browsers and versions.

Examples and references

  • Links, screenshots, and other resources related to this change.

Checklist

  • [] I have read the contribution guidelines of this project
  • [] I have read the style guidelines of this project
  • [] I have performed a self-review of my own code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings and errors
  • [] New and existing tests pass locally with my changes

PR Type

enhancement, bug_fix


Description

  • Enhanced the NoAlerts component by adjusting its bottom padding for better layout.
  • Improved error logging in WinstonLogger by including payload data.
  • Added new Prisma transaction types to enhance database transaction handling.
  • Fixed a typo in a TypeScript comment to improve code clarity.
  • Updated project dependencies in pnpm-lock.yaml and package.json to include new packages and adjust TypeScript versions.

Changes walkthrough 📝

Relevant files
Enhancement
NoAlerts.tsx
Adjust bottom padding in NoAlerts component                           

apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/NoAlerts/NoAlerts.tsx

  • Reduced the bottom padding of the NoAlerts component.
+1/-1     
winston-logger.ts
Enhance error logging with payload support                             

services/workflows-service/src/common/utils/winston-logger/winston-logger.ts

  • Refactored the error logging to include a payload.
  • Minor import reordering.
  • +6/-3     
    types.ts
    Define new Prisma transaction types                                           

    services/workflows-service/src/types.ts

    • Added new types for Prisma transaction handling.
    +4/-0     
    pnpm-lock.yaml
    Update dependencies and TypeScript version in lock file   

    pnpm-lock.yaml

  • Added dependencies for '@types/jmespath' and 'jmespath'.
  • Updated TypeScript version in dependencies.
  • +8/-3     
    package.json
    Add new package dependencies                                                         

    services/workflows-service/package.json

    • Added new package dependencies for 'jmespath' and its types.
    +2/-0     
    Bug_fix
    hook-callback-handler.service.ts
    Fix typo in TypeScript comment                                                     

    services/workflows-service/src/workflow/hook-callback-handler.service.ts

    • Corrected a typo in a TypeScript comment.
    +1/-1     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Summary by CodeRabbit

    • Bug Fixes

      • Adjusted padding in the "No Alerts" component to improve layout consistency.
    • New Features

      • Added new dependencies: @types/jmespath and jmespath for enhanced functionality.
    • Improvements

      • Enhanced error logging to include additional payload information for better debugging.
      • Added new types for Prisma transactions to streamline database operations.
      • Improved document update logic to ensure updates only occur when necessary.
    • Code Cleanup

      • Removed unnecessary function calls in the tab-block mapping logic.
      • Minor comment update in the hook callback handler service.

    Copy link

    changeset-bot bot commented May 15, 2024

    ⚠️ No Changeset found

    Latest commit: 45fb9ca

    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

    Copy link
    Contributor

    coderabbitai bot commented May 15, 2024

    Walkthrough

    The recent changes encompass a variety of updates across components and services, focusing on UI adjustments, dependency management, logging enhancements, type additions, and logic refinements. Noteworthy changes include padding adjustments in a React component, introduction of new types and dependencies, logging functionality improvements, and enhancements in conditional checks within mutations. These modifications aim to enhance both the user interface and backend functionality of the project.

    Changes

    File Path Change Summary
    apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/NoAlerts/NoAlerts.tsx Adjusted bottom padding from pb-72 to pb-64.
    services/workflows-service/package.json Added @types/jmespath to dependencies and jmespath to devDependencies.
    services/workflows-service/src/common/utils/winston-logger/winston-logger.ts Modified error method in WinstonLogger to accept and log an additional payload parameter.
    services/workflows-service/src/types.ts Added new types PrismaTransactionMethod and PrismaTransactionClient.
    services/workflows-service/src/workflow/hook-callback-handler.service.ts Removed an unnecessary number 1 after a comment.
    apps/backoffice-v2/src/domains/workflows/hooks/mutations/useUpdateDocumentByIdMutation/... Added a conditional check for oldWorkflow before updating query data.
    apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/... Removed createKycBlocks function call from associated_companies array.
    services/workflows-service/prisma/data-migrations Updated subproject commit hash.

    In code we trust, with changes so grand,
    From padding tweaks to types well-planned.
    Dependencies added, logs now more clear,
    Our project evolves, there's nothing to fear.
    🐇✨


    Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

    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>.
      • Generate unit testing code for this file.
      • 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 generate unit testing code for this file.
      • @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 generate interesting stats about this repository and render them as a table.
      • @coderabbitai show all the console.log statements in this repository.
      • @coderabbitai read src/utils.ts and generate unit testing code.
      • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

    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 as PR comments)

    • @coderabbitai pause to pause the reviews on a PR.
    • @coderabbitai resume to resume the paused reviews.
    • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
    • @coderabbitai resolve resolve all the CodeRabbit review comments.
    • @coderabbitai help to get help.

    Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

    CodeRabbit Configration 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.

    @github-actions github-actions bot added enhancement New feature or request bug_fix labels May 15, 2024
    Copy link
    Contributor

    PR Description updated to latest commit (6381307)

    Copy link
    Contributor

    PR Review 🔍

    ⏱️ Estimated effort to review [1-5]

    3, because the PR includes a variety of changes across multiple files and technologies (TypeScript, Winston logging, Prisma, package management). The changes are not overly complex but require a good understanding of the project structure and the technologies used to ensure they are appropriate and do not introduce bugs.

    🧪 Relevant tests

    No

    ⚡ Possible issues

    Possible Bug: The error handling in winston-logger.ts now includes a payload, but it assumes error can always be treated as an object. This might not be the case if the error is a string.

    🔒 Security concerns

    No

    Code feedback:
    relevant fileservices/workflows-service/src/common/utils/winston-logger/winston-logger.ts
    suggestion      

    Consider checking the type of error before using it as an object in the error method. This ensures that strings or other non-object types do not cause runtime errors. [important]

    relevant linethis.logger.error({

    relevant fileapps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/NoAlerts/NoAlerts.tsx
    suggestion      

    Ensure that the change in padding from pb-72 to pb-64 is reflected correctly across all screen sizes and does not affect the layout negatively on smaller devices. [medium]

    relevant line

    relevant fileservices/workflows-service/src/types.ts
    suggestion      

    Add explicit type definitions for the new Prisma transaction types to ensure they are used correctly throughout the project and to aid in future maintenance. [medium]

    relevant lineexport type PrismaTransactionClient = Parameters[0];

    relevant fileservices/workflows-service/src/workflow/hook-callback-handler.service.ts
    suggestion      

    Verify the removal of the typo in the TypeScript comment does not affect any existing TypeScript suppressions or expected behaviors in error handling. [medium]

    relevant line// @ts-expect-error - we don't validate `context` is an object

    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: 1

    Review Details

    Configuration used: CodeRabbit UI
    Review profile: CHILL

    Commits Files that changed from the base of the PR and between 093245b and 6381307.
    Files ignored due to path filters (1)
    • pnpm-lock.yaml is excluded by !pnpm-lock.yaml
    Files selected for processing (5)
    • apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/NoAlerts/NoAlerts.tsx (1 hunks)
    • services/workflows-service/package.json (2 hunks)
    • services/workflows-service/src/common/utils/winston-logger/winston-logger.ts (2 hunks)
    • services/workflows-service/src/types.ts (1 hunks)
    • services/workflows-service/src/workflow/hook-callback-handler.service.ts (1 hunks)
    Files skipped from review due to trivial changes (3)
    • apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/NoAlerts/NoAlerts.tsx
    • services/workflows-service/src/types.ts
    • services/workflows-service/src/workflow/hook-callback-handler.service.ts
    Additional comments not posted (2)
    services/workflows-service/package.json (2)

    119-119: Added @types/jmespath dependency for TypeScript type definitions.


    144-144: Added jmespath dependency for querying JSON data.

    Copy link
    Contributor

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible bug
    Validate the context object before use to prevent runtime errors

    Ensure the context object is properly validated before accessing its properties to avoid
    potential runtime errors.

    services/workflows-service/src/workflow/hook-callback-handler.service.ts [291]

    -// @ts-expect-error - we don't validate `context` is an object
    -context.entity.id || context.entity.ballerineEntityId,
    +if (typeof context === 'object' && context.entity) {
    +  context.entity.id || context.entity.ballerineEntityId,
    +} else {
    +  // Handle error or default case
    +}
     
    Suggestion importance[1-10]: 9

    Why: This suggestion addresses a potential source of runtime errors by recommending validation of the context object. It's crucial for preventing crashes or unexpected behavior.

    9
    Enhancement
    Include error stack traces in logs for better debugging

    Enhance error logging by including a stack trace if the error object is available. This
    will help in debugging by providing more detailed error information.

    services/workflows-service/src/common/utils/winston-logger/winston-logger.ts [64-66]

     this.logger.error({
    -  message: error,
    +  message: error instanceof Error ? error.message : error,
    +  stack: error instanceof Error ? error.stack : undefined,
       payload,
     });
     
    Suggestion importance[1-10]: 8

    Why: Including stack traces in error logs is a significant improvement for debugging. The suggestion correctly enhances the functionality of error logging.

    8
    Maintain consistent padding for visual consistency

    Consider maintaining consistent padding in the bottom of the container. The padding-bottom
    was reduced from 72 to 64, which might affect the visual layout consistency across similar
    components.

    apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/NoAlerts/NoAlerts.tsx [6]

    -<div className="flex items-center justify-center p-4 pb-64">
    +<div className="flex items-center justify-center p-4 pb-72">
     
    Suggestion importance[1-10]: 7

    Why: The suggestion correctly identifies a change in padding that could affect visual consistency. It's a valid point for UI consistency, though not a major functionality issue.

    7
    Maintainability
    Add explicit return types to new type definitions for clarity

    Consider adding explicit return types to the newly added type definitions to ensure they
    are clear and maintainable.

    services/workflows-service/src/types.ts [44-46]

    -export type PrismaTransactionMethod = Parameters<PrismaClient['$transaction']>[0];
    -export type PrismaTransactionClient = Parameters<PrismaTransactionMethod>[0];
    +export type PrismaTransactionMethod = (params: PrismaSessionParams) => Promise<PrismaSessionResult>;
    +export type PrismaTransactionClient = PrismaClient;
     
    Suggestion importance[1-10]: 6

    Why: Adding explicit return types improves code clarity and maintainability. However, the suggestion does not match the existing types accurately, which affects its applicability.

    6

    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: 0

    Review Details

    Configuration used: CodeRabbit UI
    Review profile: CHILL

    Commits Files that changed from the base of the PR and between 6381307 and 53ff7b7.
    Files selected for processing (2)
    • services/workflows-service/prisma/data-migrations (1 hunks)
    • services/workflows-service/src/common/utils/winston-logger/winston-logger.ts (1 hunks)
    Files skipped from review due to trivial changes (1)
    • services/workflows-service/prisma/data-migrations
    Files skipped from review as they are similar to previous changes (1)
    • services/workflows-service/src/common/utils/winston-logger/winston-logger.ts

    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: 1

    Out of diff range and nitpick comments (2)
    apps/backoffice-v2/src/domains/workflows/hooks/mutations/useUpdateDocumentByIdMutation/useUpdateDocumentByIdMutation.tsx (1)

    Line range hint 47-58: Consider adding type safety for oldWorkflow.context.documents.

    To improve type safety and maintainability, consider adding type annotations for oldWorkflow.context.documents.

    documents: oldWorkflow.context.documents.map((doc: { id: string } & Record<string, unknown>) => {
      if (doc.id === documentId) {
        return { ...doc, ...document };
      }
      return doc;
    }),
    apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-tabs-block-map.tsx (1)

    Line range hint 34-34: Fix the typo in the import path.

    There is a typo in the import path for createAssociatedCompanyDocumentBlocks.

    - import { createAssociatedCompanyDocumentBlocks } from '@/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/create-assosiacted-company-document-blocks';
    + import { createAssociatedCompanyDocumentBlocks } from '@/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/create-associated-company-document-blocks';
    Review Details

    Configuration used: CodeRabbit UI
    Review profile: CHILL

    Commits Files that changed from the base of the PR and between 53ff7b7 and f9da095.
    Files selected for processing (3)
    • apps/backoffice-v2/src/domains/workflows/hooks/mutations/useUpdateDocumentByIdMutation/useUpdateDocumentByIdMutation.tsx (2 hunks)
    • apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-tabs-block-map.tsx (1 hunks)
    • services/workflows-service/prisma/data-migrations (1 hunks)
    Files skipped from review as they are similar to previous changes (1)
    • services/workflows-service/prisma/data-migrations
    Additional comments not posted (6)
    apps/backoffice-v2/src/domains/workflows/hooks/mutations/useUpdateDocumentByIdMutation/useUpdateDocumentByIdMutation.tsx (2)

    Line range hint 1-1: Ensure proper import of dependencies.

    Verify that all imported modules are correctly installed and used in the project.


    56-56: Ensure the updated document retains all necessary properties.

    Verify that the updated document retains all necessary properties from the original document to avoid data loss.

    apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-tabs-block-map.tsx (4)

    Line range hint 1-1: Ensure proper import of dependencies.

    Verify that all imported modules are correctly installed and used in the project.


    Line range hint 64-64: Ensure processTrackerBlock is correctly handled.

    Verify that processTrackerBlock is correctly handled when workflow?.workflowDefinition?.config?.isCaseOverviewEnabled is false.


    Line range hint 84-84: Ensure createAssociatedCompanyDocumentBlocks handles workflow and blocksCreationParams correctly.

    Verify that createAssociatedCompanyDocumentBlocks correctly handles the workflow and blocksCreationParams parameters.


    Line range hint 94-94: Ensure createKycBlocks handles workflow correctly.

    Verify that createKycBlocks correctly handles the workflow parameter.

    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: 0

    Review Details

    Configuration used: CodeRabbit UI
    Review profile: CHILL

    Commits Files that changed from the base of the PR and between f9da095 and 85debeb.
    Files ignored due to path filters (1)
    • pnpm-lock.yaml is excluded by !pnpm-lock.yaml
    Files selected for processing (1)
    • services/workflows-service/prisma/data-migrations (1 hunks)
    Files skipped from review as they are similar to previous changes (1)
    • services/workflows-service/prisma/data-migrations

    @Omri-Levy Omri-Levy enabled auto-merge (squash) May 16, 2024 09:04
    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: 0

    Review Details

    Configuration used: CodeRabbit UI
    Review profile: CHILL

    Commits Files that changed from the base of the PR and between 85debeb and 45fb9ca.
    Files selected for processing (1)
    • services/workflows-service/src/common/utils/winston-logger/winston-logger.ts (1 hunks)
    Files skipped from review as they are similar to previous changes (1)
    • services/workflows-service/src/common/utils/winston-logger/winston-logger.ts

    @Omri-Levy Omri-Levy merged commit 2779f04 into dev May 16, 2024
    9 checks passed
    @Omri-Levy Omri-Levy deleted the omri-levy/refactor/move-prisma-type branch May 16, 2024 09:09
    @Omri-Levy Omri-Levy mentioned this pull request Nov 4, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants