Skip to content

Conversation

Omri-Levy
Copy link
Contributor

@Omri-Levy Omri-Levy commented Jun 29, 2025

  • feat(*): added tab column for risk rules
  • feat(*): added the ability to decide on tab title, link, and domain separately

Summary by CodeRabbit

  • New Features
    • Added support for optional tab titles and tab links in risk indicators, enhancing flexibility in tab display and navigation within the case overview.
  • Bug Fixes
    • Improved logic for determining and validating the active tab, ensuring more accurate tab selection and display.
  • Chores
    • Updated internal data schema and migration references to support new tab-related properties.

Copy link

changeset-bot bot commented Jun 29, 2025

⚠️ No Changeset found

Latest commit: 7942550

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 Jun 29, 2025

Walkthrough

The changes introduce two new optional properties, tabTitle and tabLink, to risk indicator data structures and schemas across multiple modules. Logic in the case overview component is updated to utilize these fields for determining tab selection and display. Related schema definitions and plugin interfaces are extended to support these properties.

Changes

File(s) Change Summary
apps/backoffice-v2/src/pages/Entity/components/Case/components/CaseOverview/CaseOverview.tsx Enhanced tab selection logic to prioritize tabTitle and tabLink from risk indicators.
packages/common/src/schemas/documents/schemas/risk-evaluation-plugin-schema.ts Added optional tabTitle and tabLink string fields to risk indicator schema.
packages/workflow-core/src/lib/plugins/common-plugin/risk-rules-plugin.ts Populated tabTitle and tabLink properties in risk indicator objects within the plugin.
packages/workflow-core/src/lib/plugins/common-plugin/types.ts Extended risk rule result type to include optional tabTitle and tabLink properties.
services/workflows-service/prisma/data-migrations Updated subproject commit reference.
services/workflows-service/src/rule-engine/risk-rule.service.ts Added 'Tab link' and 'Tab title' to schema and mapped them to output properties.

Sequence Diagram(s)

sequenceDiagram
    participant UI as CaseOverview Component
    participant Plugin as RiskRulesPlugin
    participant Schema as RiskEvaluationPluginSchema

    UI->>Plugin: Request risk indicators
    Plugin->>Schema: Validate and enrich indicators (with tabTitle, tabLink)
    Plugin-->>UI: Return indicators (with tabTitle, tabLink)
    UI->>UI: Determine tab using tabTitle/tabLink fallback logic
    UI-->>UI: Set active tab and display title accordingly
Loading

Poem

In the warren of code, two fields hop in—
tabTitle and tabLink, let the tabs begin!
Schemas and plugins now know their name,
So every bunny tab can find its fame.
With logic refined and structure anew,
This patch brings clarity—hippity-hoo!
🐇✨

✨ 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
Collaborator

@tomer-shvadron tomer-shvadron left a comment

Choose a reason for hiding this comment

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

Remember to update packages

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

📜 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 7942550.

📒 Files selected for processing (6)
  • apps/backoffice-v2/src/pages/Entity/components/Case/components/CaseOverview/CaseOverview.tsx (1 hunks)
  • packages/common/src/schemas/documents/schemas/risk-evaluation-plugin-schema.ts (1 hunks)
  • packages/workflow-core/src/lib/plugins/common-plugin/risk-rules-plugin.ts (1 hunks)
  • packages/workflow-core/src/lib/plugins/common-plugin/types.ts (1 hunks)
  • services/workflows-service/prisma/data-migrations (1 hunks)
  • services/workflows-service/src/rule-engine/risk-rule.service.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`services/workflows-service/**/*.service.ts`: Service implementation files must be placed in feature modules and named with the .service.ts suffix.

services/workflows-service/**/*.service.ts: Service implementation files must be placed in feature modules and named with the .service.ts suffix.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/workflows-service.mdc)

List of files the instruction was applied to:

  • services/workflows-service/src/rule-engine/risk-rule.service.ts
`apps/backoffice-v2/**/*.{ts,tsx}`: Use functional components with TypeScript. I...

