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

fix(cms): getOrganizations endpoint - Lower include depth to 4 #15848

Merged
merged 2 commits into from
Sep 2, 2024

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Sep 2, 2024

getOrganizations endpoint - Lower include depth to 4

What

  • Contentful response max size limit was reached when calling this endpoint, the depth used to be 10 but there is no need to have it that high of a number so lowering it to 4 will help with lowering the response size from contentful

Summary by CodeRabbit

  • New Features
    • Adjusted content retrieval settings to optimize the depth of related entries fetched from the Contentful API, enhancing data relevance and performance.

@RunarVestmann RunarVestmann added the automerge Merge this PR as soon as all checks pass label Sep 2, 2024
@RunarVestmann RunarVestmann requested review from a team as code owners September 2, 2024 14:47
Copy link
Contributor

coderabbitai bot commented Sep 2, 2024

Walkthrough

The change involves modifying the include parameter in the CmsContentfulService class from 10 to 4. This adjustment alters the depth of nested content retrieved from the Contentful API, affecting the related entries included in the response while maintaining the overall structure of the parameters object.

Changes

Files Change Summary
libs/cms/src/lib/cms.contentful.service.ts Changed the include parameter value from 10 to 4 in the CmsContentfulService class.

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

Tip

Early access features: enabled

We are currently testing the following features in early access:

  • Anthropic claude-3-5-sonnet for code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues on the discussion post.

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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 856e993 and f68361e.

Files selected for processing (1)
  • libs/cms/src/lib/cms.contentful.service.ts (1 hunks)
Additional context used
Path-based instructions (1)
libs/cms/src/lib/cms.contentful.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Additional comments not posted (1)
libs/cms/src/lib/cms.contentful.service.ts (1)

156-156: Optimization: Reduced include depth for organizations.

The include parameter has been reduced from 10 to 4, which should decrease the response size and potentially improve performance when fetching organizations.

This change aligns with the PR objective of lowering the include depth to 4 to mitigate the issue of exceeding the maximum size limit for responses from Contentful. However, we should verify that this change doesn't break any existing functionality that relies on deeply nested data. Run the following script to check for any usage of deeply nested organization data:

If the script returns any results, we may need to adjust those parts of the codebase to accommodate this change.

Verification successful

Verification Successful: No deeply nested organization data access found.

The reduction of the include parameter from 10 to 4 does not affect any existing functionality, as there are no instances of accessing organization data beyond four levels deep in the codebase. This change aligns with the PR objectives and optimizes the response size without breaking functionality.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of deeply nested organization data
# Test: Search for access to organization fields beyond 4 levels deep
rg --type typescript "organization\.(([^.]+\.){5,})" -g '!**/cms.contentful.service.ts'

Length of output: 124


Script:

#!/bin/bash
# Description: Check for usage of deeply nested organization data
# Test: Search for access to organization fields beyond 4 levels deep
rg --type ts "organization\.(([^.]+\.){5,})" -g '!**/cms.contentful.service.ts'

Length of output: 81

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.94%. Comparing base (a8fee4b) to head (07b87c6).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #15848   +/-   ##
=======================================
  Coverage   36.94%   36.94%           
=======================================
  Files        6680     6680           
  Lines      136459   136459           
  Branches    38745    38745           
=======================================
  Hits        50409    50409           
  Misses      86050    86050           
Flag Coverage Δ
api 3.39% <ø> (ø)
api-domains-communications 40.62% <ø> (ø)
application-system-api 41.75% <ø> (ø)
application-template-api-modules 23.64% <ø> (-0.04%) ⬇️
cms 0.43% <ø> (ø)
cms-translations 39.78% <ø> (ø)
judicial-system-api 18.26% <ø> (ø)
judicial-system-backend 56.20% <ø> (ø)
services-user-notification 47.75% <ø> (ø)

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

Files with missing lines Coverage Δ
libs/cms/src/lib/cms.contentful.service.ts 11.73% <ø> (ø)

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 a8fee4b...07b87c6. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

All test runs fb88500 🔗

9 Total Test Services: 0 Failed, 8 Passed
➡️ Test Sessions change in coverage: 25 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 2.7s 1 no change Link
api-domains-communications 0 0 0 5 0 30.52s 1 no change Link
api-domains-license-service 0 0 0 0 0 583.14ms 1 no change Link
application-system-api 0 0 0 111 2 3m 12.75s 1 no change Link
application-template-api-modules 0 0 0 109 0 1m 42.19s 1 no change Link
cms-translations 0 0 0 3 0 27.96s 1 no change Link
judicial-system-api 0 0 0 54 0 6.29s 1 no change Link
judicial-system-backend 0 0 0 19846 0 17m 46.43s 1 no change Link
services-user-notification 0 0 0 51 0 1m 30.86s 1 no change Link

@kodiakhq kodiakhq bot merged commit f7dc690 into main Sep 2, 2024
55 checks passed
@kodiakhq kodiakhq bot deleted the fix/cms-get-organizations-endpoint branch September 2, 2024 15:39
jonnigs pushed a commit that referenced this pull request Sep 12, 2024
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants