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/unexpect error #403

Merged
merged 3 commits into from
Jan 20, 2025
Merged

Feat/unexpect error #403

merged 3 commits into from
Jan 20, 2025

Conversation

ByteZhang1024
Copy link
Contributor

@ByteZhang1024 ByteZhang1024 commented Jan 15, 2025

Summary by CodeRabbit

  • Version Update

    • Updated version from 1.0.19-alpha.0 to 1.0.19 across multiple packages
    • Updated dependencies for OneKey SDK packages to match new version
  • Bug Fixes

    • Enhanced error handling in device communication with more specific error reporting
  • Chores

    • Synchronized version numbers across connect examples, core SDK, and related packages

Copy link

coderabbitai bot commented Jan 15, 2025

Walkthrough

This pull request involves a version update across multiple packages in the OneKey SDK ecosystem. The version has been incremented from "1.0.19-alpha.0" to "1.0.19" for various packages, including core SDK components, transport layers, and example projects. Additionally, the error handling in the DeviceCommands.ts file has been modified to improve error specificity.

Changes

File/Path Change Summary
packages/*/package.json Version updated from 1.0.19-alpha.0 to 1.0.19 for multiple packages.
packages/core/src/device/DeviceCommands.ts Enhanced error handling by throwing TypedError for unexpected response types.

Sequence Diagram

sequenceDiagram
    participant DeviceCommands
    participant HardwareError
    participant TypedError

    DeviceCommands->>HardwareError: Catch error
    alt Is HardwareError
        DeviceCommands->>TypedError: Throw ResponseUnexpectTypeError
    end
Loading

The sequence diagram illustrates the new error handling logic in the typedCall method, showing how a HardwareError now triggers a more specific TypedError with the ResponseUnexpectTypeError code.


🪧 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 or 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

socket-security bot commented Jan 15, 2025

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 52a172d and 1286238.

📒 Files selected for processing (13)
  • packages/connect-examples/electron-example/package.json (1 hunks)
  • packages/connect-examples/expo-example/package.json (2 hunks)
  • packages/core/package.json (2 hunks)
  • packages/core/src/device/DeviceCommands.ts (1 hunks)
  • packages/hd-ble-sdk/package.json (2 hunks)
  • packages/hd-common-connect-sdk/package.json (2 hunks)
  • packages/hd-transport-http/package.json (2 hunks)
  • packages/hd-transport-lowlevel/package.json (2 hunks)
  • packages/hd-transport-react-native/package.json (2 hunks)
  • packages/hd-transport-webusb/package.json (2 hunks)
  • packages/hd-transport/package.json (1 hunks)
  • packages/hd-web-sdk/package.json (2 hunks)
  • packages/shared/package.json (1 hunks)
🔇 Additional comments (14)
packages/core/src/device/DeviceCommands.ts (1)

173-173: Good addition to error handling!

This explicit error throw makes the unexpected type error handling more consistent with other error cases.

packages/hd-transport-lowlevel/package.json (1)

3-3: Version updates look consistent.

Package version and dependencies are aligned at 1.0.19-alpha.1.

Also applies to: 22-23

packages/shared/package.json (1)

3-3: Version update is aligned.

Version bump to 1.0.19-alpha.1 matches other packages.

packages/hd-transport/package.json (1)

3-3: Version update is consistent.

Version bump to 1.0.19-alpha.1 matches other packages.

packages/hd-ble-sdk/package.json (1)

3-3: Version updates look consistent.

Package version and dependencies are properly aligned to 1.0.19-alpha.1.

Also applies to: 23-25

packages/hd-transport-webusb/package.json (1)

3-3: Version alignment confirmed.

Package version and dependencies match the expected 1.0.19-alpha.1 update.

Also applies to: 23-24

packages/hd-transport-react-native/package.json (1)

3-3: Version updates are consistent.

Package version and dependencies correctly updated to 1.0.19-alpha.1.

Also applies to: 22-23

packages/hd-transport-http/package.json (1)

3-3: Version updates verified.

Package version and dependencies correctly aligned to 1.0.19-alpha.1.

Also applies to: 27-28

packages/hd-common-connect-sdk/package.json (1)

3-3: Version updates are complete and consistent.

Package version and all dependencies properly updated to 1.0.19-alpha.1.

The PR title mentions "Feat/unexpect error" but only shows version bumps. Could you clarify the connection between the version updates and error handling improvements?

Also applies to: 23-27

packages/core/package.json (2)

3-3: Version updates look consistent.

All package versions and dependencies are correctly bumped to 1.0.19-alpha.1.

Also applies to: 28-29


Line range hint 1-42: PR title mentions error handling changes, but only version bumps are visible.

The PR title "Feat/unexpect error" suggests error handling changes, but I only see version updates in the files.

Let's check for error handling changes:

packages/connect-examples/electron-example/package.json (1)

5-5: Version bump is consistent.

Version updated to 1.0.19-alpha.1, matching other packages.

packages/hd-web-sdk/package.json (1)

3-3: Version updates are aligned.

Package version and all @onekeyfe dependencies are correctly updated to 1.0.19-alpha.1.

Also applies to: 24-27

packages/connect-examples/expo-example/package.json (1)

3-3: Version updates are consistent.

Package version and all @onekeyfe dependencies are correctly updated to 1.0.19-alpha.1.

Also applies to: 22-25

packages/hd-transport/package.json Show resolved Hide resolved
@ByteZhang1024 ByteZhang1024 enabled auto-merge (squash) January 16, 2025 03:42
Copy link

Report too large to display inline

View full report↗︎

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: 1

♻️ Duplicate comments (1)
packages/hd-transport/package.json (1)

4-4: 🧹 Nitpick (assertive)

Update the package description.

Replace the TODO placeholder with a proper description of the package's purpose.

-  "description": "> TODO: description",
+  "description": "Hardware SDK transport layer implementation",
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1286238 and 166a810.

📒 Files selected for processing (12)
  • packages/connect-examples/electron-example/package.json (1 hunks)
  • packages/connect-examples/expo-example/package.json (2 hunks)
  • packages/core/package.json (2 hunks)
  • packages/hd-ble-sdk/package.json (2 hunks)
  • packages/hd-common-connect-sdk/package.json (2 hunks)
  • packages/hd-transport-http/package.json (2 hunks)
  • packages/hd-transport-lowlevel/package.json (2 hunks)
  • packages/hd-transport-react-native/package.json (2 hunks)
  • packages/hd-transport-webusb/package.json (2 hunks)
  • packages/hd-transport/package.json (1 hunks)
  • packages/hd-web-sdk/package.json (2 hunks)
  • packages/shared/package.json (1 hunks)
🔇 Additional comments (12)
packages/hd-transport-lowlevel/package.json (1)

3-3: Version updates look good!

Version and dependency updates are consistent with the package ecosystem.

Also applies to: 22-23

packages/shared/package.json (1)

3-3: Version update is consistent!

Clean transition from alpha to stable version.

packages/hd-ble-sdk/package.json (1)

3-3: Version and dependency updates are aligned!

Package version and dependencies consistently updated to 1.0.19.

Also applies to: 23-25

packages/hd-transport/package.json (1)

3-3: Version update looks good!

Clean transition from alpha to stable version.

packages/hd-transport-webusb/package.json (1)

3-3: Version and dependency updates are aligned!

Package version and dependencies consistently updated to 1.0.19.

Also applies to: 23-24

packages/hd-transport-react-native/package.json (1)

3-3: Version updates look consistent.

The package version and dependencies are properly aligned to "1.0.19".

Also applies to: 22-23

packages/hd-transport-http/package.json (1)

3-3: Version updates are aligned.

Package version and dependencies correctly updated to "1.0.19".

Also applies to: 27-28

packages/hd-common-connect-sdk/package.json (1)

3-3: Version updates are complete and consistent.

Package version and all dependencies properly updated to "1.0.19".

Also applies to: 23-27

packages/core/package.json (1)

3-3: Version updates are consistent.

Package version and dependencies correctly updated to "1.0.19".

Also applies to: 28-29

packages/connect-examples/electron-example/package.json (1)

5-5: Version update looks good.

Package version correctly updated to "1.0.19".

packages/hd-web-sdk/package.json (1)

3-3: Version bump from alpha to stable looks good

Clean transition from alpha (1.0.19-alpha.0) to stable (1.0.19). All @onekeyfe dependencies are properly synchronized.

Let's verify version consistency across all packages:

Also applies to: 24-27

✅ Verification successful

Version consistency verified across HD packages

All HD-related @onekeyfe packages are properly synchronized at ^1.0.19. Different versions for platform-specific packages (react-native-ble-plx) and tooling (cross-inpage-provider-core) are expected and don't impact the core functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check version consistency across all package.json files
find . -name "package.json" -exec jq -r '. | select(.dependencies != null) | .dependencies | with_entries(select(.key | startswith("@onekeyfe"))) | to_entries[] | "\(.key): \(.value)"' {} \;

Length of output: 1154

packages/connect-examples/expo-example/package.json (1)

3-3: Version updates are consistent with SDK core

Clean alignment with the SDK version bump (1.0.19). All @onekeyfe dependencies match the core package versions.

Also applies to: 22-25

packages/core/package.json Show resolved Hide resolved
@ByteZhang1024 ByteZhang1024 merged commit 4f18904 into onekey Jan 20, 2025
7 checks passed
@ByteZhang1024 ByteZhang1024 deleted the feat/UnexpectError branch January 20, 2025 02:53
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