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(new-primary-school): Add mms frigg api scopes to clients api #17267

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

helgifr
Copy link
Member

@helgifr helgifr commented Dec 17, 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 method to add specific API scopes for clients, enhancing authorization capabilities.

@helgifr helgifr requested review from a team as code owners December 17, 2024 10:14
Copy link
Contributor

coderabbitai bot commented Dec 17, 2024

Walkthrough

The pull request introduces a new seeder file in the authentication API library that adds specific scopes to a client. The file defines an up function that uses the addScopesToClient function to assign the '@mms.is/frigg' scope to the '@island.is/clients/api' client. This change appears to be part of configuring API access and permissions for a specific client within the authentication system.

Changes

File Change Summary
libs/auth-api-lib/seeders/data/add-mms-frigg-api-scopes-to-clients-api.ts Added new seeder function up to add '@mms.is/frigg' scope to '@island.is/clients/api' client

Sequence Diagram

sequenceDiagram
    participant Seeder
    participant AuthSystem
    participant Client

    Seeder->>AuthSystem: addScopesToClient()
    AuthSystem->>Client: Assign '@mms.is/frigg' scope
    AuthSystem-->>Seeder: Scope assignment complete
Loading

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@helgifr helgifr added deploy-feature Deploys features to dev automerge Merge this PR as soon as all checks pass labels Dec 17, 2024
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 35.72%. Comparing base (d472db7) to head (807e5fb).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17267      +/-   ##
==========================================
- Coverage   35.73%   35.72%   -0.01%     
==========================================
  Files        6941     6939       -2     
  Lines      148407   148374      -33     
  Branches    42340    42331       -9     
==========================================
- Hits        53037    53011      -26     
+ Misses      95370    95363       -7     
Flag Coverage Δ
air-discount-scheme-web 0.00% <ø> (ø)
api 3.33% <ø> (ø)
api-domains-auth-admin 48.49% <ø> (ø)
application-api-files 61.87% <ø> (ø)
application-core 75.78% <ø> (ø)
application-system-api 38.75% <ø> (+<0.01%) ⬆️
application-template-api-modules 27.83% <ø> (ø)
application-templates-accident-notification 28.82% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 25.77% <ø> (ø)
application-templates-driving-license 18.16% <ø> (ø)
application-templates-estate 13.76% <ø> (ø)
application-templates-example-payment 24.72% <ø> (ø)
application-templates-financial-aid 14.46% <ø> (ø)
application-templates-general-petition 23.15% <ø> (ø)
application-templates-inheritance-report 6.59% <ø> (ø)
application-templates-marriage-conditions 15.19% <ø> (ø)
application-templates-mortgage-certificate 43.64% <ø> (ø)
application-templates-parental-leave 30.01% <ø> (+0.07%) ⬆️
application-types 6.51% <ø> (ø)
application-ui-components 1.22% <ø> (ø)
application-ui-shell 22.46% <ø> (ø)
clients-charge-fjs-v2 28.35% <ø> (ø)
services-auth-admin-api 52.55% <ø> (ø)
services-auth-delegation-api 58.53% <ø> (ø)
services-auth-ids-api 52.57% <ø> (+0.01%) ⬆️
services-auth-public-api 49.40% <ø> (ø)
services-user-notification 46.54% <ø> (ø)
services-user-profile 56.94% <ø> (ø)
web 2.41% <ø> (ø)

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

see 9 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 d472db7...807e5fb. Read the comment docs.

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

🧹 Nitpick comments (1)
libs/auth-api-lib/seeders/data/add-mms-frigg-api-scopes-to-clients-api.ts (1)

3-8: Consider adding a down/rollback function

As this is a database seeder, it's recommended to include a down function to remove these scopes if needed. This ensures the changes are reversible.

export const up = compose(
  addScopesToClient({
    clientId: '@island.is/clients/api',
    scopeNames: ['@mms.is/frigg'],
  }),
)

+ export const down = compose(
+   addScopesToClient({
+     clientId: '@island.is/clients/api',
+     scopeNames: ['@mms.is/frigg'],
+     remove: true,
+   }),
+ )
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3e8a9e and 8113b6b.

📒 Files selected for processing (1)
  • libs/auth-api-lib/seeders/data/add-mms-frigg-api-scopes-to-clients-api.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
libs/auth-api-lib/seeders/data/add-mms-frigg-api-scopes-to-clients-api.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 (1)
libs/auth-api-lib/seeders/data/add-mms-frigg-api-scopes-to-clients-api.ts (1)

1-1: Verify helper functions existence and implementation

The code imports helper functions from a relative path. Let's verify these exist and understand their implementation.

✅ Verification successful

Based on the search results, I can see that both helper functions addScopesToClient and compose exist and are properly implemented in the codebase:

  1. compose is defined in libs/auth-api-lib/seeders/data/helpers/compose.ts
  2. addScopesToClient is defined in libs/auth-api-lib/seeders/data/helpers/addScopesToClient.ts
  3. Both are exported through the index file at libs/auth-api-lib/seeders/data/helpers/index.ts

The implementation follows the same pattern as other seeder files in the codebase that add scopes to clients. The helper functions are actively used across multiple seeder files with the same pattern.

Helper functions exist and are properly implemented

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify helper functions existence and implementation
# Look for helper functions in nearby files
rg -A 10 "export.*(?:addScopesToClient|compose)" ./libs/auth-api-lib/seeders/data/

Length of output: 32145

@datadog-island-is
Copy link

datadog-island-is bot commented Dec 17, 2024

Datadog Report

All test runs 1a97fa4 🔗

31 Total Test Services: 0 Failed, 28 Passed
❄️ 1 with New Flaky
🔻 Test Sessions change in coverage: 2 decreased, 111 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
services-auth-delegation-api 0 0 1 270 0 3m 40.6s 1 decreased (-0.04%) Link
air-discount-scheme-web 0 0 0 2 0 9.09s 1 no change Link
api 0 0 0 4 0 3.01s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 10.26s 1 no change Link
application-api-files 0 0 0 2 0 5.66s 1 no change Link
application-core 0 0 0 97 0 22.39s 1 no change Link
application-system-api 0 0 0 46 0 2m 17.62s 1 no change Link
application-template-api-modules 0 0 0 118 0 2m 52.65s 1 decreased (-0.01%) Link
application-templates-accident-notification 0 0 0 148 0 20.88s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 9.62s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (2)

  • services-auth-delegation-api - jest 50.43% (-0.04%) - Details
  • application-template-api-modules - jest 30.2% (-0.01%) - Details

@helgifr helgifr added deploy-feature Deploys features to dev and removed deploy-feature Deploys features to dev labels Dec 17, 2024
Copy link
Contributor

Affected services are: api,application-system-api,services-auth-admin-api,services-auth-ids-api,services-auth-delegation-api,services-auth-personal-representative,services-auth-personal-representative-public,services-auth-public-api,services-user-notification,services-user-profile,
Feature deployment of your services will begin shortly. Your feature will be accessible here:
https://fixadd-scopes-for-frigg-api-catalogue.dev01.devland.is/api
https://fixadd-scopes-for-frigg-application-callback-xrd.internal.dev01.devland.is/application-payment
https://fixadd-scopes-for-frigg-application-callback-xrd.internal.dev01.devland.is/applications
https://fixadd-scopes-for-frigg-application-payment-callback-xrd.internal.dev01.devland.is/application-payment
https://fixadd-scopes-for-frigg-application-payment-callback-xrd.internal.dev01.devland.is/applications
https://fixadd-scopes-for-frigg-beta.dev01.devland.is/
https://fixadd-scopes-for-frigg-beta.dev01.devland.is/api
https://fixadd-scopes-for-frigg-beta.dev01.devland.is/bff
https://fixadd-scopes-for-frigg-beta.dev01.devland.is/samradsgatt
https://fixadd-scopes-for-frigg-beta.dev01.devland.is/stjornbord/bff
https://fixadd-scopes-for-frigg-service-portal-api.internal.dev01.devland.is/

Deployed services: application-system-api,service-portal-api,api,application-system-api-worker,consultation-portal,web,services-bff-portals-admin,services-bff-portals-my-pages.
Excluded services: user-notification,user-notification-worker,user-notification-cleanup-worker

@kodiakhq kodiakhq bot merged commit 980afb0 into main Dec 17, 2024
183 checks passed
@kodiakhq kodiakhq bot deleted the fix/add-scopes-for-frigg branch December 17, 2024 12:17
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 deploy-feature Deploys features to dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants