Skip to content

Update HOPRd SDK to latest#710

Merged
mjadach-iv merged 1 commit intomainfrom
v3.0.1
Sep 15, 2025
Merged

Update HOPRd SDK to latest#710
mjadach-iv merged 1 commit intomainfrom
v3.0.1

Conversation

@mjadach-iv
Copy link
Contributor

@mjadach-iv mjadach-iv commented Sep 11, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Corrected MTU value displayed in the Sessions page to reflect the HOPR MTU for each session.
  • Chores
    • Configured scoped package registry for @hoprnet to ensure correct package sourcing.
    • Updated @hoprnet/hopr-sdk dependency to the latest version for improvements and compatibility.

@coderabbitai
Copy link

coderabbitai bot commented Sep 11, 2025

📝 Walkthrough

Walkthrough

Enables the @hoprnet scoped npm registry, updates @hoprnet/hopr-sdk version, switches MTU source in SessionsPage to session.hoprMtu, and adjusts getChannelsCorruptedThunk.fulfilled to store the payload array directly instead of expecting a channelIds field.

Changes

Cohort / File(s) Summary
Registry and dependency
./.npmrc, ./package.json
Activates scoped registry for @hoprnet; updates @hoprnet/hopr-sdk from 3.0.1 to 3.0.3-pr.156-20250910174548.
Sessions MTU mapping
src/pages/node/sessions.tsx
Changes MTU column source from session.mtu to session.hoprMtu.
Corrupted channels payload shape
src/store/slices/node/actionsAsync.ts
In getChannelsCorruptedThunk.fulfilled, assigns action.payload directly to state.channels.corrupted.data (fallback []), replacing previous action.payload?.channelIds.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor UI as UI
  participant Store as Redux Store
  participant Thunk as getChannelsCorruptedThunk
  participant API as Backend API

  UI->>Store: dispatch(getChannelsCorruptedThunk)
  Store->>Thunk: invoke async thunk
  Thunk->>API: GET /channels/corrupted
  API-->>Thunk: [array of channel IDs]
  Thunk-->>Store: fulfilled(action.payload = array)
  note over Store: Changed: reducer stores payload directly
  Store->>Store: state.channels.corrupted.data = payload || []
  Store-->>UI: state updated (isFetching=false)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • V3.0.0 #702 — Introduces getChannelsCorruptedThunk storing payload.channelIds; this PR aligns reducer to accept the payload array directly and includes similar registry/dependency edits.

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Update HOPRd SDK to latest" directly and concisely reflects the primary change in this PR—the SDK dependency bump in package.json—so it is focused, relevant, and suitable for quick scanning.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch v3.0.1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
src/pages/node/sessions.tsx (1)

169-173: Return path renders the forward path again (user-visible bug).

Uses forwardPath twice; second should be returnPath.

-            {JSON.stringify(session.forwardPath)
+            {JSON.stringify(session.returnPath)
               .replace(/{|}|\[|\]|"/g, '')
               .replace('IntermediatePath:', 'IntermediatePath:\n')
               .replace(/,/g, ' ')}
src/store/slices/node/actionsAsync.ts (3)

914-915: isFetching toggled wrong after isNodeReady success.

Fulfilled should set isFetching = false.

-    state.nodeIsReady.isFetching = true;
+    state.nodeIsReady.isFetching = false;

1202-1210: findIndex misuse can overwrite the last token (index -1).

if (tokenExists) is wrong for index checks; use !== -1.

-      const tokenExists = state.tokens.data?.findIndex((token) => token.id === action.payload?.id);
-
-      if (tokenExists) {
-        state.tokens.data[tokenExists] = action.payload;
-      } else {
-        state.tokens.data.push(action.payload);
-      }
+      const idx = state.tokens.data?.findIndex((t) => t.id === action.payload?.id) ?? -1;
+      if (idx !== -1) {
+        state.tokens.data[idx] = action.payload;
+      } else {
+        state.tokens.data.push(action.payload);
+      }

1274-1284: Same findIndex bug in pings.

Index 0 is falsy; -1 is truthy → incorrect branch.

-      if (pingExists) {
+      if (pingExists !== -1) {
         state.pings[pingExists] = {
           latency: action.payload.latency,
           peerId: action.payload.peerId,
         };
       } else {
🧹 Nitpick comments (3)
src/pages/node/sessions.tsx (2)

217-217: Simplify empty check for export button.

sessions is an array; use length directly.

-              disabled={!sessions || Object.keys(sessions).length === 0}
+              disabled={!sessions || sessions.length === 0}

230-231: Default sort key likely mismatched.

orderByDefault="number" doesn’t match any header key; probably should be "id".

-        orderByDefault="number"
+        orderByDefault="id"
src/store/slices/node/actionsAsync.ts (1)

983-983: Strip console noise in reducers.

console.log('getChannels', ...) in reducer spam logs.

-      console.log('getChannels', channels);
+      // console.log('getChannels', channels);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae284ff and 0a73b70.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • .npmrc (1 hunks)
  • package.json (1 hunks)
  • src/pages/node/sessions.tsx (1 hunks)
  • src/store/slices/node/actionsAsync.ts (1 hunks)
🔇 Additional comments (3)
package.json (1)

9-9: Pre-release SDK pin confirmed in lockfile; CI auth still needs verification

  • yarn.lock contains @hoprnet/hopr-sdk@3.0.3-pr.156-20250910174548 (yarn.lock lines 722–724); no lingering 3.0.1 refs.
  • Verify CI can authenticate to the private registry (europe-west3-npm.pkg.dev) for the @hoprnet scope — check CI npmrc/registry credentials and token.
src/store/slices/node/actionsAsync.ts (1)

1081-1081: Resolved — corrupted channels payload is an array; no downstream breakage found.
Only usage found: src/pages/node/info/index.tsx (line 67) reads store.node.channels.corrupted.data.length > 0 — array access is compatible.

.npmrc (1)

1-1: Registry confirmed — configure CI-sourced auth token; avoid committing project-level always-auth

  • Verified: .npmrc already sets @hoprnet:registry=https://europe-west3-npm.pkg.dev/hoprassociation/npm/ (npm config get returned this URL).
  • npm warned: "Unknown project config 'always-auth' (//registry.npmjs.org/:always-auth) … will stop working in the next major version" — do NOT add //europe-west3-npm.pkg.dev/:always-auth=true in the repo .npmrc.
  • Action: supply an auth token from CI and inject it at build time (do not commit secrets). Example: set HOPR_NPM_TOKEN in CI and write to .npmrc during the build: //europe-west3-npm.pkg.dev/:_authToken=${HOPR_NPM_TOKEN}.

@mjadach-iv mjadach-iv merged commit 11fb286 into main Sep 15, 2025
4 checks passed
@mjadach-iv mjadach-iv deleted the v3.0.1 branch September 15, 2025 09:13
This was referenced Sep 15, 2025
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