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: release #1504

Merged
merged 2 commits into from
Dec 2, 2024
Merged

fix: release #1504

merged 2 commits into from
Dec 2, 2024

Conversation

rodrigopavezi
Copy link
Member

@rodrigopavezi rodrigopavezi commented Dec 2, 2024

Description of the changes

Release was falling due to lerna/lerna#3765

Change prettier version resolves the issue as done here contentful/create-contentful-app#1642

Summary by CodeRabbit

  • Chores
    • Updated the version of the prettier package in the development dependencies.
  • Style
    • Improved formatting across various files for better readability, including constructor parameter declarations and method signatures.
  • Bug Fixes
    • Enhanced error handling in the persistRequest and formatAddress functions to provide clearer feedback during execution.
  • New Features
    • Added validation for duplicate payment network identifiers in the MetaPaymentNetwork class.

Copy link
Contributor

coderabbitai bot commented Dec 2, 2024

Walkthrough

The pull request involves a modification to the package.json file, specifically updating the version of the prettier package from 3.0.3 to 2.8.8. Additionally, several files across the codebase have undergone formatting changes, primarily concerning the structure of type parameter declarations and constructor parameters, without altering any existing functionality.

Changes

File Change Summary
package.json Updated prettier version from 3.0.3 to 2.8.8
packages/advanced-logic/src/extensions/content-data.ts Reformatted type parameter declaration for clarity.
packages/advanced-logic/src/extensions/payment-network/address-based.ts Reformatted type parameter declaration; added error classes.
packages/advanced-logic/src/extensions/payment-network/declarative.ts Reformatted type parameter declaration for clarity.
packages/advanced-logic/src/extensions/payment-network/erc20/fee-proxy-contract.ts Reformatted type parameter declaration for clarity.
packages/advanced-logic/src/extensions/payment-network/erc20/proxy-contract.ts Reformatted type parameter declaration for clarity.
packages/advanced-logic/src/extensions/payment-network/erc20/transferable-receivable.ts Reformatted type parameter declaration for clarity.
packages/advanced-logic/src/extensions/payment-network/erc777/stream.ts Reformatted type parameter declaration for clarity.
packages/advanced-logic/src/extensions/payment-network/ethereum/fee-proxy-contract.ts Reformatted type parameter declaration for clarity.
packages/advanced-logic/src/extensions/payment-network/fee-reference-based.ts Reformatted type parameter declaration for clarity.
packages/advanced-logic/src/extensions/payment-network/meta.ts Reformatted type parameter declaration for clarity; improved validation.
packages/advanced-logic/src/extensions/payment-network/reference-based.ts Reformatted type parameter declaration for clarity; added validation checks.
packages/data-access/src/data-read.ts Streamlined getChannelsByMultipleTopics method formatting.
packages/payment-detection/src/balance-error.ts Reformatted constructor parameters for clarity.
packages/payment-detection/src/types.ts Reformatted type parameter declarations for clarity.
packages/payment-detection/src/utils.ts Updated return type assertion syntax in transformNonNull; enhanced error handling in formatAddress.
packages/payment-processor/test/payment/shared.ts Adjusted type assertion syntax in currency definitions.
packages/request-client.js/src/api/request-network.ts Reformatted destructuring assignment in createRequest for readability; enhanced error handling in persistRequest.
packages/request-client.js/test/index-encryption.html Changed doctype declaration to standard uppercase format.
packages/request-client.js/test/index-metamask.html Changed doctype declaration to standard uppercase format.
packages/request-client.js/test/index-persist-from-metamask.html Changed doctype declaration to standard uppercase format.
packages/request-client.js/test/index.html Changed doctype declaration to standard uppercase format.
packages/request-logic/specs/example/example.ts Adjusted return statement in sign method for clarity.
packages/request-logic/src/request-logic.ts Improved request action handling and error management.
packages/request-logic/test/unit/utils/test-data-generator.ts Modified return statement in sign method for clarity.
packages/request-node/src/request/confirmedTransactionStore.ts Reformatted asynchronous call for readability.
packages/request-node/src/request/getChannelsByTopic.ts Reformatted constructor parameters for clarity.
packages/request-node/src/request/getConfirmedTransactionHandler.ts Reformatted constructor parameters for clarity.
packages/request-node/src/request/getStatus.ts Reformatted constructor parameters for clarity.
packages/request-node/src/request/getTransactionsByChannelId.ts Reformatted constructor parameters for clarity.
packages/request-node/src/request/ipfsAdd.ts Reformatted constructor parameters for clarity.
packages/request-node/src/request/persistTransaction.ts Reformatted constructor parameters for clarity; adjusted error logging formatting.
packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol Reformatted constructor parameters for readability.
packages/smart-contracts/src/contracts/test/UsdtFake.sol Reformatted function signatures for readability.
packages/smart-contracts/src/lib/ContractArtifact.ts Reformatted constructor parameters for clarity.
types-overrides/jest/index.d.ts Reformatted method signatures in Each interface for clarity.

Possibly related PRs

  • refactor: prepare SingleRequestFactory for deployment with Request Deployer #1473: The changes in this PR involve modifications to the SingleRequestProxyFactory contract, which includes updates to the constructor and error handling. While the main PR focuses on updating the prettier version in package.json, both PRs involve changes to the package.json file, indicating a potential connection in terms of project configuration management.
  • fix: release #1498: This PR updates the package.json to include a new resolution for the string-width package. Similar to the main PR, it involves changes to the package.json file, suggesting a relationship in terms of dependency management.
  • chore: revert resolution change #1500: This PR reverts a previous change made to the package.json file regarding the string-width resolution. Like the main PR, it deals with modifications to the package.json, indicating a connection in the context of dependency resolution management.

Suggested reviewers

  • MantisClone
  • alexandre-abrioux
  • kevindavee
  • aimensahnoun
  • sstefdev

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.

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.

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 (2)
packages/request-node/src/request/getStatus.ts (1)

Line range hint 52-52: Consider security implications of version exposure.

Exposing the exact version number in the status response could help attackers identify known vulnerabilities. Consider either:

  1. Removing the version from the response
  2. Only exposing major version
  3. Implementing a version exposure policy
packages/request-node/src/request/persistTransaction.ts (1)

90-93: Consider optimizing error logging.

Based on previous feedback (from learnings), the error logging contains redundant information across error and debug logs. Consider consolidating the logged information to reduce noise while maintaining necessary debug details.

- dataAccessResponse.on('error', async (e: unknown) => {
-   this.logger.error(`persistTransaction error: ${e}\n
-     transactionHash: ${transactionHash.value}, channelId: ${
-     clientRequest.body.channelId
-   }, topics: ${clientRequest.body.topics}, transactionData: ${JSON.stringify(
-     clientRequest.body.transactionData,
-   )}`);
- });
+ dataAccessResponse.on('error', async (e: unknown) => {
+   this.logger.error(`persistTransaction error: ${e}`, {
+     transactionHash: transactionHash.value,
+     channelId: clientRequest.body.channelId,
+     error: e
+   });
+   this.logger.debug('Failed transaction details:', {
+     topics: clientRequest.body.topics,
+     transactionData: clientRequest.body.transactionData
+   });
+ });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 399dcad and 5194eee.

📒 Files selected for processing (35)
  • packages/advanced-logic/src/extensions/content-data.ts (1 hunks)
  • packages/advanced-logic/src/extensions/payment-network/address-based.ts (1 hunks)
  • packages/advanced-logic/src/extensions/payment-network/declarative.ts (1 hunks)
  • packages/advanced-logic/src/extensions/payment-network/erc20/fee-proxy-contract.ts (1 hunks)
  • packages/advanced-logic/src/extensions/payment-network/erc20/proxy-contract.ts (1 hunks)
  • packages/advanced-logic/src/extensions/payment-network/erc20/transferable-receivable.ts (1 hunks)
  • packages/advanced-logic/src/extensions/payment-network/erc777/stream.ts (1 hunks)
  • packages/advanced-logic/src/extensions/payment-network/ethereum/fee-proxy-contract.ts (1 hunks)
  • packages/advanced-logic/src/extensions/payment-network/fee-reference-based.ts (1 hunks)
  • packages/advanced-logic/src/extensions/payment-network/meta.ts (1 hunks)
  • packages/advanced-logic/src/extensions/payment-network/reference-based.ts (1 hunks)
  • packages/data-access/src/data-read.ts (1 hunks)
  • packages/payment-detection/src/balance-error.ts (1 hunks)
  • packages/payment-detection/src/types.ts (1 hunks)
  • packages/payment-detection/src/utils.ts (1 hunks)
  • packages/payment-processor/test/payment/shared.ts (1 hunks)
  • packages/request-client.js/src/api/request-network.ts (2 hunks)
  • packages/request-client.js/test/index-encryption.html (1 hunks)
  • packages/request-client.js/test/index-metamask.html (1 hunks)
  • packages/request-client.js/test/index-persist-from-metamask.html (1 hunks)
  • packages/request-client.js/test/index.html (1 hunks)
  • packages/request-logic/specs/example/example.ts (1 hunks)
  • packages/request-logic/src/request-logic.ts (2 hunks)
  • packages/request-logic/test/unit/utils/test-data-generator.ts (1 hunks)
  • packages/request-node/src/request/confirmedTransactionStore.ts (1 hunks)
  • packages/request-node/src/request/getChannelsByTopic.ts (1 hunks)
  • packages/request-node/src/request/getConfirmedTransactionHandler.ts (1 hunks)
  • packages/request-node/src/request/getStatus.ts (1 hunks)
  • packages/request-node/src/request/getTransactionsByChannelId.ts (1 hunks)
  • packages/request-node/src/request/ipfsAdd.ts (1 hunks)
  • packages/request-node/src/request/persistTransaction.ts (2 hunks)
  • packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol (1 hunks)
  • packages/smart-contracts/src/contracts/test/UsdtFake.sol (3 hunks)
  • packages/smart-contracts/src/lib/ContractArtifact.ts (1 hunks)
  • types-overrides/jest/index.d.ts (1 hunks)
✅ Files skipped from review due to trivial changes (20)
  • packages/request-client.js/test/index.html
  • packages/advanced-logic/src/extensions/payment-network/erc20/proxy-contract.ts
  • packages/request-node/src/request/getTransactionsByChannelId.ts
  • packages/advanced-logic/src/extensions/payment-network/ethereum/fee-proxy-contract.ts
  • packages/advanced-logic/src/extensions/payment-network/erc20/transferable-receivable.ts
  • packages/request-client.js/test/index-metamask.html
  • packages/request-node/src/request/confirmedTransactionStore.ts
  • packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol
  • packages/payment-processor/test/payment/shared.ts
  • packages/request-node/src/request/getChannelsByTopic.ts
  • packages/request-node/src/request/ipfsAdd.ts
  • packages/advanced-logic/src/extensions/payment-network/fee-reference-based.ts
  • packages/request-node/src/request/getConfirmedTransactionHandler.ts
  • packages/advanced-logic/src/extensions/content-data.ts
  • packages/request-client.js/test/index-encryption.html
  • packages/request-client.js/test/index-persist-from-metamask.html
  • packages/advanced-logic/src/extensions/payment-network/erc20/fee-proxy-contract.ts
  • packages/payment-detection/src/types.ts
  • packages/smart-contracts/src/contracts/test/UsdtFake.sol
  • packages/smart-contracts/src/lib/ContractArtifact.ts
🧰 Additional context used
📓 Learnings (1)
packages/request-node/src/request/persistTransaction.ts (3)
Learnt from: MantisClone
PR: RequestNetwork/requestNetwork#1463
File: packages/request-node/src/request/persistTransaction.ts:45-48
Timestamp: 2024-11-12T14:52:33.204Z
Learning: In `PersistTransactionHandler.handler`, `clientRequest.body.transactionData` is validated before use, so additional null checks are unnecessary.
Learnt from: MantisClone
PR: RequestNetwork/requestNetwork#1463
File: packages/request-node/src/request/persistTransaction.ts:50-61
Timestamp: 2024-11-12T14:52:33.204Z
Learning: In 'packages/request-node/src/request/persistTransaction.ts', prefer to keep the timeout duration calculation inline within the 'PersistTransactionHandler' class when handling timeouts, rather than extracting it to a constant.
Learnt from: MantisClone
PR: RequestNetwork/requestNetwork#1463
File: packages/request-node/src/request/persistTransaction.ts:109-117
Timestamp: 2024-11-12T14:52:38.580Z
Learning: When logging error and debug information, avoid duplicating the same data across error logs and debug logs, as it is considered redundant and noisy.
🔇 Additional comments (19)
packages/payment-detection/src/balance-error.ts (1)

4-4: LGTM: Formatting change only

The constructor parameter formatting change is purely cosmetic and aligns with the PR's objective of updating the Prettier version. No functional changes were made.

types-overrides/jest/index.d.ts (1)

554-579: LGTM! Formatting changes align with project style.

The changes to the Each interface method signatures are purely formatting-related and maintain the same type definitions. These changes are consistent with the PR's objective of addressing release issues through Prettier version update.

Let's verify the formatting consistency across similar type definitions:

✅ Verification successful

Formatting changes are consistent with the codebase

The verification confirms that the formatting changes in the Each interface method signatures are consistent with other similar patterns in the codebase. All generic method signatures in the type definitions follow the same formatting style:

  • Consistent indentation with 4 spaces
  • Consistent line breaks after the return type colon and opening parenthesis
  • Uniform spacing around type parameters and function arguments
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check formatting consistency in type definition files
# Look for similar interface method signatures to ensure consistent formatting

# Search for similar method signatures in type definition files
fd -e d.ts --exec rg -A 2 '^\s*\w+\s*<[^>]+>\s*\([^)]+\):\s*\(' {}

Length of output: 70


Script:

#!/bin/bash
# Let's try a different approach to verify formatting consistency
# First, let's check all type definition files in the repository
fd -e d.ts

# Then, let's specifically look at the formatting of method signatures in these files
# using a more specific pattern that matches the structure we're interested in
rg -U '^\s+<.*>\(.*\):\s*\(' --type ts

Length of output: 492

packages/advanced-logic/src/extensions/payment-network/reference-based.ts (1)

12-12: LGTM: Formatting change only

The change is a purely cosmetic adjustment to the generic type parameter formatting, consistent with the PR's objective of addressing Prettier-related issues.

packages/request-logic/specs/example/example.ts (1)

43-43: LGTM: Formatting change only

The change adjusts the bracket placement in the return statement without affecting the functionality of the signature provider.

packages/advanced-logic/src/extensions/payment-network/erc777/stream.ts (1)

15-15: LGTM: Formatting change only

The change is a purely cosmetic adjustment to the generic type parameter formatting, consistent with the PR's objective of addressing Prettier-related issues.

packages/advanced-logic/src/extensions/payment-network/meta.ts (1)

16-16: LGTM: Type parameter formatting improvement

The formatting change enhances readability while maintaining the same functionality.

packages/data-access/src/data-read.ts (1)

130-140: LGTM: Improved reduce functions formatting

The formatting changes enhance readability while preserving the original functionality of the reduce operations.

packages/request-logic/test/unit/utils/test-data-generator.ts (1)

286-286: LGTM: Simplified return statement

The return statement has been simplified while maintaining the same functionality. This change improves code clarity in the test utilities.

packages/payment-detection/src/utils.ts (1)

264-266: LGTM: Safe formatting change

The change only affects the formatting of the return type assertion, splitting it across multiple lines for better readability. No functional changes were introduced.

packages/advanced-logic/src/extensions/payment-network/address-based.ts (1)

16-16: LGTM: Safe formatting change

The change only affects the formatting of the generic type parameter declaration, improving readability. No functional changes were introduced.

packages/advanced-logic/src/extensions/payment-network/declarative.ts (2)

11-11: LGTM: Safe formatting change

The change only affects the formatting of the generic type parameter declaration, improving readability. No functional changes were introduced.


11-11: Verify Prettier configuration

The formatting changes are consistent with the Prettier version downgrade from 3.0.3 to 2.8.8. To ensure the change is properly configured:

✅ Verification successful

Prettier configuration is correctly set for version 2.8.8

The verification confirms that:

  • Prettier is correctly configured as version 2.8.8 in devDependencies
  • No custom Prettier configuration files are present, indicating default settings are used
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check Prettier configuration and version
if [ -f "package.json" ]; then
  echo "Checking Prettier version in package.json:"
  cat package.json | jq '.devDependencies.prettier, .dependencies.prettier'
fi

# Check for any .prettierrc configuration files
echo -e "\nChecking Prettier configuration files:"
fd -t f -e json -e yaml -e yml -e js -e config.js '\.prettier'

Length of output: 367

packages/request-client.js/src/api/request-network.ts (2)

87-89: LGTM: Improved readability through consistent formatting

The destructuring assignment has been reformatted for better readability while maintaining the same functionality.


169-171: LGTM: Consistent formatting applied

The destructuring assignment formatting matches the style applied in the createRequest method, maintaining consistency throughout the codebase.

packages/request-logic/src/request-logic.ts (2)

514-530: LGTM: Enhanced code readability

The reduce callback function has been properly indented, making the error handling logic more readable while maintaining the same functionality.


677-679: LGTM: Consistent formatting applied

The destructuring assignment formatting is consistent with the style applied throughout the codebase.

packages/request-node/src/request/getStatus.ts (1)

17-17: LGTM! Constructor formatting change looks good.

The parameter consolidation maintains proper typing and access modifiers.

packages/request-node/src/request/persistTransaction.ts (2)

15-15: LGTM! Constructor formatting change looks good.

The parameter consolidation maintains proper typing and access modifiers.


Line range hint 45-93: Verify error handling coverage.

The error handling looks comprehensive but let's verify all error paths are covered.

✅ Verification successful

Let me gather more information about the error handling by checking the try-catch blocks and response handling.


Let me try one more verification to check the try-catch blocks with a corrected pattern:


Error handling is comprehensive and properly implemented

Based on the verification results, the error handling is complete and well-structured with:

  • Timeout handling with proper error response (GATEWAY_TIMEOUT)
  • Event-based error handling via dataAccessResponse.on('error')
  • Try-catch block with proper error logging and response (INTERNAL_SERVER_ERROR)
  • Appropriate status codes for different error scenarios (UNPROCESSABLE_ENTITY, GATEWAY_TIMEOUT, INTERNAL_SERVER_ERROR)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent error handling patterns across similar handlers

# Look for error handling patterns in transaction handlers
echo "Checking error handling patterns in transaction handlers..."
rg -A 3 "on\('error'" packages/request-node/src/request/

# Look for timeout handling patterns
echo "Checking timeout handling patterns..."
rg -A 3 "setTimeout" packages/request-node/src/request/

Length of output: 1586


Script:

#!/bin/bash
# Check for try-catch blocks and response handling in the transaction handlers
echo "Checking try-catch blocks in persistTransaction.ts..."
rg -A 10 "try\s*{" packages/request-node/src/request/persistTransaction.ts

echo "\nChecking server response handling..."
rg "serverResponse\.(?:status|send)" packages/request-node/src/request/persistTransaction.ts

Length of output: 774


Script:

#!/bin/bash
# Check for try-catch blocks and their error handling
echo "Checking try-catch blocks in persistTransaction.ts..."
rg -B 2 -A 15 "try {" packages/request-node/src/request/persistTransaction.ts

echo "\nChecking catch blocks..."
rg -B 2 -A 5 "} catch" packages/request-node/src/request/persistTransaction.ts

Length of output: 678

@rodrigopavezi rodrigopavezi merged commit c287045 into master Dec 2, 2024
27 checks passed
@rodrigopavezi rodrigopavezi deleted the fix/release branch December 2, 2024 23:40
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.

3 participants