Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@munkhsaikhan
Copy link
Collaborator

@munkhsaikhan munkhsaikhan commented Sep 8, 2025

Summary by Sourcery

Make field cleaning operations asynchronous and improve error handling, while removing leftover debug logging

Enhancements:

  • Convert Fields.clean and Fields.cleanMulti to return Promises and update call sites to await their results
  • Replace silent console logging in field cleaning error handling with thrown errors to propagate failures

Chores:

  • Remove debugging console.log statements from product import and customer model modules

Important

Remove console logs and update clean functions to return promises for consistency in imports.ts, Customers.ts, and Fields.ts.

  • Logging:
    • Remove console.log statements from imports.ts and Customers.ts.
  • Functions:
    • Change clean() and cleanMulti() in Fields.ts to return promises for consistency in asynchronous handling.
    • Update loadFieldClass to use await with clean() in Fields.ts.

This description was created by Ellipsis for 0472c43. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability and consistency when processing custom field data, especially for grouped fields.
    • Validation errors are now surfaced clearly instead of being silently ignored, reducing hidden data issues.
  • Chores

    • Removed debug logging to reduce console noise and improve performance slightly.

Gerelsukh and others added 27 commits May 29, 2025 00:16
* chore: syncloanspolaris improved

* chore: validator added on loans and savings

* refactor: refactor code

* refactor: refactor code

* refactor: refactor code
* chore: syncloanspolaris improved

* chore: validator added on loans and savings

* refactor: refactor code

* refactor: refactor code

* refactor: refactor code

* feat: savings transaction first commit

* feat: savings transaction sync commit2

* feat: income deposit added

* refactor: refactor code

* refactor: refactor code

* refactor: refactor code

* refactor: refactor code

* chore: create loan with polaris date

* feat: loan give transactin added

* refactor: refactor code

* chore: peyment transaction add

* feat: saving & deposit income add

* feat: deposit and loans some imrpvement
@sourcery-ai
Copy link

sourcery-ai bot commented Sep 8, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Converted field cleaning methods to asynchronous Promises with proper awaiting and error propagation, and removed debug logging in product import and Customers modules.

Sequence diagram for asynchronous field cleaning and error propagation

sequenceDiagram
participant "Caller (e.g. Customer or Product Import)"
participant "Fields Model"

"Caller (e.g. Customer or Product Import)"->>"Fields Model": await clean(_id, value)
alt Success
    "Fields Model"-->>"Caller (e.g. Customer or Product Import)": cleaned value (Promise resolved)
else Error
    "Fields Model"-->>"Caller (e.g. Customer or Product Import)": throw Error (Promise rejected)
end
Loading

File-Level Changes

Change Details Files
Make clean and cleanMulti asynchronous
  • update interface signatures to return Promise types
  • modify method implementations to return Promise
  • add await when invoking clean in loops
packages/core/src/db/models/Fields.ts
Improve error handling in prepareCustomFieldsData
  • replace console.log and continue with throwing errors
  • propagate cleaning errors instead of silent skips
packages/core/src/db/models/Fields.ts
Remove debug logging from product import module
  • remove console.log({ docs })
  • remove console.log({ properties })
  • remove console.log({ bulkDoc })
packages/core/src/data/modules/product/imports.ts
Remove debug logging around customFieldsData in Customers model
  • remove console.log before cleaning customFieldsData
  • remove console.log after cleaning customFieldsData
packages/core/src/db/models/Customers.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link

coderabbitai bot commented Sep 8, 2025

Caution

Review failed

The pull request is closed.


πŸ“œ Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 1269d6b and 0472c43.

πŸ“’ Files selected for processing (3)
  • packages/core/src/data/modules/product/imports.ts (0 hunks)
  • packages/core/src/db/models/Customers.ts (0 hunks)
  • packages/core/src/db/models/Fields.ts (3 hunks)
✨ Finishing Touches
  • πŸ“ Generate Docstrings
πŸ§ͺ Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch staging

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • The result of await this.clean isn’t assigned back to fieldValue, so the cleaning has no effectβ€”make sure to reassign the cleaned value.
  • Switching from logging and continue to throwing on clean errors changes semanticsβ€”confirm if you really want to block on the first clean failure.
  • Rethrowing with new Error(e.message) loses the original stack; consider rethrowing or wrapping the original error to preserve context.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The result of await this.clean isn’t assigned back to fieldValue, so the cleaning has no effectβ€”make sure to reassign the cleaned value.
- Switching from logging and continue to throwing on clean errors changes semanticsβ€”confirm if you really want to block on the first clean failure.
- Rethrowing with new Error(e.message) loses the original stack; consider rethrowing or wrapping the original error to preserve context.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click πŸ‘ or πŸ‘Ž on each comment and I'll use the feedback to improve your reviews.

@munkhsaikhan munkhsaikhan merged commit 4750c2c into master Sep 8, 2025
7 of 9 checks passed
@munkhsaikhan munkhsaikhan deleted the staging branch September 8, 2025 10:22
@munkhsaikhan munkhsaikhan restored the staging branch September 8, 2025 10:23
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! πŸ‘

Reviewed everything up to 0472c43 in 1 minute and 31 seconds. Click for details.
  • Reviewed 81 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with πŸ‘ or πŸ‘Ž to teach Ellipsis.
1. packages/core/src/data/modules/product/imports.ts:72
  • Draft comment:
    Possible typo: the code pushes to 'doc.customFieldsData' but then passes 'doc.customFieldData' (singular) to prepareCustomFieldsData. Likely should use 'doc.customFieldsData'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. packages/core/src/db/models/Fields.ts:267
  • Draft comment:
    Added 'await' before this.clean(key, value) ensures async execution. Confirm that sequential awaits (vs parallel) are intentional for performance.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
3. packages/core/src/db/models/Fields.ts:470
  • Draft comment:
    Replacing the log-and-continue with a thrown error in the cleanup of custom fields changes error handling. Confirm that aborting on a clean failure is intended.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_eqFjzVaCo9Ert6jt

You can customize Ellipsis by changing your verbosity settings, reacting with πŸ‘ or πŸ‘Ž, replying to comments, or adding code review rules.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 8, 2025

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.

5 participants