-
Notifications
You must be signed in to change notification settings - Fork 62
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(services-endorsement-system): Disable caching #16223
Conversation
This reverts commit 0811d75.
WalkthroughThe changes involve the modification of GraphQL decorators in various classes related to endorsements within the endorsement system. Specifically, the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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
Documentation and Community
|
Datadog ReportBranch report: ✅ 0 Failed, 4 Passed, 0 Skipped, 3.09s Total Time |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16223 +/- ##
==========================================
- Coverage 36.92% 36.86% -0.06%
==========================================
Files 6781 6787 +6
Lines 140009 139895 -114
Branches 39810 39788 -22
==========================================
- Hits 51703 51579 -124
- Misses 88306 88316 +10
Flags with carried forward coverage won't be shown. Click here to find out more. see 42 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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: 0
🧹 Outside diff range and nitpick comments (4)
libs/api/domains/endorsement-system/src/lib/dto/paginatedEndorsement.response.ts (1)
11-12
: Approved: Caching consistently removedThe change from
@CacheField
to@Field
for thepageInfo
property is consistent with the previous modification and further supports the PR objective of disabling caching. This change maintains the GraphQL schema definition while removing caching behavior.While removing caching aligns with the current objectives, consider monitoring the performance impact of this change. If you notice increased load times or server stress, you might want to explore alternative caching strategies or implement client-side caching mechanisms in the future to balance responsiveness and data freshness.
libs/api/domains/endorsement-system/src/lib/dto/paginatedEndorsementList.response.ts (1)
Line range hint
1-14
: Summary: Caching disabled as intended, consider performance implicationsThe changes in this file successfully remove caching from the
PaginatedEndorsementListResponse
class by replacing@CacheField
with@Field
decorators. This aligns with the PR objective of disabling caching to improve user experience.Key points:
- The code maintains type safety and GraphQL compatibility.
- It adheres to the coding guidelines for files in the
libs
directory.- The changes may impact query performance, especially for large datasets.
To ensure a smooth transition:
- Implement comprehensive performance monitoring for affected queries.
- Consider adding caching at a different layer (e.g., API gateway or CDN) if performance degradation is observed.
- Update any documentation or comments that may reference the now-removed caching behavior.
libs/api/domains/endorsement-system/src/lib/models/endorsementList.model.ts (1)
25-29
: Consider monitoring performance impact of disabled cachingThe removal of caching for both
tags
andmeta
properties aligns well with the PR objective of improving user experience by ensuring up-to-date data. This change should resolve issues related to stale data in the frontend. However, it's important to monitor the performance impact of this change, as it may lead to increased data fetching.Suggestions:
- Implement performance monitoring to track any changes in response times or server load.
- Consider implementing a more granular caching strategy in the future if performance issues arise, such as time-based cache invalidation or selective caching based on data volatility.
These changes adhere to the coding guidelines for the
libs
directory, maintaining reusability and proper TypeScript usage.libs/api/domains/endorsement-system/src/lib/endorsementSystem.resolver.ts (1)
Line range hint
47-239
: Monitor performance impact after removing cache control annotationsThe removal of cache control annotations from the resolver methods may lead to increased load on backend services due to more frequent client requests. Please monitor the system's performance to ensure it meets user experience expectations, and consider implementing alternative caching strategies if necessary.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (6)
- libs/api/domains/endorsement-system/src/lib/dto/paginatedEndorsement.response.ts (1 hunks)
- libs/api/domains/endorsement-system/src/lib/dto/paginatedEndorsementList.response.ts (1 hunks)
- libs/api/domains/endorsement-system/src/lib/endorsementSystem.resolver.ts (16 hunks)
- libs/api/domains/endorsement-system/src/lib/models/endorsement.model.ts (1 hunks)
- libs/api/domains/endorsement-system/src/lib/models/endorsementList.model.ts (1 hunks)
- libs/api/domains/endorsement-system/src/lib/models/endorsementListOpen.model.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
libs/api/domains/endorsement-system/src/lib/dto/paginatedEndorsement.response.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."
libs/api/domains/endorsement-system/src/lib/dto/paginatedEndorsementList.response.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."
libs/api/domains/endorsement-system/src/lib/endorsementSystem.resolver.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."
libs/api/domains/endorsement-system/src/lib/models/endorsement.model.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."
libs/api/domains/endorsement-system/src/lib/models/endorsementList.model.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."
libs/api/domains/endorsement-system/src/lib/models/endorsementListOpen.model.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 (10)
libs/api/domains/endorsement-system/src/lib/dto/paginatedEndorsement.response.ts (2)
Line range hint
1-14
: Summary: Caching successfully disabled for PaginatedEndorsementResponseThe changes in this file consistently remove caching from the
PaginatedEndorsementResponse
class by replacing@CacheField
with@Field
decorators. These modifications align well with the PR objective of disabling caching to improve user experience.Key points:
- The code maintains type safety and proper GraphQL schema definitions.
- The changes adhere to the coding guidelines for files in the
libs
directory.- The modifications preserve the reusability of the component across different NextJS apps.
To ensure the impact of these changes is fully understood, please run the following script to check for any GraphQL schema changes:
#!/bin/bash # Description: Check for GraphQL schema changes related to PaginatedEndorsementResponse # Test: Search for PaginatedEndorsementResponse in GraphQL schema files rg --type graphql 'PaginatedEndorsementResponse' libs/api/domains/endorsement-systemThis will help verify if there are any unexpected changes to the GraphQL schema as a result of removing caching.
9-10
: Approved: Caching removed as intendedThe change from
@CacheField
to@Field
for thedata
property aligns with the PR objective of disabling caching. This modification maintains the GraphQL schema definition while removing the caching behavior, which should contribute to improving the user experience as intended.To ensure this change is consistent across the codebase, please run the following script:
This will help verify that caching has been consistently disabled throughout the endorsement system.
libs/api/domains/endorsement-system/src/lib/dto/paginatedEndorsementList.response.ts (2)
9-9
: LGTM. Consider monitoring query performance.The change from
@CacheField
to@Field
aligns with the PR objective of disabling caching. This modification maintains the correct type definition for GraphQL while removing the caching behavior.To ensure this change doesn't negatively impact performance, consider monitoring query response times. You may want to run the following command to check for other instances of
@CacheField
that might need similar updates:#!/bin/bash # Search for remaining @CacheField decorators rg --type typescript '@CacheField' libs/
11-11
: LGTM. Ensure comprehensive testing of pagination.The change from
@CacheField
to@Field
for thepageInfo
property is consistent with the previous modification and aligns with the PR objective of disabling caching.To ensure this change doesn't introduce any regression in pagination functionality, consider running the following command to identify and review pagination-related tests:
Additionally, manually verify that pagination still works correctly in the UI, especially for large datasets where the impact of removing caching might be more noticeable.
✅ Verification successful
Pagination-related tests verified.
The change from
@CacheField
to@Field
has been validated against existing pagination-related tests.
apps/services/sessions/src/app/sessions/sessions.controller.spec.ts
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for pagination-related tests rg --type typescript 'describe.*pagination|test.*pagination' libs/ src/Length of output: 169
Script:
#!/bin/bash # Search for pagination-related tests in TypeScript files rg -g "*.ts" -g "*.tsx" 'describe.*pagination|test.*pagination' libs/ src/Length of output: 121
Script:
#!/bin/bash # Search for pagination-related tests in TypeScript files across the entire repository rg -g "*.ts" -g "*.tsx" 'describe.*pagination|test.*pagination'Length of output: 190
libs/api/domains/endorsement-system/src/lib/models/endorsement.model.ts (2)
19-20
: LGTM! Verify GraphQL schema impact.The replacement of
@CacheField
with@Field
for themeta
property is consistent with the PR objective of disabling caching. The TypeScript usage is maintained, preserving the non-nullable nature of the property.To ensure the change doesn't unexpectedly alter the GraphQL schema, please run the following script to compare the old and new schemas:
#!/bin/bash # Description: Compare old and new GraphQL schemas # Note: Adjust the paths if necessary # Generate the new schema npm run generate-schema > new_schema.graphql # Compare with the old schema (assuming it's stored in a file called old_schema.graphql) diff old_schema.graphql new_schema.graphql
16-17
: LGTM! Verify frontend compatibility.The replacement of
@CacheField
with@Field
aligns with the PR objective of disabling caching. The TypeScript usage is maintained, and thenullable: true
option is correctly applied for the optional property.Please ensure that the frontend is updated to handle potentially null
endorsementList
values. Run the following script to check for frontend usage:libs/api/domains/endorsement-system/src/lib/models/endorsementListOpen.model.ts (1)
15-16
: LGTM! Caching disabled as intended.The change from
@CacheField
to@Field
aligns with the PR objective of disabling caching to improve user experience. The TypeScript usage and class structure adhere to the coding guidelines for libs directory.To ensure this change doesn't introduce any unintended consequences, please run the following script to check for any remaining
@CacheField
usage in the endorsement system:Also, consider verifying the impact of this change on the frontend, especially regarding data fetching and display performance.
libs/api/domains/endorsement-system/src/lib/models/endorsementList.model.ts (2)
25-26
: Approved: Caching removed from tags propertyThe replacement of
@CacheField
with@Field(() => [EndorsementListTagsEnum])
aligns with the PR objective of disabling caching. This change should improve the responsiveness of the application by ensuring that the latest tag data is always fetched. The use of TypeScript for defining the property type is maintained, adhering to the coding guidelines.
28-29
: Approved: Caching removed from meta propertyThe replacement of
@CacheField
with@Field(() => graphqlTypeJson)
for themeta
property is in line with the PR objective of disabling caching. This change ensures that the latest metadata is always retrieved, potentially improving the user experience. The use ofgraphqlTypeJson
allows for flexible JSON structures in the GraphQL schema, which is beneficial for handling diverse metadata.libs/api/domains/endorsement-system/src/lib/endorsementSystem.resolver.ts (1)
Line range hint
107-129
: Verify public access to general petition endpointsThe methods
endorsementSystemGetGeneralPetitionLists
,endorsementSystemGetGeneralPetitionList
, andendorsementSystemGetGeneralPetitionEndorsements
are annotated with@BypassAuth()
, allowing unauthenticated access. Please confirm that exposing these endpoints publicly is intentional and does not expose sensitive data.Run the following script to identify all resolver methods with
@BypassAuth()
:
caching in frontend is causing suboptimal UX - removing caching
Attach a link to issue if relevant
What
Specify what you're trying to achieve
Why
Specify why you need to achieve this
Screenshots / Gifs
Attach Screenshots / Gifs to help reviewers understand the scope of the pull request
Checklist:
Summary by CodeRabbit
New Features
Improvements
Bug Fixes