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

Upgrade dependencies #270

Merged
merged 1 commit into from
Aug 6, 2024
Merged

Upgrade dependencies #270

merged 1 commit into from
Aug 6, 2024

Conversation

Danielius1922
Copy link
Member

@Danielius1922 Danielius1922 commented Aug 6, 2024

Submodule:
github.com/googleapis/googleapis d4acb64370d333024a167551e7da854506109ba2

Direct:
github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0
github.com/lestrrat-go/jwx/v2 v2.1.1
github.com/plgd-dev/device/v2 v2.5.3-0.20240805143631-9644c22de141 github.com/plgd-dev/go-coap/v3 v3.3.5-0.20240805141850-12858340a4f3 github.com/plgd-dev/hub/v2 v2.22.1-0.20240806063421-ca707fac297c google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1

Indirect:
github.com/go-co-op/gocron/v2 v2.11.0
github.com/lestrrat-go/httprc v1.0.6
github.com/pion/transport/v3 v3.0.7
github.com/tidwall/gjson v1.17.3
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.53.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 golang.org/x/crypto v0.25.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 golang.org/x/mod v0.19.0
golang.org/x/net v0.27.0
golang.org/x/oauth2 v0.22.0
golang.org/x/sync v0.8.0
golang.org/x/sys v0.23.0
golang.org/x/term v0.22.0
golang.org/x/tools v0.23.0
google.golang.org/genproto/googleapis/api v0.0.0-20240805194559-2c9e96a0b5d4 google.golang.org/genproto/googleapis/rpc v0.0.0-20240805194559-2c9e96a0b5d4

Summary by CodeRabbit

  • New Features

    • Updated OAuth client handling to unify client types under a single structure, enhancing functionality and maintainability.
    • Added support for machine-to-machine OAuth client specifications.
  • Bug Fixes

    • Improved resource type checks by leveraging more efficient slice utilities, enhancing performance.
  • Documentation

    • Enhanced clarity and readability of API schema definitions, improving navigation and maintainability.
  • Chores

    • Routine maintenance updates to various dependencies, ensuring compatibility and improved performance.

Copy link

coderabbitai bot commented Aug 6, 2024

Walkthrough

The recent updates enhance the project's dependency management and refine the handling of OAuth clients. Key changes include version upgrades for various libraries, consolidation of OAuth client types for improved clarity, and aesthetic improvements in Protobuf definitions and API schemas. These modifications streamline the codebase, ensure compatibility with the latest tools and practices, and contribute to better maintainability and performance.

Changes

File Change Summary
dependency/googleapis Updated Google APIs dependency reference to a newer commit.
go.mod Routine dependency version upgrades across multiple libraries for maintenance and compatibility.
pb/get_configuration.go Removed type aliases for OAuth clients, simplifying client validation logic.
pb/get_configuration.proto Reformatted message definitions for clarity; added m2m_oauth_client in RemoteProvisioning.
pb/service.swagger.json Restructured API schema definitions to enhance maintainability, introduced new reusable schemas.
service/config/remoteProvisioning/config.go Changed OAuth client types to a unified grpcgwPb.OAuthClient.
service/grpc/device.go Replaced strings.Contains with slices.Contains for resource type checks.
service/grpc/getDevices.go Used standard library’s slices for resource type checking instead of a custom utility.
service/grpc/getResource.go Replaced strings.Contains with slices.Contains to improve resource type validation.
test/test.go Updated OAuth client fields to use grpcgwPb.OAuthClient in tests.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Service
    participant OAuthClient
    Client->>Service: Request resource access
    Service->>OAuthClient: Validate OAuth client
    OAuthClient-->>Service: Return validation result
    Service-->>Client: Provide resource or error message
Loading

🐰 In the code, we hop and play,
With OAuth clients leading the way!
Dependencies fresh, a joyful sight,
Streamlined logic, everything feels right!
So let’s celebrate, with a spring in our hop,
For cleaner code will never stop! 🥕


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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@Danielius1922 Danielius1922 marked this pull request as ready for review August 6, 2024 10:25
Copy link

@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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a102e5e and 2a9b38e.

Files ignored due to path filters (20)
  • go.sum is excluded by !**/*.sum
  • pb/clear_cache.pb.go is excluded by !**/*.pb.go
  • pb/create_resource.pb.go is excluded by !**/*.pb.go
  • pb/delete_resource.pb.go is excluded by !**/*.pb.go
  • pb/disown_device.pb.go is excluded by !**/*.pb.go
  • pb/get_configuration.pb.go is excluded by !**/*.pb.go
  • pb/get_device.pb.go is excluded by !**/*.pb.go
  • pb/get_device_resource_links.pb.go is excluded by !**/*.pb.go
  • pb/get_devices.pb.go is excluded by !**/*.pb.go
  • pb/get_identity_certificate.pb.go is excluded by !**/*.pb.go
  • pb/get_json_web_keys.pb.go is excluded by !**/*.pb.go
  • pb/get_resource.pb.go is excluded by !**/*.pb.go
  • pb/initialize.pb.go is excluded by !**/*.pb.go
  • pb/offboard_device.pb.go is excluded by !**/*.pb.go
  • pb/onboard_device.pb.go is excluded by !**/*.pb.go
  • pb/own_device.pb.go is excluded by !**/*.pb.go
  • pb/reset.pb.go is excluded by !**/*.pb.go
  • pb/service.pb.gw.go is excluded by !**/*.pb.gw.go
  • pb/service_grpc.pb.go is excluded by !**/*.pb.go
  • pb/update_resource.pb.go is excluded by !**/*.pb.go
Files selected for processing (10)
  • dependency/googleapis (1 hunks)
  • go.mod (7 hunks)
  • pb/get_configuration.go (2 hunks)
  • pb/get_configuration.proto (1 hunks)
  • pb/service.swagger.json (17 hunks)
  • service/config/remoteProvisioning/config.go (2 hunks)
  • service/grpc/device.go (3 hunks)
  • service/grpc/getDevices.go (3 hunks)
  • service/grpc/getResource.go (3 hunks)
  • test/test.go (1 hunks)
Files skipped from review due to trivial changes (2)
  • go.mod
  • pb/get_configuration.proto
Additional comments not posted (24)
dependency/googleapis (1)

1-1: Submodule update approved.

The submodule github.com/googleapis/googleapis has been updated to commit d4acb64370d333024a167551e7da854506109ba2.

service/config/remoteProvisioning/config.go (2)

23-23: Updated import statement approved.

The import statement has been updated to include grpcgwPb from github.com/plgd-dev/hub/v2/grpc-gateway/pb.


34-36: Approved updated OAuth client fields and new field addition.

The fields WebOauthClient and DeviceOauthClient have been updated to use grpcgwPb.OAuthClient, and a new field M2MOauthClient has been added.

Ensure that the new field M2MOauthClient is correctly used throughout the codebase.

service/grpc/getResource.go (2)

22-22: Approved import statement update.

The import statement has been updated to include slices.


50-50: Approved change to use slices.Contains.

The getResourceAndRefreshCache function now uses slices.Contains instead of strings.Contains for checking if link.ResourceTypes contains plgdDevice.ResourceType.

pb/get_configuration.go (2)

23-23: LGTM! Import changes are appropriate.

The import of github.com/plgd-dev/hub/v2/grpc-gateway/pb is necessary to support the updated function signature and client type changes.


106-109: LGTM! Function signature update enhances flexibility.

The function ValidateWebOAuthClient now accepts a parameter of type *pb.OAuthClient instead of *pb.WebOAuthClient, allowing broader validation capabilities.

service/grpc/device.go (1)

187-189: LGTM! Improved slice operation.

The method getResourceLinkAndCheckAccess now uses slices.Contains instead of strings.Contains for checking if ResourceTypes includes a specific resource type, which is more appropriate for slice operations.

Ensure that the usage of slices is consistent throughout the codebase.

Verification successful

Consistent usage of slices.Contains across the codebase.

The slices.Contains function is used appropriately in multiple files for slice operations. The usage is consistent and aligns with the intended purpose of checking for the presence of an item in a slice.

  • service/grpc/getDevices.go
  • service/grpc/getResource.go
  • service/grpc/device.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `slices` in the codebase.

# Test: Search for the usage of `slices`. Expect: Consistent usage across the codebase.
rg --type go 'slices\.'

Length of output: 452

test/test.go (2)

216-219: LGTM! Updated OAuth client structures.

The function NewRemoteProvisioningConfig now uses grpcgwPb.OAuthClient for WebOauthClient, aligning with the updated implementation.


Line range hint 223-227:
LGTM! Updated OAuth client structures.

The function NewRemoteProvisioningConfig now uses grpcgwPb.OAuthClient for DeviceOauthClient, aligning with the updated implementation.

service/grpc/getDevices.go (1)

150-155: Approved change to use standard library slices package

The replacement of pkgStrings with the standard library slices package for checking the presence of resource types improves code clarity and maintainability. The logic remains intact.

pb/service.swagger.json (13)

356-356: Approved change to use ClientApplicationOnboardDeviceBody schema

The reference to the ClientApplicationOnboardDeviceBody schema improves modularity and reusability.


401-401: Approved change to use ClientApplicationOwnDeviceBody schema

The reference to the ClientApplicationOwnDeviceBody schema improves modularity and reusability.


453-453: Approved change to use ClientApplicationFinishOwnDeviceBody schema

The reference to the ClientApplicationFinishOwnDeviceBody schema improves modularity and reusability.


804-804: Approved change to use ClientApplicationFinishInitializeBody schema

The reference to the ClientApplicationFinishInitializeBody schema improves modularity and reusability.


858-867: Approved addition of ClientApplicationFinishInitializeBody schema

The new ClientApplicationFinishInitializeBody schema definition consolidates properties related to finishing the initialization process, enhancing modularity and reusability.


868-877: Approved addition of ClientApplicationFinishOwnDeviceBody schema

The new ClientApplicationFinishOwnDeviceBody schema definition consolidates properties related to finishing the device ownership process, enhancing modularity and reusability.


878-902: Approved addition of ClientApplicationOnboardDeviceBody schema

The new ClientApplicationOnboardDeviceBody schema definition consolidates properties related to onboarding a device, enhancing modularity and reusability.


903-912: Approved addition of ClientApplicationOwnDeviceBody schema

The new ClientApplicationOwnDeviceBody schema definition consolidates properties related to owning a device, enhancing modularity and reusability.


1310-1342: Approved addition of pbOAuthClient schema

The new pbOAuthClient schema definition consolidates OAuth client properties, enhancing modularity and reusability.


1233-1233: Approved change to use servicepbUIConfiguration schema

The reference to the servicepbUIConfiguration schema aligns with the updated service architecture and enhances modularity.


1405-1415: Approved change to use pbOAuthClient schema

The reference to the pbOAuthClient schema consolidates OAuth client properties, enhancing modularity and reusability.


1102-1107: Approved addition of localEndpoints property

The new localEndpoints property expands the API's ability to convey more detailed information about device states and interactions.


1463-1467: Approved addition of resourceTypes property

The new resourceTypes property expands the API's ability to convey more detailed information about device resource changes.

Also applies to: 1496-1500, 1529-1533, 1602-1606

Submodule:
github.com/googleapis/googleapis d4acb64370d333024a167551e7da854506109ba2

Direct:
github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0
github.com/lestrrat-go/jwx/v2 v2.1.1
github.com/plgd-dev/device/v2 v2.5.3-0.20240805143631-9644c22de141
github.com/plgd-dev/go-coap/v3 v3.3.5-0.20240805141850-12858340a4f3
github.com/plgd-dev/hub/v2 v2.22.1-0.20240806063421-ca707fac297c
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1

Indirect:
github.com/go-co-op/gocron/v2 v2.11.0
github.com/lestrrat-go/httprc v1.0.6
github.com/pion/transport/v3 v3.0.7
github.com/tidwall/gjson v1.17.3
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78
go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.53.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0
golang.org/x/crypto v0.25.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/mod v0.19.0
golang.org/x/net v0.27.0
golang.org/x/oauth2 v0.22.0
golang.org/x/sync v0.8.0
golang.org/x/sys v0.23.0
golang.org/x/term v0.22.0
golang.org/x/tools v0.23.0
google.golang.org/genproto/googleapis/api v0.0.0-20240805194559-2c9e96a0b5d4
google.golang.org/genproto/googleapis/rpc v0.0.0-20240805194559-2c9e96a0b5d4
Copy link

@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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2a9b38e and d2f113f.

Files ignored due to path filters (20)
  • go.sum is excluded by !**/*.sum
  • pb/clear_cache.pb.go is excluded by !**/*.pb.go
  • pb/create_resource.pb.go is excluded by !**/*.pb.go
  • pb/delete_resource.pb.go is excluded by !**/*.pb.go
  • pb/disown_device.pb.go is excluded by !**/*.pb.go
  • pb/get_configuration.pb.go is excluded by !**/*.pb.go
  • pb/get_device.pb.go is excluded by !**/*.pb.go
  • pb/get_device_resource_links.pb.go is excluded by !**/*.pb.go
  • pb/get_devices.pb.go is excluded by !**/*.pb.go
  • pb/get_identity_certificate.pb.go is excluded by !**/*.pb.go
  • pb/get_json_web_keys.pb.go is excluded by !**/*.pb.go
  • pb/get_resource.pb.go is excluded by !**/*.pb.go
  • pb/initialize.pb.go is excluded by !**/*.pb.go
  • pb/offboard_device.pb.go is excluded by !**/*.pb.go
  • pb/onboard_device.pb.go is excluded by !**/*.pb.go
  • pb/own_device.pb.go is excluded by !**/*.pb.go
  • pb/reset.pb.go is excluded by !**/*.pb.go
  • pb/service.pb.gw.go is excluded by !**/*.pb.gw.go
  • pb/service_grpc.pb.go is excluded by !**/*.pb.go
  • pb/update_resource.pb.go is excluded by !**/*.pb.go
Files selected for processing (11)
  • dependency/googleapis (1 hunks)
  • go.mod (7 hunks)
  • pb/get_configuration.go (2 hunks)
  • pb/get_configuration.proto (1 hunks)
  • pb/service.swagger.json (17 hunks)
  • service/config/remoteProvisioning/config.go (2 hunks)
  • service/grpc/device.go (3 hunks)
  • service/grpc/getDevices.go (3 hunks)
  • service/grpc/getResource.go (3 hunks)
  • service/service_test.go (2 hunks)
  • test/test.go (1 hunks)
Files skipped from review due to trivial changes (2)
  • go.mod
  • test/test.go
Files skipped from review as they are similar to previous changes (7)
  • dependency/googleapis
  • pb/get_configuration.go
  • pb/get_configuration.proto
  • service/config/remoteProvisioning/config.go
  • service/grpc/device.go
  • service/grpc/getDevices.go
  • service/grpc/getResource.go
Additional comments not posted (13)
service/service_test.go (2)

23-23: Import statement addition is appropriate.

The time package is necessary for the time.Sleep function.


36-38: Adding a delay to improve test reliability is a good practice.

The time.Sleep(time.Second) call ensures the service has sufficient time to start up before the test proceeds.

pb/service.swagger.json (11)

356-356: Schema reference change improves maintainability.

The schema reference for the request body in the /api/v1/devices/{deviceId}/onboard endpoint has been updated to ClientApplicationOnboardDeviceBody, reducing redundancy.


401-401: Schema reference change improves maintainability.

The schema reference for the request body in the /api/v1/devices/{deviceId}/own endpoint has been updated to ClientApplicationOwnDeviceBody, reducing redundancy.


453-453: Schema reference change improves maintainability.

The schema reference for the request body in the /api/v1/devices/{deviceId}/own/{state} endpoint has been updated to ClientApplicationFinishOwnDeviceBody, reducing redundancy.


804-804: Schema reference change improves maintainability.

The schema reference for the request body in the /api/v1/initialize/{state} endpoint has been updated to ClientApplicationFinishInitializeBody, reducing redundancy.


858-867: New definition enhances maintainability and clarity.

The new ClientApplicationFinishInitializeBody definition consolidates properties previously scattered across different definitions.


868-877: New definition enhances maintainability and clarity.

The new ClientApplicationFinishOwnDeviceBody definition consolidates properties previously scattered across different definitions.


878-902: New definition enhances maintainability and clarity.

The new ClientApplicationOnboardDeviceBody definition consolidates properties previously scattered across different definitions.


903-912: New definition enhances maintainability and clarity.

The new ClientApplicationOwnDeviceBody definition consolidates properties previously scattered across different definitions.


1310-1342: New definition enhances maintainability and clarity.

The new pbOAuthClient definition consolidates properties previously scattered across different definitions.


1101-1107: Property addition expands API capability.

The new localEndpoints property in the pbConnection definition expands the API’s ability to convey more detailed information about device states and interactions.


1463-1467: Property addition expands API capability.

The new resourceTypes property in multiple definitions expands the API’s ability to convey more detailed information about device states and interactions.

Also applies to: 1496-1500, 1529-1533, 1602-1606

@Danielius1922 Danielius1922 reopened this Aug 6, 2024
@Danielius1922 Danielius1922 merged commit e72e9f8 into main Aug 6, 2024
21 of 23 checks passed
@Danielius1922 Danielius1922 deleted the adam/feature/update-deps branch August 6, 2024 11:23
Copy link

sonarcloud bot commented Aug 6, 2024

@coderabbitai coderabbitai bot mentioned this pull request Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant