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

feat(ids-api): Add feature flag for general mandate delegation type. #16182

Merged
merged 4 commits into from
Sep 27, 2024

Conversation

valurefugl
Copy link
Member

@valurefugl valurefugl commented Sep 27, 2024

...

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:

  • 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

    • Introduced a feature flag for general mandate delegation, enabling conditional fetching of available mandates based on the feature's status.
    • Added a new enumeration value for general mandate delegation in the feature flags.
  • Bug Fixes

    • Improved control flow to ensure fetching of general mandates only occurs when the feature is enabled.

@valurefugl valurefugl requested review from a team as code owners September 27, 2024 07:40
Copy link
Contributor

coderabbitai bot commented Sep 27, 2024

Walkthrough

The changes involve the introduction of a feature flag for controlling the fetching of general mandates in the DelegationsIncomingService class. A new enumeration value is added to the Features enum to represent the feature flag. This ensures that the fetching of general mandates occurs only when the feature is enabled.

Changes

Files Change Summary
libs/auth-api-lib/src/lib/delegations/delegations-incoming.service.ts Modified logic to fetch available general mandates based on a feature flag check.
libs/feature-flags/src/lib/features.ts Added new enum value isGeneralMandateDelegationEnabled to represent the feature flag for general mandates.

Possibly related PRs

Suggested reviewers

  • GunnlaugurG

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.

@valurefugl valurefugl added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Sep 27, 2024
@valurefugl valurefugl changed the title Add feature flag for general mandate delegation type. feat(ids-api): Add feature flag for general mandate delegation type. Sep 27, 2024
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 (3)
libs/feature-flags/src/lib/features.ts (2)

110-112: LGTM! Consider adding a comment for clarity.

The new feature flag isGeneralMandateDelegationEnabled is well-named and consistently placed within the enum. To improve maintainability, consider adding a brief comment explaining the purpose of this flag, similar to comments for other flags in the enum.

You could add a comment like this:

// Enable general mandate delegation type
isGeneralMandateDelegationEnabled = 'isGeneralMandateDelegationEnabled',

Line range hint 1-112: Consider enhancing consistency and maintainability of the Features enum.

While the overall structure of the enum is good, there are a few areas where consistency and maintainability could be improved:

  1. Comments: Consider adding brief comments for all flags, not just some. This would enhance maintainability and make the purpose of each flag clear.

  2. Naming Convention: There's a mix of camelCase (e.g., userProfileClaims) and lowercase (e.g., testing) naming. Consider standardizing to camelCase for all flags to improve readability and consistency.

  3. Grouping: The logical grouping is good, but consider adding comment headers for each group to make the structure even clearer.

Here's an example of how you could improve a section:

// Application visibility flags
exampleApplication = 'isExampleApplicationEnabled',
accidentNotification = 'isAccidentNotificationEnabled',
europeanHealthInsuranceCard = 'isEuropeanHealthInsuranceCardApplicationEnabled',
// ... other flags ...

// Service portal modules
servicePortalPetitionsModule = 'isServicePortalPetitionsModuleEnabled',
servicePortalConsentModule = 'isServicePortalConsentModuleEnabled',
// ... other service portal flags ...

// Delegation types
isLegalRepresentativeDelegationEnabled = 'isLegalRepresentativeDelegationEnabled',
isGeneralMandateDelegationEnabled = 'isGeneralMandateDelegationEnabled',
libs/auth-api-lib/src/lib/delegations/delegations-incoming.service.ts (1)

192-206: Fix indentation for consistency

The indentation of this new code block seems to be inconsistent with the rest of the file. Please adjust the indentation to match the surrounding code for better readability and maintainability.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 55d69bb and f0f1842.

📒 Files selected for processing (2)
  • libs/auth-api-lib/src/lib/delegations/delegations-incoming.service.ts (1 hunks)
  • libs/feature-flags/src/lib/features.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
libs/auth-api-lib/src/lib/delegations/delegations-incoming.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."
libs/feature-flags/src/lib/features.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 (3)
libs/feature-flags/src/lib/features.ts (1)

Line range hint 1-112: Excellent adherence to coding guidelines for libs/**/* files.

The code in this file:

  1. Uses TypeScript for defining the Features enum.
  2. Exports the enum, ensuring reusability across different NextJS apps.
  3. Supports effective tree-shaking and bundling with its structure.

These aspects align well with the specified coding guidelines for files in the libs directory.

libs/auth-api-lib/src/lib/delegations/delegations-incoming.service.ts (2)

192-206: LGTM with suggested improvements

The implementation of the feature flag for general mandate delegation aligns well with the PR objectives and follows good TypeScript practices. The changes enhance the control flow by adding a conditional check based on the feature flag, ensuring that the fetching of general mandates only occurs when the feature is enabled.

Please consider the suggested improvements regarding the default feature flag value, indentation, and code structure. These changes will further enhance the code's readability and maintainability.


192-197: Consider the default value for the feature flag

The default value for the isGeneralMandateDelegationEnabled feature flag is set to true. For a new feature, it's often safer to default to false and explicitly enable it when ready. Please review if this default value aligns with your rollout strategy.

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.70%. Comparing base (5efe4fd) to head (f358462).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16182   +/-   ##
=======================================
  Coverage   36.70%   36.70%           
=======================================
  Files        6776     6776           
  Lines      139595   139598    +3     
  Branches    39682    39683    +1     
=======================================
+ Hits        51237    51242    +5     
+ Misses      88358    88356    -2     
Flag Coverage Δ
air-discount-scheme-backend 54.11% <100.00%> (+0.01%) ⬆️
air-discount-scheme-web 0.00% <ø> (ø)
api 3.39% <ø> (ø)
api-domains-air-discount-scheme 36.88% <100.00%> (+0.03%) ⬆️
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 48.77% <ø> (ø)
api-domains-communications 39.99% <100.00%> (+<0.01%) ⬆️
api-domains-criminal-record 47.81% <100.00%> (+0.03%) ⬆️
api-domains-driving-license 44.33% <100.00%> (+0.01%) ⬆️
api-domains-education 31.36% <100.00%> (+0.03%) ⬆️
api-domains-health-insurance 34.63% <100.00%> (+0.04%) ⬆️
api-domains-mortgage-certificate 35.67% <100.00%> (+0.02%) ⬆️
api-domains-payment-schedule 41.17% <100.00%> (+0.02%) ⬆️
application-api-files 57.62% <100.00%> (+0.02%) ⬆️
application-core 70.88% <ø> (-0.42%) ⬇️
application-system-api 41.63% <100.00%> (+<0.01%) ⬆️
application-template-api-modules 23.70% <100.00%> (+<0.01%) ⬆️
application-templates-accident-notification 22.14% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.63% <ø> (ø)
application-templates-driving-license 18.63% <ø> (ø)
application-templates-estate 12.34% <ø> (ø)
application-templates-example-payment 25.41% <ø> (ø)
application-templates-financial-aid 14.34% <ø> (ø)
application-templates-general-petition 23.68% <ø> (ø)
application-templates-health-insurance 26.62% <ø> (ø)
application-templates-inheritance-report 6.45% <ø> (ø)
application-templates-marriage-conditions 15.23% <ø> (ø)
application-templates-mortgage-certificate 43.96% <ø> (ø)
application-templates-parental-leave 30.15% <ø> (ø)
application-types 6.71% <ø> (ø)
application-ui-components 1.28% <ø> (ø)
application-ui-shell 21.29% <ø> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.61% <100.00%> (+0.04%) ⬆️
clients-driving-license-book 43.88% <100.00%> (+0.02%) ⬆️
clients-financial-statements-inao 49.13% <100.00%> (+0.03%) ⬆️
clients-license-client 1.83% <ø> (ø)
clients-regulations 42.58% <100.00%> (+0.04%) ⬆️
clients-rsk-company-registry 29.76% <ø> (ø)
clients-rsk-personal-tax-return 38.00% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.64% <100.00%> (+0.02%) ⬆️
cms 0.43% <ø> (ø)
cms-translations 39.11% <100.00%> (+<0.01%) ⬆️
dokobit-signing 62.94% <100.00%> (+0.08%) ⬆️
download-service 44.61% <100.00%> (+0.01%) ⬆️
email-service 60.73% <100.00%> (+0.08%) ⬆️
feature-flags 90.76% <100.00%> (+0.07%) ⬆️
file-storage 53.13% <100.00%> (+0.11%) ⬆️
financial-aid-backend 56.53% <100.00%> (+0.01%) ⬆️
judicial-system-api 18.46% <ø> (ø)
judicial-system-audit-trail 68.86% <100.00%> (+0.08%) ⬆️
judicial-system-backend 54.84% <100.00%> (+<0.01%) ⬆️
judicial-system-message 66.92% <100.00%> (+0.06%) ⬆️
judicial-system-message-handler 47.80% <100.00%> (+0.09%) ⬆️
judicial-system-scheduler 69.09% <100.00%> (+0.02%) ⬆️
judicial-system-web 28.16% <ø> (ø)
license-api 42.51% <100.00%> (+0.01%) ⬆️
nest-config 78.13% <100.00%> (+0.06%) ⬆️
nest-feature-flags 51.97% <100.00%> (+0.06%) ⬆️
nova-sms 62.28% <100.00%> (+0.09%) ⬆️
portals-admin-regulations-admin 1.93% <ø> (ø)
portals-core 16.17% <ø> (ø)
services-auth-admin-api 51.95% <25.00%> (-0.02%) ⬇️
services-auth-delegation-api 57.92% <25.00%> (-0.01%) ⬇️
services-auth-ids-api 51.86% <100.00%> (+0.01%) ⬆️
services-auth-personal-representative 45.50% <25.00%> (-0.01%) ⬇️
services-auth-personal-representative-public 41.57% <25.00%> (-0.02%) ⬇️
services-auth-public-api 49.24% <100.00%> (+0.03%) ⬆️
services-endorsements-api 55.11% <100.00%> (+0.01%) ⬆️
services-sessions 65.77% <100.00%> (-0.04%) ⬇️
services-university-gateway 48.52% <100.00%> (-0.02%) ⬇️
services-user-notification 47.15% <100.00%> (+<0.01%) ⬆️
services-user-profile 62.29% <100.00%> (+0.10%) ⬆️
web 1.83% <ø> (ø)

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

Files with missing lines Coverage Δ
...rc/lib/delegations/delegations-incoming.service.ts 97.58% <100.00%> (+0.03%) ⬆️
libs/feature-flags/src/lib/features.ts 100.00% <100.00%> (ø)

... and 2 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 5efe4fd...f358462. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Sep 27, 2024

Datadog Report

All test runs 55cf5c2 🔗

70 Total Test Services: 0 Failed, 68 Passed
🔻 Test Sessions change in coverage: 2 decreased, 27 increased, 171 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 28.06s N/A Link
air-discount-scheme-web 0 0 0 2 0 8.79s N/A Link
api 0 0 0 4 0 2.66s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 19.15s N/A Link
api-domains-assets 0 0 0 3 0 11.97s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 12.52s N/A Link
api-domains-communications 0 0 0 5 0 27.46s N/A Link
api-domains-criminal-record 0 0 0 5 0 8.76s 1 increased (+0.04%) Link
api-domains-driving-license 0 0 0 23 0 28.37s N/A Link
api-domains-education 0 0 0 8 0 19.34s 1 increased (+0.03%) Link

🔻 Code Coverage Decreases vs Default Branch (2)

  • services-auth-delegation-api - jest 51.26% (-0.19%) - Details
  • application-templates-parental-leave - jest 35.31% (-0.1%) - Details

Copy link
Member

@saevarma saevarma left a comment

Choose a reason for hiding this comment

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

🚀

@kodiakhq kodiakhq bot merged commit a8b2817 into main Sep 27, 2024
197 checks passed
@kodiakhq kodiakhq bot deleted the ids-api/add-gen-mand-feature-flag branch September 27, 2024 11:48
thoreyjona pushed a commit that referenced this pull request Oct 2, 2024
…16182)

* Add feature flag for general mandate delegation type.

* Flip featureFlagService.getValue to be default false

---------

Co-authored-by: Sævar Már Atlason <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Nov 14, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants