-
Notifications
You must be signed in to change notification settings - Fork 261
MCC risk indicator redirect to kyb #3459
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
base: dev
Are you sure you want to change the base?
MCC risk indicator redirect to kyb #3459
Conversation
|
WalkthroughThe changes introduce two new optional properties, Changes
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
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
There was a problem hiding this 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
📒 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
andtabLink
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
andtabLink
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
andtabLink
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
andtabLink
from risk indicators is well-implemented using thefind
method.
53-53
: LGTM! Proper validation logic.The validation correctly uses
tabLink
as the primary source with fallback totab
, which aligns with the navigation logic.
56-56
: LGTM! Proper display logic.Using
tabTitle
for display with fallback todomain
is appropriate sincetabTitle
is meant for display purposes.
59-59
: LGTM! Consistent navigation logic.Using
tabLink
for navigation with fallback totab
is appropriate and consistent with the validation logic.
@@ -1 +1 @@ | |||
Subproject commit 7886a698d221e48e4393f6a17e4f24e520a20d77 | |||
Subproject commit 493a22283db566fbcd5381e71c6709223950370b |
There was a problem hiding this comment.
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.
const tab = (() => { | ||
if (tabTitle) { | ||
return camelCase(tabTitle.toLowerCase()); | ||
} | ||
|
||
if (tabEntry) { | ||
return camelCase(tabEntry[0].toLowerCase()); | ||
} | ||
|
||
return camelCase(domainTitle.toLowerCase()); | ||
})(); |
There was a problem hiding this comment.
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.
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.
Summary by CodeRabbit