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

refactor(j-s): Transition Side Effects #16660

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gudjong
Copy link
Member

@gudjong gudjong commented Oct 30, 2024

Transition Side Effects

Rannsaka villur í R-málum

What

  • Moves transition side effects from controllers to the case state machine.

Why

  • Cleaner code.

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Copy link
Contributor

coderabbitai bot commented Oct 30, 2024

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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>, please review it.
    • 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 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 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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

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.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 30, 2024

Datadog Report

Branch report: j-s/refactor-transition-side-effects
Commit report: 71144e6
Test service: judicial-system-backend

❌ 46 Failed (0 Known Flaky), 21101 Passed, 0 Skipped, 16m 4.68s Total Time
🔻 Test Sessions change in coverage: 1 decreased (-0.06%)

❌ Failed Tests (46)

This report shows up to 5 failed tests.

  • CaseController - Transition APPEAL ACCEPTED case transitioning from undefined to APPEALED appeal state ADMISSION_TO_FACILITY case should send notifications to queue when case is appealed - apps/judicial-system/backend/src/app/modules/case/test/caseController/transition.spec.ts - Details

    Expand for error
     expect(jest.fn()).toHaveBeenCalledWith(...expected)
     
     Expected: [{"caseId": "1068f1bc-9181-40c8-832b-f06d85015e82", "elementId": "780704e1-1589-4114-b711-3bfb17a77ea2", "type": "DELIVERY_TO_COURT_CASE_FILE", "user": {"canConfirmIndictment": false, "id": "964d56ea-dda2-4026-920a-90c72fb61485"}}, {"caseId": "1068f1bc-9181-40c8-832b-f06d85015e82", "elementId": "ebeaa696-968f-4e03-b7e9-ea4d11d4a38d", "type": "DELIVERY_TO_COURT_CASE_FILE", "user": {"canConfirmIndictment": false, "id": "964d56ea-dda2-4026-920a-90c72fb61485"}}, {"caseId": "1068f1bc-9181-40c8-832b-f06d85015e82", "elementId": "1db0c27d-5293-4652-b280-323bc8d83659", "type": "DELIVERY_TO_COURT_CASE_FILE", "user": {"canConfirmIndictment": false, "id": "964d56ea-dda2-4026-920a-90c72fb61485"}}, {"body": {"type": "APPEAL_TO_COURT_OF_APPEALS"}, "caseId": "1068f1bc-9181-40c8-832b-f06d85015e82", "type": "NOTIFICATION", "user": {"canConfirmIndictment": false, "id": "964d56ea-dda2-4026-920a-90c72fb61485"}}]
     
     Number of calls: 0
    
  • CaseController - Transition APPEAL ACCEPTED case transitioning from undefined to APPEALED appeal state ADMISSION_TO_FACILITY case should transition the case - apps/judicial-system/backend/src/app/modules/case/test/caseController/transition.spec.ts - Details

    Expand for error
     expect(jest.fn()).toHaveBeenCalledWith(...expected)
     
     Expected: {"appealReceivedByCourtDate": undefined, "appealRulingDecision": undefined, "appealState": "APPEALED", "prosecutorPostponedAppealDate": 2216-08-26T03:48:17.544Z}, {"transaction": {}, "where": {"id": "1068f1bc-9181-40c8-832b-f06d85015e82"}}
     
     Number of calls: 0
    
  • CaseController - Transition APPEAL ACCEPTED case transitioning from undefined to APPEALED appeal state AUTOPSY case should send notifications to queue when case is appealed - apps/judicial-system/backend/src/app/modules/case/test/caseController/transition.spec.ts - Details

    Expand for error
     expect(jest.fn()).toHaveBeenCalledWith(...expected)
     
     Expected: [{"caseId": "dbe293ff-d281-47a6-bde3-0a95896df9a6", "elementId": "209e2125-8ae6-43d2-8a14-d39b751285fe", "type": "DELIVERY_TO_COURT_CASE_FILE", "user": {"canConfirmIndictment": false, "id": "964d56ea-dda2-4026-920a-90c72fb61485"}}, {"caseId": "dbe293ff-d281-47a6-bde3-0a95896df9a6", "elementId": "d6450872-094a-4bf7-9766-ed090cd9cfee", "type": "DELIVERY_TO_COURT_CASE_FILE", "user": {"canConfirmIndictment": false, "id": "964d56ea-dda2-4026-920a-90c72fb61485"}}, {"caseId": "dbe293ff-d281-47a6-bde3-0a95896df9a6", "elementId": "cdfee7b8-59f3-4d30-b6b5-25a94d3c591b", "type": "DELIVERY_TO_COURT_CASE_FILE", "user": {"canConfirmIndictment": false, "id": "964d56ea-dda2-4026-920a-90c72fb61485"}}, {"body": {"type": "APPEAL_TO_COURT_OF_APPEALS"}, "caseId": "dbe293ff-d281-47a6-bde3-0a95896df9a6", "type": "NOTIFICATION", "user": {"canConfirmIndictment": false, "id": "964d56ea-dda2-4026-920a-90c72fb61485"}}]
     
     Number of calls: 0
    
  • CaseController - Transition APPEAL ACCEPTED case transitioning from undefined to APPEALED appeal state AUTOPSY case should transition the case - apps/judicial-system/backend/src/app/modules/case/test/caseController/transition.spec.ts - Details

    Expand for error
     expect(jest.fn()).toHaveBeenCalledWith(...expected)
     
     Expected: {"appealReceivedByCourtDate": undefined, "appealRulingDecision": undefined, "appealState": "APPEALED", "prosecutorPostponedAppealDate": 2216-08-26T03:48:17.544Z}, {"transaction": {}, "where": {"id": "dbe293ff-d281-47a6-bde3-0a95896df9a6"}}
     
     Number of calls: 0
    
  • CaseController - Transition APPEAL ACCEPTED case transitioning from undefined to APPEALED appeal state BANKING_SECRECY_WAIVER case should send notifications to queue when case is appealed - apps/judicial-system/backend/src/app/modules/case/test/caseController/transition.spec.ts - Details

    Expand for error
     expect(jest.fn()).toHaveBeenCalledWith(...expected)
     
     Expected: [{"caseId": "618353be-e1bc-42d8-9fdf-5aa874f2e394", "elementId": "623ea4c5-8b8f-40e7-8824-352b366f075b", "type": "DELIVERY_TO_COURT_CASE_FILE", "user": {"canConfirmIndictment": false, "id": "964d56ea-dda2-4026-920a-90c72fb61485"}}, {"caseId": "618353be-e1bc-42d8-9fdf-5aa874f2e394", "elementId": "1143bd61-d964-41e8-94cb-53515c71bb78", "type": "DELIVERY_TO_COURT_CASE_FILE", "user": {"canConfirmIndictment": false, "id": "964d56ea-dda2-4026-920a-90c72fb61485"}}, {"caseId": "618353be-e1bc-42d8-9fdf-5aa874f2e394", "elementId": "beebc563-368a-4203-834d-aa55b0599242", "type": "DELIVERY_TO_COURT_CASE_FILE", "user": {"canConfirmIndictment": false, "id": "964d56ea-dda2-4026-920a-90c72fb61485"}}, {"body": {"type": "APPEAL_TO_COURT_OF_APPEALS"}, "caseId": "618353be-e1bc-42d8-9fdf-5aa874f2e394", "type": "NOTIFICATION", "user": {"canConfirmIndictment": false, "id": "964d56ea-dda2-4026-920a-90c72fb61485"}}]
     
     Number of calls: 0
    

🔻 Code Coverage Decreases vs Default Branch (1)

Copy link

codecov bot commented Oct 30, 2024

Codecov Report

Attention: Patch coverage is 97.95918% with 1 line in your changes missing coverage. Please review.

Project coverage is 36.71%. Comparing base (0947e07) to head (cfae29f).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...m/backend/src/app/modules/case/state/case.state.ts 97.91% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16660   +/-   ##
=======================================
  Coverage   36.71%   36.71%           
=======================================
  Files        6858     6858           
  Lines      142638   142652   +14     
  Branches    40639    40635    -4     
=======================================
+ Hits        52365    52377   +12     
- Misses      90273    90275    +2     
Flag Coverage Δ
judicial-system-backend 55.35% <97.95%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...em/backend/src/app/modules/case/case.controller.ts 83.67% <100.00%> (-0.75%) ⬇️
...ystem/backend/src/app/modules/case/case.service.ts 90.40% <ø> (ø)
...c/app/modules/case/limitedAccessCase.controller.ts 97.61% <ø> (ø)
...m/backend/src/app/modules/case/state/case.state.ts 97.29% <97.91%> (+0.23%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0947e07...cfae29f. Read the comment docs.

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.

1 participant