Skip to content

switch datasourcing #12825

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

Merged
merged 3 commits into from
Jun 24, 2025
Merged

switch datasourcing #12825

merged 3 commits into from
Jun 24, 2025

Conversation

guillim
Copy link
Contributor

@guillim guillim commented Jun 24, 2025

This PR improves error handling in handleDriverException by adding a duck-typing check for MessageImportDriverException objects. It ensures that errors are correctly identified and processed even if they are received as plain objects rather than class instances. This change prevents missed exception handling and increases the robustness of the message import process.

@guillim guillim requested a review from charlesBochet June 24, 2025 12:59
@guillim guillim self-assigned this Jun 24, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Major architectural shift from TypeORM repository pattern to direct SQL queries via WorkspaceDataSourceService across messaging and calendar modules.

  • Database queries in messaging-message-list-fetch.cron.job.ts and calendar-events-import.cron.job.ts now use string interpolation in SQL queries, introducing potential SQL injection vulnerabilities that need to be addressed
  • Removal of type safety provided by TypeORM's repository pattern in all modified cron jobs requires additional validation and error handling
  • All cron jobs (messaging-messages-import.cron.job.ts and others) have simplified database access but lack proper parameterization in SQL queries
  • Need for comprehensive testing of the new data sourcing mechanism, especially around concurrent workspace access patterns

4 files reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

Comment on lines 55 to 57
const schemaName = this.workspaceDataSourceService.getSchemaName(
activeWorkspace.id,
'calendarChannel',
);
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Inconsistent indentation in method call (4 spaces instead of 2)

Suggested change
const schemaName = this.workspaceDataSourceService.getSchemaName(
activeWorkspace.id,
'calendarChannel',
);
const schemaName = this.workspaceDataSourceService.getSchemaName(
activeWorkspace.id,
);

Copy link
Contributor

github-actions bot commented Jun 24, 2025

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:35271

This environment will automatically shut down when the PR is closed or after 5 hours.

@charlesBochet charlesBochet merged commit 7a9ec55 into main Jun 24, 2025
40 of 42 checks passed
@charlesBochet charlesBochet deleted the cron-datasource branch June 24, 2025 13:32
Copy link

sentry-io bot commented Jun 25, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

Did you find this useful? React with a 👍 or 👎

abdulrahmancodes pushed a commit to abdulrahmancodes/twenty that referenced this pull request Jun 26, 2025
This PR improves error handling in `handleDriverException` by adding a
duck-typing check for `MessageImportDriverException` objects. It ensures
that errors are correctly identified and processed even if they are
received as plain objects rather than class instances. This change
prevents missed exception handling and increases the robustness of the
message import process.
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