Skip to content

Conversation

shumkov
Copy link
Collaborator

@shumkov shumkov commented Sep 29, 2025

Issue being fixed or feature implemented

Static version and logging methods aren't working.

What was done?

This pull request updates the logging and version retrieval methods in the EvoSDK class to ensure proper initialization of the WebAssembly module before use. Both methods are now asynchronous, which helps prevent runtime errors if the WASM module hasn't finished loading.

How Has This Been Tested?

None

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Breaking Changes
    • Logging configuration and latest version retrieval methods are now asynchronous and must be awaited. Return types have changed to Promises.

@shumkov shumkov added this to the v2.1.0 milestone Sep 29, 2025
@shumkov shumkov self-assigned this Sep 29, 2025
Copy link
Contributor

coderabbitai bot commented Sep 29, 2025

Walkthrough

The EvoSDK static methods setLogLevel and getLatestVersionNumber were converted to async, each awaiting initWasm() before delegating to the wasm SDK. Their return types changed to Promise and Promise, ensuring Wasm initialization precedes calls.

Changes

Cohort / File(s) Summary
Async initialization for logging and version retrieval
packages/js-evo-sdk/src/sdk.ts
Converted EvoSDK.setLogLevel and EvoSDK.getLatestVersionNumber to async. Each now awaits initWasm() before calling corresponding wasm SDK functions. Updated method signatures: setLogLevel(levelOrFilter: string): Promise<void>, getLatestVersionNumber(): Promise<number>.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Caller
  participant E as EvoSDK
  participant W as initWasm()
  participant S as Wasm SDK

  rect rgb(235, 245, 255)
    note over E: setLogLevel (async)
    C->>E: setLogLevel(levelOrFilter)
    E->>W: await initWasm()
    W-->>E: initialized
    E->>S: setLogLevel(levelOrFilter)
    S-->>E: void
    E-->>C: Promise<void> resolved
  end
Loading
sequenceDiagram
  autonumber
  participant C as Caller
  participant E as EvoSDK
  participant W as initWasm()
  participant S as Wasm SDK

  rect rgb(240, 255, 240)
    note over E: getLatestVersionNumber (async)
    C->>E: getLatestVersionNumber()
    E->>W: await initWasm()
    W-->>E: initialized
    E->>S: getLatestVersionNumber()
    S-->>E: number
    E-->>C: Promise<number> resolved
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • QuantumExplorer

Poem

Thump-thump, I tap my async paw,
Await the Wasm, then log with awe.
Versions hop back, numbers neat—
Promises kept, a tidy feat.
In burrows of bytes I cheer, “Hooray!”
For orderly calls that lead the way. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title concisely describes the primary issue being addressed by this changeset—ensuring the WebAssembly SDK is initialized before static methods are invoked—and uses a clear conventional commit prefix fix(sdk) to indicate its purpose. It aligns with the main change of converting methods to asynchronous initialization and is specific enough for team members to understand the focus at a glance.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ 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/sdk/wasm-not-initialized-for-static-methods

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23d6612 and 9c0977d.

📒 Files selected for processing (1)
  • packages/js-evo-sdk/src/sdk.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
packages/**/**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/**/**/*.{js,ts,jsx,tsx}: Adhere to ESLint with Airbnb/TypeScript configs for JS/TS code
Use camelCase for JS/TS variables and functions
Use PascalCase for JS/TS classes
Prefer kebab-case filenames within JS packages

Files:

  • packages/js-evo-sdk/src/sdk.ts
⏰ 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: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
  • GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
  • GitHub Check: Build JS packages / Build JS
  • GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
  • GitHub Check: Rust crates security audit

@shumkov shumkov merged commit a9b9a2f into v2.1-dev Sep 29, 2025
19 checks passed
@shumkov shumkov deleted the fix/sdk/wasm-not-initialized-for-static-methods branch September 29, 2025 16:02
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