apps/backoffice-v2/**/*.{ts,tsx}: Use functional components with TypeScript.
Implement smart/dumb component pattern.
Place components in feature-based directories.
Use compound components for complex UIs.
Follow atomic design principles.
Use React Query for server state and API calls.
Use Context for shared state.
Implement state machines for complex flows.
Use local state for UI-only state.
Follow unidirectional data flow.
Use strict TypeScript configuration.
Define interfaces for all props.
Use discriminated unions for state.
Leverage type inference.
Use Radix UI for accessible components.
Implement proper ARIA attributes.
Follow consistent styling patterns.
Use composition over inheritance.
Keep components small and focused.
Use React Hook Form for forms.
Implement Zod for validation.
Handle form submission states.
Show validation feedback.
Use controlled inputs when needed.
Implement proper loading states for data fetching.
Handle error states gracefully.
Cache responses appropriately.
Type API responses.
Use error boundaries.
Implement fallback UI.
Handle async errors.
Show user-friendly error messages.
Log errors appropriately.
Use React.memo wisely.
Implement proper code splitting.
Use lazy loading for routes.
Optimize re-renders.
Profile performance regularly.
Write unit tests for components.
Use React Testing Library.
Mock external dependencies in tests.
Maintain good test coverage.
Follow feature-based organization.
Use index files for exports.
Keep related files together.
Use consistent naming.
Implement barrel exports.
Use Tailwind CSS for styling.
Follow utility-first approach for styling.
Use CSS variables for theming.
Keep styles maintainable.
Use CSS modules when needed.
Document complex logic.
Write clear component documentation.
Keep documentation up to date.
Use JSDoc when helpful.
Follow ESLint rules.
Use consistent formatting.
Write clear variable names.
Keep functions pure.
Use meaningful types.
Validate user input.
Implement proper authentication.
Handle sensitive data carefully.
Follow security best practices.
Use HTTPS for API calls.
Follow WCAG guidelines for accessibility.
Use semantic HTML.
Test with screen readers.
Ensure keyboard navigation.
Provide proper focus management.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/backoffice-v2.mdc)

List of files the instruction was applied to:

  • apps/backoffice-v2/src/pages/Entity/components/Case/components/CaseOverview/CaseOverview.tsx
🧠 Learnings (2)
services/workflows-service/prisma/data-migrations (2)

undefined

<retrieved_learning>
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/data-migrations.mdc:0-0
Timestamp: 2025-06-24T09:35:54.963Z
Learning: In Ballerine's workflow migration scripts (TypeScript), always establish the relationship between workflow definitions and UI definitions solely through the 'workflowDefinitionId' field in the UiDefinition model; do not create a separate junction table or relation.
</retrieved_learning>

<retrieved_learning>
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/data-migrations.mdc:0-0
Timestamp: 2025-06-24T09:35:54.963Z
Learning: Use consistent naming conventions for related components (workflows, UI definitions, filters) in Ballerine migrations to improve maintainability and clarity.
</retrieved_learning>

apps/backoffice-v2/src/pages/Entity/components/Case/components/CaseOverview/CaseOverview.tsx (1)
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.303Z
Learning: In the apps/backoffice-v2 React TypeScript codebase, always use functional components and TypeScript for all UI components to ensure consistency and type safety.
🧬 Code Graph Analysis (1)
apps/backoffice-v2/src/pages/Entity/components/Case/components/CaseOverview/CaseOverview.tsx (1)
apps/backoffice-v2/src/common/hooks/useSearchParamsByEntity/validation-schemas.ts (1)
  • CaseTabs (40-49)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: test_linux
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: lint
🔇 Additional comments (9)
packages/workflow-core/src/lib/plugins/common-plugin/risk-rules-plugin.ts (1)

46-47: LGTM! Clean addition of new properties.

The addition of tabTitle and tabLink properties to the indicators mapping is well-implemented and consistent with the type definitions.

services/workflows-service/src/rule-engine/risk-rule.service.ts (2)

33-34: LGTM! Proper schema extension.

The addition of optional 'Tab link' and 'Tab title' fields to the schema is correctly implemented as optional properties.


45-46: LGTM! Consistent field mapping.

The transformation correctly maps the new schema fields to the corresponding object properties.

packages/common/src/schemas/documents/schemas/risk-evaluation-plugin-schema.ts (1)

55-56: LGTM! Schema extension is properly implemented.

The addition of optional tabTitle and tabLink properties to the risk indicators schema is consistent with the broader changes.

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

91-92: LGTM! Type definitions are properly updated.

The addition of optional tabTitle and tabLink properties to the action return type ensures type safety and consistency with the implementation.

apps/backoffice-v2/src/pages/Entity/components/Case/components/CaseOverview/CaseOverview.tsx (4)

40-41: LGTM! Clean extraction of new properties.

The extraction of tabTitle and tabLink from risk indicators is well-implemented using the find method.


53-53: LGTM! Proper validation logic.

The validation correctly uses tabLink as the primary source with fallback to tab, which aligns with the navigation logic.


56-56: LGTM! Proper display logic.

Using tabTitle for display with fallback to domain is appropriate since tabTitle is meant for display purposes.


59-59: LGTM! Consistent navigation logic.

Using tabLink for navigation with fallback to tab is appropriate and consistent with the validation logic.

@@ -1 +1 @@
Subproject commit 7886a698d221e48e4393f6a17e4f24e520a20d77
Subproject commit 493a22283db566fbcd5381e71c6709223950370b
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Submodule bump requires migration sanity-check

The change merely advances the data-migrations submodule pointer. Please verify that the new commit actually contains the forward / backward migrations that add tabTitle & tabLink, and that those migrations keep the existing convention of relating UI definitions to workflow definitions solely via workflowDefinitionId (see past guidance).

To surface any missing scripts quickly, you can run:


🏁 Script executed:

#!/bin/bash
# List migration files that introduce the new columns
fd -t f -e sql services/workflows-service/prisma/data-migrations \
  | xargs grep -nE 'tabTitle|tabLink' || true

Length of output: 611


🏁 Script executed:

#!/bin/bash
# Correctly search all .sql files under the data-migrations directory for the new columns
echo "🔍 Migration files containing 'tabTitle' or 'tabLink':"
find services/workflows-service/prisma/data-migrations -type f -name '*.sql' -exec grep -nH -E 'tabTitle|tabLink' {} + || true

# List just the filenames to check forward (up) vs rollback (down) scripts
echo
echo "📄 Filenames introducing 'tabTitle'/'tabLink':"
find services/workflows-service/prisma/data-migrations -type f -name '*.sql' \
  -exec grep -lE 'tabTitle|tabLink' {} + \
  | sed -e 's|^.*/||' \
  | sort

Length of output: 523


Missing migrations for tabTitle & tabLink in data-migrations

No SQL files in services/workflows-service/prisma/data-migrations define or drop the new tabTitle or tabLink columns. Please:

  • Add both forward (up) and rollback (down) scripts that introduce and remove these columns.
  • Ensure the UI definitions remain linked to workflows solely via the workflowDefinitionId field (no junction tables).

To double-check locally, you can run:

find services/workflows-service/prisma/data-migrations -type f -name '*.sql' \
  -exec grep -nH -E 'tabTitle|tabLink' {} +
🤖 Prompt for AI Agents
In services/workflows-service/prisma/data-migrations at the beginning of the
migration files, add new SQL migration scripts that include both forward (up)
and rollback (down) commands to add and remove the tabTitle and tabLink columns
in the relevant table. Make sure these columns are added directly without
creating any junction tables, preserving the existing linkage of UI definitions
to workflows via the workflowDefinitionId field only. Verify the changes by
checking that the new SQL files contain the appropriate ALTER TABLE statements
for these columns.

Comment on lines +42 to +52
const tab = (() => {
if (tabTitle) {
return camelCase(tabTitle.toLowerCase());
}

if (tabEntry) {
return camelCase(tabEntry[0].toLowerCase());
}

return camelCase(domainTitle.toLowerCase());
})();
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Reconsider the priority logic for tab determination.

The current logic prioritizes tabTitle for tab calculation, but tabLink is used for navigation and validation (lines 53, 59). This creates potential inconsistency since tabTitle is meant for display while tabLink is for navigation.

Consider revising the priority order to prioritize tabLink first:

const tab = (() => {
-  if (tabTitle) {
-    return camelCase(tabTitle.toLowerCase());
-  }
+  if (tabLink && CaseTabs.includes(tabLink)) {
+    return tabLink;
+  }

  if (tabEntry) {
    return camelCase(tabEntry[0].toLowerCase());
  }

  return camelCase(domainTitle.toLowerCase());
})();

This ensures consistency between tab calculation and navigation usage.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const tab = (() => {
if (tabTitle) {
return camelCase(tabTitle.toLowerCase());
}
if (tabEntry) {
return camelCase(tabEntry[0].toLowerCase());
}
return camelCase(domainTitle.toLowerCase());
})();
const tab = (() => {
if (tabLink && CaseTabs.includes(tabLink)) {
return tabLink;
}
if (tabEntry) {
return camelCase(tabEntry[0].toLowerCase());
}
return camelCase(domainTitle.toLowerCase());
})();
🤖 Prompt for AI Agents
In
apps/backoffice-v2/src/pages/Entity/components/Case/components/CaseOverview/CaseOverview.tsx
around lines 42 to 52, the tab calculation currently prioritizes tabTitle, which
can cause inconsistency with navigation that uses tabLink. Update the logic to
prioritize tabLink first for tab determination, then fallback to tabTitle and
domainTitle, ensuring consistent tab identification aligned with navigation and
validation.

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.

2 participants