Skip to content

Conversation

@ByteZhang1024
Copy link
Contributor

@ByteZhang1024 ByteZhang1024 commented Aug 17, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced result callbacks: final responses now include accompanying error details when present; interim updates are simplified to data only.
  • Bug Fixes

    • More consistent error reporting across batch address retrieval flows, improving clarity of success vs. failure outcomes.
  • Chores

    • Version bump to 1.1.8 across the suite.
    • Updated dependencies to the latest 1.1.8 releases for core, shared, web, transport (HTTP, web device, emulator, low-level, React Native, Electron), BLE SDK, and common connect SDK.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 17, 2025

Walkthrough

Version bumps from 1.1.7 to 1.1.8 across many packages. Core change updates allNetworkGetAddressByLoop to pass errors in the final callback. Example app aligns its callbacks: per-item callback drops error; final callback now includes error.

Changes

Cohort / File(s) Summary
Core API callback update
packages/core/src/inject.ts
allNetworkGetAddressByLoop now calls onAllItemsResponse(data, error). Internal CallbackFunction error type changed to Unsuccessful. Finish handler forwards error.
Example playground logic
packages/connect-examples/expo-example/src/components/PlaygroundExecutor.tsx
For allNetworkGetAddressByLoop: onLoopItemResponse now only receives data; onAllItemsResponse now receives (data, error). Adjusted JSON payloads accordingly.
Examples package versions
packages/connect-examples/expo-example/package.json, packages/connect-examples/expo-playground/package.json
Version bumps to 1.1.8. Updated @onekeyfe dependencies to 1.1.8 where present.
Core package version
packages/core/package.json
Version to 1.1.8. Bumped @onekeyfe/hd-shared and @onekeyfe/hd-transport to 1.1.8.
Transport packages versions
packages/hd-transport/package.json, packages/hd-transport-*/package.json (…-electron, -emulator, -http, -lowlevel, -react-native, -web-device)
Version bumps to 1.1.8. Updated @onekeyfe/hd-shared/hd-transport deps to 1.1.8. Dev dep bump in web-device for hd-transport-electron.
SDK packages versions
packages/hd-ble-sdk/package.json, packages/hd-common-connect-sdk/package.json, packages/hd-web-sdk/package.json
Versions to 1.1.8. Updated internal @onekeyfe dependencies to 1.1.8.
Shared package version
packages/shared/package.json
Version bump to 1.1.8.

Sequence Diagram(s)

sequenceDiagram
  participant App as Example App
  participant Core as Core allNetworkGetAddressByLoop
  participant Dev as Device/Networks
  participant LoopCB as onLoopItemResponse(data)
  participant FinalCB as onAllItemsResponse(data, error)

  App->>Core: invoke allNetworkGetAddressByLoop(...)
  Core->>Dev: iterate networks and fetch addresses
  loop For each item
    Dev-->>Core: item result (data or error internally)
    Core-->>LoopCB: data
  end
  Dev-->>Core: finish (aggregate data, error?)
  Core-->>FinalCB: (data, error)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/allnetwork

🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@ByteZhang1024 ByteZhang1024 enabled auto-merge (squash) August 17, 2025 07:18
@revan-zhang
Copy link
Contributor

revan-zhang commented Aug 17, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

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

🔭 Outside diff range comments (3)
packages/connect-examples/expo-example/src/components/PlaygroundExecutor.tsx (3)

34-35: Returning a string here drops the message; call onExecute instead.

The onPress handler ignores the return value, so users won’t see these messages.

Use onExecute for early exits:

-      if (!sdk) return intl.formatMessage({ id: 'tip__sdk_not_ready' });
+      if (!sdk) {
+        onExecute(JSON.stringify({ error: intl.formatMessage({ id: 'tip__sdk_not_ready' }) }, null, 2));
+        return;
+      }
...
-        if (!selectedDevice) return intl.formatMessage({ id: 'tip__need_connect_device_first' });
+        if (!selectedDevice) {
+          onExecute(JSON.stringify({ error: intl.formatMessage({ id: 'tip__need_connect_device_first' }) }, null, 2));
+          return;
+        }
...
-        if (!selectedDevice) return intl.formatMessage({ id: 'tip__need_connect_device_first' });
+        if (!selectedDevice) {
+          onExecute(JSON.stringify({ error: intl.formatMessage({ id: 'tip__need_connect_device_first' }) }, null, 2));
+          return;
+        }

Also applies to: 75-76, 79-80


68-68: Avoid noisy logs in the example UI.

Either remove the console.log or guard it behind a dev flag.

Apply:

-      console.log('requestParams: ', requestParams);
+      if (__DEV__) console.log('requestParams: ', requestParams);

85-87: Harden error reporting.

Unknown thrown values may lack message. Fall back to String(error).

Apply:

-    } catch (error: any) {
-      // Adjust according to your error type
-      onExecute(JSON.stringify({ error: error.message }, null, 2));
+    } catch (error: unknown) {
+      const message = error && typeof error === 'object' && 'message' in error ? (error as any).message : String(error);
+      onExecute(JSON.stringify({ error: message }, null, 2));
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 23490bb and bceeb1f.

📒 Files selected for processing (16)
  • packages/connect-examples/expo-example/package.json (2 hunks)
  • packages/connect-examples/expo-example/src/components/PlaygroundExecutor.tsx (1 hunks)
  • packages/connect-examples/expo-playground/package.json (2 hunks)
  • packages/core/package.json (2 hunks)
  • packages/core/src/inject.ts (2 hunks)
  • packages/hd-ble-sdk/package.json (2 hunks)
  • packages/hd-common-connect-sdk/package.json (2 hunks)
  • packages/hd-transport-electron/package.json (2 hunks)
  • packages/hd-transport-emulator/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-web-device/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 context used
🧬 Code Graph Analysis (1)
packages/core/src/inject.ts (2)
packages/core/src/types/params.ts (1)
  • Unsuccessful (49-52)
packages/core/src/types/api/allNetworkGetAddress.ts (1)
  • AllNetworkAddress (94-105)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: publish-and-release
  • GitHub Check: lint (22)
  • GitHub Check: build (22)
  • GitHub Check: Socket Security: Pull Request Alerts
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (20)
packages/hd-transport-react-native/package.json (2)

3-3: Version bump approved.
Matches the monorepo release to 1.1.8.


22-23: Dependency alignment to 1.1.8 confirmed.
Transport and shared are now in lockstep across every package. After you publish, please verify that React Native consumers resolve a single version to prevent duplicate native modules.

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

3-3: Version bump approved.
No other script or metadata changes. Good.


24-27: Deps synced to 1.1.8 — verify downstream callback signature changes

We found the updated declaration for allNetworkGetAddressByLoop in
• packages/core/src/types/api/allNetworkGetAddress.ts:124

No internal calls were detected in this repo. Please check any consumer code that invokes this API to ensure it matches the new signature (returns Response<AllNetworkAddress[]> and takes CommonParams & AllNetworkGetAddressParamsByLoop).

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

3-3: Version bump approved.
Transport at 1.1.8 matches dependent packages.

packages/connect-examples/expo-playground/package.json (2)

3-3: Version bump approved.
Playground aligns to 1.1.8.


20-22: Deps bumped to 1.1.8 – please verify example callbacks
I couldn’t find any uses of the new loop API or callbacks in the expo-playground. Manually confirm that in your example code you:

  • Pass (data, error) into the final onAllItemsResponse callback
  • Remove the error argument from per-item callbacks (e.g. onLoopItemResponse)
packages/core/package.json (1)

3-3: Core moved to 1.1.8; deps synced.

Looks consistent with the repo-wide bump. Ensure CHANGELOG and release tag reflect the callback signature update (onAllItemsResponse now supports error).

Also applies to: 28-29

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

3-3: Transport-lowlevel bump is consistent.

Version and internal deps pinned to 1.1.8. No further action from this file.

Also applies to: 22-23

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

3-3: Electron transport aligned to 1.1.8.

Dependency on hd-shared also updated. Nothing else needed here.

Also applies to: 28-28

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

3-3: Expo example versions synced to 1.1.8.

Good alignment. Since core’s API adds an error in the final callback, confirm the example code uses the new onAllItemsResponse(data, error) signature and still compiles.

Also applies to: 22-25

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

3-3: LGTM on version and dependency bumps.

Version and deps are aligned to 1.1.8. Looks consistent.

Also applies to: 27-28

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

3-3: LGTM on version and dependency bumps.

Everything aligns to 1.1.8 as expected.

Also applies to: 27-28

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

3-3: LGTM on version/deps updates.

Runtime deps and the electron dev dep are all on 1.1.8. Good.

Also applies to: 23-24, 27-27

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

3-3: LGTM on version/dependency alignment.

Core, shared, and transports all pinned to 1.1.8. Looks consistent.

Also applies to: 22-29


22-29: Update lingering 1.1.7 reference

We found one leftover version pin. Please bump it to 1.1.8 and rerun the check.

• packages/connect-examples/electron-example/package.json (line 5)

-  "version": "1.1.7",
+  "version": "1.1.8",

Likely an incorrect or invalid review comment.

packages/connect-examples/expo-example/src/components/PlaygroundExecutor.tsx (2)

53-55: Per-item callback shape change is correct.

Dropping the error param from onLoopItemResponse matches the new API.


51-59: Verify old onAllItemsResponse handlers

  • Ripgrep found no single-param assignments in .ts/.tsx.
  • Double-check any .js/.jsx or external modules for calls like onAllItemsResponse(data).
  • Ensure every consumer uses the new (data, error) signature.
packages/core/src/inject.ts (2)

5-5: Use a type-only import for Unsuccessful

Switch to a type-only import to avoid including a runtime symbol and improve tree-shaking.

-import { Unsuccessful } from './types';
+import type { Unsuccessful } from './types';

176-197: AllNetworkGetAddressByLoop callback signature is up-to-date
I’ve confirmed that in packages/core/src/types/api/allNetworkGetAddress.ts, onAllItemsResponse is defined as (data?: AllNetworkAddress[], error?: Unsuccessful). The implementation in inject.ts passes both arguments correctly. No remaining call sites (including examples) need updating.

@wabicai wabicai self-requested a review August 18, 2025 02:25
@ByteZhang1024 ByteZhang1024 merged commit e2444c1 into onekey Aug 18, 2025
13 checks passed
@ByteZhang1024 ByteZhang1024 deleted the fix/allnetwork branch August 18, 2025 02:25
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.

4 participants