Skip to content

Conversation

@thephez
Copy link
Collaborator

@thephez thephez commented Aug 20, 2025

Summary by CodeRabbit

  • New Features
    • Added prefetch of trusted quorums for testnet.
  • Refactor
    • Renamed and updated APIs: get_single_document → get_document; data_contract_fetch_history → get_data_contract_history (updated parameters); get_epoch_info → get_epochs_info (added count).
    • get_contested_resource_vote_state now requires index_values for index-based lookups.
  • Tests
    • Updated tests to reflect new API names, parameters, and document query semantics.
    • Adjusted DPNS homograph handling expectations to preserve non-homograph special/unicode characters.
  • Chores
    • Simplified WASM SDK CI test workflow into a single comprehensive run with a unified test report artifact.

thephez and others added 6 commits August 20, 2025 10:13
- Fix homograph conversion tests to expect only o/i/l conversion
- Remove invalid tests for uppercase and numeric usernames
- Fix network error handling for WASM non-trusted mode
- All tests now align with actual DPNS contract validation rules

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…source_vote_state test

The get_contested_resource_vote_state function requires an index_values parameter
but the test was calling it without this parameter, causing it to fail with
"Cannot read properties of null (reading 'length')".

Fixed by adding [TEST_PARENT_DOMAIN, TEST_LABEL] as the index_values parameter,
matching the pattern used in other contested resource tests and UI automation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…t.mjs

- Fix incorrect function names: get_single_document → get_document, data_contract_fetch_history → get_data_contract_history, get_epoch_info → get_epochs_info
- Fix function parameters: remove extra prove parameter, add required count parameter
- Add quorum prefetching to resolve epoch query authentication issues
- Use better test data from test-data.js with contracts that have actual history
- Fix query structure: use indexed properties for orderBy, add required orderBy for range queries
- Switch to existing contracts: use Dashpay contract and contract with history

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Fix testSerialization test to use 'simple' instead of 'string' parameter
- Fix start function test to avoid panic by checking existence only
- All utility tests now pass (12/12)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Consolidate multiple test execution steps into single comprehensive test suite runner for cleaner CI workflow.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Consolidates the Wasm SDK test workflow into a single comprehensive run and artifact. Updates multiple test suites to match renamed/retuned SDK APIs, new parameters (e.g., index_values), adjusted behaviors, and revised test data. Removes obsolete tests and steps, introduces prefetching and new history/epoch query signatures.

Changes

Cohort / File(s) Summary
Workflow: Consolidated Wasm SDK tests
.github/workflows/wasm-sdk-tests.yml
Renamed the main step to “Run comprehensive test suite” executing node test/run-all-tests.mjs. Removed separate Jest and per-file runs. Replaced “Upload test results” with “Upload test report” uploading packages/wasm-sdk/test/test-report.html as wasm-sdk-test-report. Updated console messages.
Document queries and API alignment
packages/wasm-sdk/test/document-queries.test.mjs
Aligned tests to new API: get_single_documentget_document, data_contract_fetch_historyget_data_contract_history(...), get_epoch_infoget_epochs_info(...) (with count). Added prefetch_trusted_quorums_testnet(). Switched to normalizedParentDomainName filters, updated ordering semantics, contract IDs, and history/epoch parameters.
DPNS behavior adjustments
packages/wasm-sdk/test/dpns.test.mjs
Updated homograph-safe conversion expectations to preserve special chars and non-targeted Unicode. Broadened expected network error message handling. Removed username validation tests (uppercase, numbers/starts-with-number). Minor wording/structure updates.
Utilities tests cleanup
packages/wasm-sdk/test/utilities-simple.test.mjs
testSerialization now uses “simple” and asserts non-null object. Replaced double start() invocation test with existence check only, noting auto-init and avoiding panic.
Contested resources voting API change
packages/wasm-sdk/test/voting-contested-resources.test.mjs, packages/wasm-sdk/pkg/wasm_sdk.js
Updated get_contested_resource_vote_state signature to include index_values (Array) between index_name and result_type. Tests now pass [TEST_PARENT_DOMAIN, TEST_LABEL]. Removed obsolete unsupported-index-values handling; simplified error branches.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Test as Test Runner
  participant SDK as wasmSdk
  participant Platform as Platform Node

  Note over Test,SDK: Contested resource voting (updated API)
  Test->>SDK: get_contested_resource_vote_state(sdk, contractId, docType, indexName, indexValues[], resultType)
  SDK->>Platform: Query vote state by indexName + indexValues
  alt Success
    Platform-->>SDK: VoteStateResult
    SDK-->>Test: Result
  else Network/Connection error
    Platform-->>SDK: Error
    SDK-->>Test: Propagate error
  end
Loading
sequenceDiagram
  autonumber
  actor CI as GitHub Actions
  participant Runner as Job Runner
  participant Node as Node.js

  Note over CI,Runner: Consolidated Wasm SDK test workflow
  CI->>Runner: Start job
  Runner->>Node: node test/run-all-tests.mjs
  alt Tests complete
    Node-->>Runner: test-report.html
    Runner-->>CI: Upload artifact wasm-sdk-test-report
  else Failure
    Node-->>Runner: Non-zero exit
    Runner-->>CI: Mark job failed
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • QuantumExplorer
  • pshenmic
  • shumkov

Poem

A rabbit taps keys in a rhythmic spree,
Tests now march as one, in harmony.
Documents fetched, epochs in line,
Index values nibble data fine.
Artifacts hop to a single report—
All tidy burrows in our CI fort. 🐇✨

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.


📜 Recent review details

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

💡 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 cfd9b57 and a789b41.

📒 Files selected for processing (5)
  • .github/workflows/wasm-sdk-tests.yml (1 hunks)
  • packages/wasm-sdk/test/document-queries.test.mjs (10 hunks)
  • packages/wasm-sdk/test/dpns.test.mjs (3 hunks)
  • packages/wasm-sdk/test/utilities-simple.test.mjs (2 hunks)
  • packages/wasm-sdk/test/voting-contested-resources.test.mjs (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@thephez thephez closed this Aug 20, 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