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(tools): fix connector template generation #271

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

paul-nicolas
Copy link
Contributor

No description provided.

Copy link
Contributor

coderabbitai bot commented Jan 22, 2025

Walkthrough

The pull request involves a systematic update across multiple client template files in the tools/connector-template/template/client/ directory. The primary change is replacing the httpwrapper import with metrics and updating the corresponding context key usage from httpwrapper.MetricOperationContextKey to metrics.MetricOperationContextKey. This modification appears to be a refactoring effort to standardize metrics tracking across different client operations like accounts, balances, external accounts, payouts, transactions, and transfers.

Changes

File Change Summary
tools/connector-template/template/client/*.gotpl Replaced httpwrapper import with metrics in multiple files:
- Updated import statements
- Replaced httpwrapper.MetricOperationContextKey with metrics.MetricOperationContextKey
tools/connector-template/template/client/client.gotpl Added metrics import
Minor formatting change in New function signature

Possibly related PRs

Poem

🐰 Metrics hopping, wrappers dropping,

Code refactored with a leap so light,

From httpwrapper to metrics bright,

A rabbit's dance of clean delight!

Tracking operations, smooth and tight 🚀


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd76462 and e73eb56.

📒 Files selected for processing (7)
  • tools/connector-template/template/client/accounts.gotpl (1 hunks)
  • tools/connector-template/template/client/balances.gotpl (1 hunks)
  • tools/connector-template/template/client/client.gotpl (2 hunks)
  • tools/connector-template/template/client/external_accounts.gotpl (1 hunks)
  • tools/connector-template/template/client/payouts.gotpl (1 hunks)
  • tools/connector-template/template/client/transactions.gotpl (1 hunks)
  • tools/connector-template/template/client/transfers.gotpl (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • tools/connector-template/template/client/payouts.gotpl
  • tools/connector-template/template/client/transfers.gotpl
  • tools/connector-template/template/client/accounts.gotpl
  • tools/connector-template/template/client/balances.gotpl
  • tools/connector-template/template/client/transactions.gotpl
  • tools/connector-template/template/client/client.gotpl
🔇 Additional comments (2)
tools/connector-template/template/client/external_accounts.gotpl (2)

6-6: LGTM! Import statement updated correctly.

The change from httpwrapper to metrics aligns with the PR objective of fixing connector template generation.


12-14: LGTM! Context key and operation name look good.

The context key has been updated correctly to use metrics.MetricOperationContextKey, and the operation name is now consistent with the function's purpose.

Note: The TODO comment indicates this is a template file, which is expected.


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.

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.

@paul-nicolas paul-nicolas marked this pull request as ready for review January 22, 2025 10:45
@paul-nicolas paul-nicolas requested a review from a team as a code owner January 22, 2025 10:45
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 (3)
tools/connector-template/template/client/external_accounts.gotpl (1)

6-6: Overall changes look good with one suggested improvement.

The migration from httpwrapper to a dedicated metrics package is a good architectural decision that:

  1. Improves separation of concerns
  2. Makes the metrics handling more maintainable
  3. Standardizes the approach across different client operations

Consider documenting the list of valid operation names to ensure consistency across the codebase.

tools/connector-template/template/client/client.gotpl (2)

27-27: Remove unnecessary space in function signature.

The space between the parentheses in the function signature is unnecessary.

-func New( /* TODO: fill config parameters */ ) *client {
+func New(/* TODO: fill config parameters */) *client {

29-30: Enhance the TODO comment for transport options.

The current TODO comment about transport options could be more descriptive to better guide implementers.

-		// TODO: you can set an underlying http transport in metrics.TransportOpts for authentication for example
+		// TODO: Set authentication in metrics.TransportOpts.Transport if needed.
+		// Example: metrics.TransportOpts{Transport: &oauth2.Transport{...}}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 291efa7 and dd76462.

📒 Files selected for processing (7)
  • tools/connector-template/template/client/accounts.gotpl (1 hunks)
  • tools/connector-template/template/client/balances.gotpl (1 hunks)
  • tools/connector-template/template/client/client.gotpl (2 hunks)
  • tools/connector-template/template/client/external_accounts.gotpl (1 hunks)
  • tools/connector-template/template/client/payouts.gotpl (1 hunks)
  • tools/connector-template/template/client/transactions.gotpl (1 hunks)
  • tools/connector-template/template/client/transfers.gotpl (1 hunks)
🔇 Additional comments (6)
tools/connector-template/template/client/balances.gotpl (1)

6-6: LGTM! Verify operation name consistency.

The changes correctly migrate from httpwrapper to metrics package. The operation name "list_account_balances" appears consistent with the function's purpose.

Let's verify the operation name consistency across the codebase:

Also applies to: 12-12

✅ Verification successful

Operation name "list_account_balances" is used consistently

The operation name is consistently used in both the connector template and moneycorp connector implementation for balance listing operations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other occurrences of this operation name to ensure consistency
rg "list_account_balances"

Length of output: 326

tools/connector-template/template/client/accounts.gotpl (1)

6-6: LGTM! Verify operation name consistency.

The changes correctly migrate from httpwrapper to metrics package. The operation name "list_accounts" appears consistent with the function's purpose.

Let's verify the operation name consistency across the codebase:

Also applies to: 12-12

✅ Verification successful

Operation name "list_accounts" is consistently used across connectors

The operation name follows the established pattern used in other connector implementations (moneycorp, modulr, bankingcircle, etc.).

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other occurrences of this operation name to ensure consistency
rg "list_accounts"

Length of output: 1250

tools/connector-template/template/client/transactions.gotpl (1)

6-6: LGTM! Verify operation name consistency.

The changes correctly migrate from httpwrapper to metrics package. The operation name "list_transactions" appears consistent with the function's purpose.

Let's verify the operation name consistency across the codebase:

Also applies to: 12-12

✅ Verification successful

Operation name "list_transactions" is consistently used across connectors

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other occurrences of this operation name to ensure consistency
rg "list_transactions"

Length of output: 1346

tools/connector-template/template/client/payouts.gotpl (1)

6-6: LGTM! Import and context key changes are consistent.

The changes correctly update the metrics context key source while maintaining the same functionality.

Also applies to: 14-14

tools/connector-template/template/client/transfers.gotpl (1)

6-6: LGTM! Import and context key changes are consistent.

The changes correctly update the metrics context key source while maintaining the same functionality.

Also applies to: 14-14

tools/connector-template/template/client/client.gotpl (1)

7-7: LGTM! Metrics integration looks good.

The addition of metrics transport while maintaining httpwrapper client functionality is well structured. The template variable {{ .Connector }} is correctly used for metrics identification.

Also applies to: 29-31

Copy link

codecov bot commented Jan 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.86%. Comparing base (291efa7) to head (e73eb56).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #271   +/-   ##
=======================================
  Coverage   72.86%   72.86%           
=======================================
  Files         538      538           
  Lines       26986    26986           
=======================================
  Hits        19664    19664           
  Misses       6259     6259           
  Partials     1063     1063           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@paul-nicolas paul-nicolas force-pushed the fix/connector-template-generation branch from dd76462 to e73eb56 Compare January 22, 2025 10:54
@paul-nicolas paul-nicolas merged commit e6ec3c0 into main Jan 22, 2025
9 checks passed
@paul-nicolas paul-nicolas deleted the fix/connector-template-generation branch January 22, 2025 11:04
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.

2 participants