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(efs): Set up for separate feature flag #15974

Merged
merged 3 commits into from
Sep 13, 2024
Merged

fix(efs): Set up for separate feature flag #15974

merged 3 commits into from
Sep 13, 2024

Conversation

albinagu
Copy link
Member

@albinagu albinagu commented Sep 12, 2024

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

Summary by CodeRabbit

  • New Features

    • Enhanced form configurability with dynamic enabling/disabling of estate and prepaid inheritance options based on user permissions.
    • Added tooltips for better user guidance on application types under development.
  • Improvements

    • Introduced a mechanism for retrieving and managing feature flags, allowing the form to adapt based on current configurations.
    • Added contextual messages to improve user interface clarity regarding application statuses.
  • Deprecations

    • Removed the deprecated feature flag related to the inheritance report application.

@albinagu albinagu requested review from a team as code owners September 12, 2024 13:44
Copy link
Contributor

coderabbitai bot commented Sep 12, 2024

Walkthrough

The changes involve modifications to the inheritance report application's form handling and feature flag management. The getForm function in prerequisites.ts has been updated to include two new boolean parameters for controlling application options. Additionally, a new file, getApplicationFeatureFlags.ts, has been introduced to manage feature flags related to the application. The InheritanceReportTemplate.ts file has been adjusted to utilize these feature flags, enhancing the application's configurability. Finally, a specific feature flag has been removed from the Features enum, indicating a potential deprecation of related functionality.

Changes

File Path Change Summary
libs/application/templates/inheritance-report/src/forms/prerequisites.ts Modified getForm to accept allowEstateApplication and allowPrepaidApplication parameters for dynamic control of application options.
libs/application/templates/inheritance-report/src/lib/InheritanceReportTemplate.ts Updated form loader to accept featureFlagClient for asynchronous retrieval of feature flags, removing direct feature flag handling from the template.
libs/application/templates/inheritance-report/src/lib/getApplicationFeatureFlags.ts Introduced a new file for retrieving feature flags, including an enum for AllowEstateApplication and AllowPrepaidApplication, and an async function for fetching their values.
libs/application/templates/inheritance-report/src/lib/messages.ts Added a new tooltip message for the estate inheritance option to provide contextual information about application availability.
libs/feature-flags/src/lib/features.ts Removed inheritanceReport feature flag from the Features enum, indicating deprecation of related functionality.

Possibly related PRs

  • feat(id-card): updates to application #15870: The changes in this PR involve modifications to application logic that may relate to the handling of feature flags and conditional rendering in forms, similar to the dynamic handling of application options in the main PR.
  • fix(nafnskirteini): small string updates #15957: This PR includes significant modifications to how applicant data is processed, which may relate to the changes in the main PR that enhance the configurability of forms based on new parameters.

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.

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

Outside diff range and nitpick comments (1)
libs/application/templates/inheritance-report/src/lib/getApplicationFeatureFlags.ts (1)

22-33: Add type annotations for the accumulator and return value of the reduce function.

To improve the readability and maintainability of the code, consider adding type annotations for the accumulator and return value of the reduce function.

  ).reduce(
    (
-     acc,
+     acc: Record<InheritanceReportFeatureFlags, boolean>,
      { key, value }: { key: InheritanceReportFeatureFlags; value: boolean },
-   ) => {
+   ): Record<InheritanceReportFeatureFlags, boolean> => {
      return Object.assign(acc, { [key]: value })
    },
    {} as Record<InheritanceReportFeatureFlags, boolean>,
  )
Tools
Biome

[error] 28-28: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 754cc56 and 40ca5e0.

Files selected for processing (4)
  • libs/application/templates/inheritance-report/src/forms/prerequisites.ts (2 hunks)
  • libs/application/templates/inheritance-report/src/lib/InheritanceReportTemplate.ts (2 hunks)
  • libs/application/templates/inheritance-report/src/lib/getApplicationFeatureFlags.ts (1 hunks)
  • libs/feature-flags/src/lib/features.ts (0 hunks)
Files not reviewed due to no reviewable changes (1)
  • libs/feature-flags/src/lib/features.ts
Additional context used
Path-based instructions (3)
libs/application/templates/inheritance-report/src/lib/getApplicationFeatureFlags.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/application/templates/inheritance-report/src/forms/prerequisites.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/application/templates/inheritance-report/src/lib/InheritanceReportTemplate.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."
Biome
libs/application/templates/inheritance-report/src/lib/getApplicationFeatureFlags.ts

[error] 28-28: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

Additional comments not posted (4)
libs/application/templates/inheritance-report/src/lib/getApplicationFeatureFlags.ts (1)

1-34: Well-structured code with good practices!

The code follows good practices such as:

  • Using enums for feature flags.
  • Using async/await for handling promises.
  • Using Promise.all and map to fetch the values in parallel.

Keep up the good work!

Tools
Biome

[error] 28-28: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

libs/application/templates/inheritance-report/src/forms/prerequisites.ts (1)

12-15: LGTM!

The changes to the getForm function enhance its configurability by allowing dynamic control over enabling/disabling application types based on the provided boolean flags. The code changes are logically correct, and the implementation is accurate. The tooltip provides useful information to the user about the estate inheritance option being in development.

Additionally, the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining the new function parameters.
  • Effective tree-shaking and bundling practices.

Also applies to: 40-42, 47-47

libs/application/templates/inheritance-report/src/lib/InheritanceReportTemplate.ts (2)

29-33: LGTM!

The imports are correctly used to enable dynamic feature flag handling within the application.


70-88: LGTM!

The changes to the formLoader function enable the form to adapt its behavior based on the feature flags, enhancing the application's flexibility. The code is correctly implemented.

Copy link
Member

@baering baering left a comment

Choose a reason for hiding this comment

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

Core file LGTM.

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Project coverage is 36.85%. Comparing base (b484a25) to head (6b875ba).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...tance-report/src/lib/getApplicationFeatureFlags.ts 0.00% 8 Missing ⚠️
...ates/inheritance-report/src/forms/prerequisites.ts 0.00% 3 Missing ⚠️
...itance-report/src/lib/InheritanceReportTemplate.ts 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #15974   +/-   ##
=======================================
  Coverage   36.85%   36.85%           
=======================================
  Files        6717     6718    +1     
  Lines      137683   137688    +5     
  Branches    39141    39140    -1     
=======================================
+ Hits        50741    50744    +3     
- Misses      86942    86944    +2     
Flag Coverage Δ
air-discount-scheme-backend 54.07% <ø> (-0.02%) ⬇️
air-discount-scheme-web 0.00% <ø> (ø)
api 3.39% <ø> (ø)
api-domains-air-discount-scheme 36.85% <ø> (-0.04%) ⬇️
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 49.89% <ø> (ø)
api-domains-communications 40.42% <ø> (-0.01%) ⬇️
api-domains-criminal-record 47.77% <ø> (-0.04%) ⬇️
api-domains-driving-license 44.27% <ø> (-0.02%) ⬇️
api-domains-education 31.22% <ø> (-0.04%) ⬇️
api-domains-health-insurance 34.58% <ø> (-0.05%) ⬇️
api-domains-mortgage-certificate 35.73% <ø> (-0.03%) ⬇️
api-domains-payment-schedule 41.14% <ø> (-0.03%) ⬇️
application-system-api 41.67% <ø> (-0.01%) ⬇️
application-templates-accident-notification 22.26% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.96% <ø> (ø)
application-templates-driving-license 18.75% <ø> (ø)
application-templates-estate 12.55% <ø> (ø)
application-templates-example-payment 25.72% <ø> (ø)
application-templates-financial-aid 14.39% <ø> (ø)
application-templates-general-petition 23.95% <ø> (ø)
application-templates-health-insurance 26.88% <ø> (ø)
application-templates-inheritance-report 6.45% <0.00%> (-0.03%) ⬇️
application-templates-marriage-conditions 15.35% <ø> (ø)
application-templates-mortgage-certificate 44.15% <ø> (ø)
application-templates-parental-leave 29.31% <ø> (ø)
application-types 6.74% <ø> (ø)
application-ui-components 1.52% <ø> (ø)
application-ui-shell 21.75% <ø> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.56% <ø> (-0.05%) ⬇️
clients-driving-license-book 43.85% <ø> (-0.03%) ⬇️
clients-financial-statements-inao 49.10% <ø> (-0.04%) ⬇️
clients-license-client 1.83% <ø> (ø)
clients-regulations 42.54% <ø> (-0.05%) ⬇️
clients-rsk-company-registry 29.76% <ø> (ø)
clients-rsk-personal-tax-return 38.00% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.75% <ø> (-0.03%) ⬇️
cms 0.42% <ø> (ø)
cms-translations 39.57% <ø> (-0.01%) ⬇️
dokobit-signing 62.85% <ø> (-0.09%) ⬇️
download-service 44.55% <ø> (-0.02%) ⬇️
email-service 60.65% <ø> (-0.09%) ⬇️
feature-flags 90.69% <ø> (-0.08%) ⬇️
file-storage 53.01% <ø> (-0.12%) ⬇️
financial-aid-backend 56.52% <ø> (-0.02%) ⬇️
judicial-system-api 19.35% <ø> (ø)
judicial-system-audit-trail 68.53% <ø> (-0.09%) ⬇️
judicial-system-backend 55.72% <ø> (-0.01%) ⬇️
judicial-system-message 66.79% <ø> (-0.07%) ⬇️
judicial-system-message-handler 47.61% <ø> (-0.10%) ⬇️
judicial-system-scheduler 68.98% <ø> (-0.03%) ⬇️
license-api 42.91% <ø> (-0.02%) ⬇️
nest-config 78.07% <ø> (-0.07%) ⬇️
nest-feature-flags 51.91% <ø> (-0.07%) ⬇️
nova-sms 62.18% <ø> (-0.10%) ⬇️
portals-admin-regulations-admin 1.96% <ø> (ø)
portals-core 16.14% <ø> (ø)
services-auth-admin-api 52.83% <ø> (-0.01%) ⬇️
services-auth-delegation-api 61.31% <ø> (-0.01%) ⬇️
services-auth-ids-api 54.05% <ø> (+<0.01%) ⬆️
services-auth-personal-representative 47.98% <ø> (-0.01%) ⬇️
services-auth-personal-representative-public 43.90% <ø> (-0.01%) ⬇️
services-auth-public-api 51.81% <ø> (-0.01%) ⬇️
services-endorsements-api 54.98% <ø> (-0.02%) ⬇️
services-sessions 65.79% <ø> (-0.02%) ⬇️
services-university-gateway 48.42% <ø> (-0.02%) ⬇️
services-user-notification 47.61% <ø> (+0.02%) ⬆️
services-user-profile 62.25% <ø> (-0.01%) ⬇️
web 1.85% <ø> (ø)

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

Files with missing lines Coverage Δ
...n/templates/inheritance-report/src/lib/messages.ts 100.00% <ø> (ø)
libs/feature-flags/src/lib/features.ts 100.00% <ø> (ø)
...ates/inheritance-report/src/forms/prerequisites.ts 0.00% <0.00%> (ø)
...itance-report/src/lib/InheritanceReportTemplate.ts 0.00% <0.00%> (ø)
...tance-report/src/lib/getApplicationFeatureFlags.ts 0.00% <0.00%> (ø)

... and 3 files 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 b484a25...6b875ba. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Sep 12, 2024

Datadog Report

All test runs e60e77a 🔗

70 Total Test Services: 0 Failed, 68 Passed
🔻 Test Sessions change in coverage: 21 decreased, 179 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 81 0 35.68s N/A Link
air-discount-scheme-web 0 0 0 2 0 8.81s N/A Link
api 0 0 0 4 0 2.75s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 17.88s N/A Link
api-domains-assets 0 0 0 3 0 11.43s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 12.91s N/A Link
api-domains-communications 0 0 0 5 0 31.22s N/A Link
api-domains-criminal-record 0 0 0 5 0 9.62s 1 decreased (-0.04%) Link
api-domains-driving-license 0 0 0 23 0 32.43s N/A Link
api-domains-education 0 0 0 8 0 22.24s 1 decreased (-0.03%) Link

🔻 Code Coverage Decreases vs Default Branch (21)

This report shows up to 5 code coverage decreases.

  • file-storage - jest 56.58% (-0.12%) - Details
  • judicial-system-message-handler - jest 50.79% (-0.1%) - Details
  • nova-sms - jest 64.81% (-0.1%) - Details
  • email-service - jest 62.69% (-0.09%) - Details
  • dokobit-signing - jest 65.61% (-0.09%) - Details

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

Outside diff range and nitpick comments (1)
libs/application/templates/inheritance-report/src/lib/messages.ts (1)

64-68: Approve the message addition. Consider adding a description.

The new message preDataCollectionApplicationForDefaultTooltip provides useful contextual information to the user. The message ID and default text are appropriate.

However, please consider adding a description for this message to improve maintainability and make it easier for other developers to understand its purpose.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 40ca5e0 and 2948945.

Files selected for processing (2)
  • libs/application/templates/inheritance-report/src/forms/prerequisites.ts (2 hunks)
  • libs/application/templates/inheritance-report/src/lib/messages.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • libs/application/templates/inheritance-report/src/forms/prerequisites.ts
Additional context used
Path-based instructions (1)
libs/application/templates/inheritance-report/src/lib/messages.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."

@albinagu albinagu added the automerge Merge this PR as soon as all checks pass label Sep 13, 2024
@kodiakhq kodiakhq bot merged commit 7651100 into main Sep 13, 2024
196 of 197 checks passed
@kodiakhq kodiakhq bot deleted the efs_separate_ff branch September 13, 2024 10:28
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.

3 participants