Skip to content

Fix defaults and null case#683

Merged
feruzm merged 2 commits intodevelopfrom
sdkf
Feb 28, 2026
Merged

Fix defaults and null case#683
feruzm merged 2 commits intodevelopfrom
sdkf

Conversation

@feruzm
Copy link
Member

@feruzm feruzm commented Feb 28, 2026

Fixes #682

Summary by CodeRabbit

  • Bug Fixes

    • Improved error handling for API calls: failures are now caught, logged, and return null instead of throwing.
    • Increased Hive client timeout and failover threshold to improve stability and resilience.
  • Chores

    • Updated package versions and added changelog entries for SDK and Wallet packages.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 28, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 704fa50 and e4151b7.

⛔ Files ignored due to path filters (6)
  • packages/sdk/dist/browser/index.js is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.cjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.cjs.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.mjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (4)
  • packages/sdk/CHANGELOG.md
  • packages/sdk/package.json
  • packages/wallets/CHANGELOG.md
  • packages/wallets/package.json

📝 Walkthrough

Walkthrough

Updated Hive client defaults (longer timeout, higher failover threshold), added try/catch around a posts API call to log errors and return null on failure, and bumped package versions + changelog entries for sdk and wallets.

Changes

Cohort / File(s) Summary
Hive Client Configuration
packages/sdk/src/modules/core/config.ts
Increased Hive client timeout from 2000 → 15000 and failoverThreshold from 2 → 3.
Query Error Handling
packages/sdk/src/modules/posts/queries/get-waves-by-host-query-options.ts
Wrapped the API call in a try/catch, introduced local containers variable, logs errors and returns null on failure instead of throwing.
Package Versions & Changelogs
packages/sdk/package.json, packages/sdk/CHANGELOG.md, packages/wallets/package.json, packages/wallets/CHANGELOG.md
Bumped packages/sdk 2.0.18→2.0.19 and packages/wallets 1.5.46→1.5.47; added corresponding changelog entries (patch notes).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

patch:sdk

Poem

A rabbit nudges timeouts, hops a little higher,
Failovers counted—now three, not two—no quiver.
I catch the errant wave with a gentle "try",
Log a little whisper, let the app breathe sigh.
Hooray for small fixes — nibble, hop, and thrive! 🐰✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Fix defaults and null case' is vague and generic, using non-descriptive terms that don't clearly convey the specific changes made in the changeset. Consider using a more specific title that clearly describes the main changes, such as 'Increase Hive client timeout and failover threshold, add error handling for wave queries' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sdkf

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/sdk/src/modules/posts/queries/get-waves-by-host-query-options.ts`:
- Around line 42-52: The RPC catch block in get-waves-by-host-query-options.ts
that calls CONFIG.hiveClient.call("bridge","get_account_posts", rpcParams)
should not return null (which makes queryFn return an empty array and hides
transient failures); instead rethrow or propagate the error so upstream
retry/error handling runs. Replace the current catch that logs and returns null
with logic that logs the error and then throw err (or return
Promise.reject(err)) from the same scope (the container retrieval for variable
containers) so that get_account_posts failures surface to queryFn and trigger
retries.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e801f57 and 704fa50.

📒 Files selected for processing (2)
  • packages/sdk/src/modules/core/config.ts
  • packages/sdk/src/modules/posts/queries/get-waves-by-host-query-options.ts

Comment on lines +42 to +52
let containers: WaveEntry[];
try {
containers = (await CONFIG.hiveClient.call(
"bridge",
"get_account_posts",
rpcParams
)) as WaveEntry[];
} catch (err) {
console.error("[SDK] getThreads get_account_posts error:", err);
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Don’t convert RPC failures into a successful empty result.

At Line 51, returning null causes queryFn (Line 115) to return [], so transient RPC failures look like “no waves” and skip normal error/retry handling.

💡 Suggested fix
     } catch (err) {
       console.error("[SDK] getThreads get_account_posts error:", err);
-      return null;
+      throw err instanceof Error ? err : new Error("get_account_posts failed");
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let containers: WaveEntry[];
try {
containers = (await CONFIG.hiveClient.call(
"bridge",
"get_account_posts",
rpcParams
)) as WaveEntry[];
} catch (err) {
console.error("[SDK] getThreads get_account_posts error:", err);
return null;
}
let containers: WaveEntry[];
try {
containers = (await CONFIG.hiveClient.call(
"bridge",
"get_account_posts",
rpcParams
)) as WaveEntry[];
} catch (err) {
console.error("[SDK] getThreads get_account_posts error:", err);
throw err instanceof Error ? err : new Error("get_account_posts failed");
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/sdk/src/modules/posts/queries/get-waves-by-host-query-options.ts`
around lines 42 - 52, The RPC catch block in get-waves-by-host-query-options.ts
that calls CONFIG.hiveClient.call("bridge","get_account_posts", rpcParams)
should not return null (which makes queryFn return an empty array and hides
transient failures); instead rethrow or propagate the error so upstream
retry/error handling runs. Replace the current catch that logs and returns null
with logic that logs the error and then throw err (or return
Promise.reject(err)) from the same scope (the container retrieval for variable
containers) so that get_account_posts failures surface to queryFn and trigger
retries.

@feruzm feruzm added the patch Bug fixes and patches (1.0.0 → 1.0.1), add this only if any packages/ have patch changes in PR label Feb 28, 2026
@feruzm feruzm merged commit 73ead07 into develop Feb 28, 2026
1 check was pending
@feruzm feruzm deleted the sdkf branch February 28, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Bug fixes and patches (1.0.0 → 1.0.1), add this only if any packages/ have patch changes in PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant