-
Notifications
You must be signed in to change notification settings - Fork 44
fix(wasm-sdk): connect where and orderBy clause functionality for getDocuments #2753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Change field name from "whereClause" to "where" to match query execution expectations - Change field type from "text" to "json" for proper JSON parsing of where and orderBy clauses - Fixes issue where where clauses were being ignored in document queries 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add where clause to filter for dash parent domain and labels starting with "test" - Add orderBy clause to sort results by normalizedLabel in ascending order - Enables testing of document query filtering functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
WalkthroughDocument query input schema updated: Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Tester
participant Fixture as Test Fixture
participant DocsGen as generate_docs.py
participant WasmSDK as WASM SDK/API
participant Platform as Platform API
Tester->>Fixture: run getDocuments test
Fixture->>WasmSDK: getDocuments({ where: JSON, orderBy: JSON, limit })
Note over WasmSDK: Inputs now expected as JSON\n(`where`, `orderBy`)
WasmSDK->>Platform: send query with filters & sort
Platform-->>WasmSDK: documents response
WasmSDK-->>Fixture: return results
Fixture-->>Tester: assertions
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/wasm-sdk/api-definitions.json (1)
1-420
: Replace all remainingwhereClause
references withwhere
All stalewhereClause
occurrences must be updated to match the renamedwhere
input:
- UI tests:
packages/wasm-sdk/test/ui-automation/utils/parameter-injector.js
(selector key)packages/wasm-sdk/test/document-queries.test.mjs
(test parameters)- UI code:
packages/wasm-sdk/index.html
(dynamic whereClause building andrunExample
preview)- Code generators & docs:
packages/wasm-sdk/generate_docs.py
(whereClause parameters)packages/wasm-sdk/CLAUDE.md
andAI_REFERENCE.md
(example snippets and parameter lists)packages/wasm-sdk/docs_manifest.json
andpackages/wasm-sdk/docs.html
(API examples)
🧹 Nitpick comments (2)
packages/wasm-sdk/api-definitions.json (2)
402-407
: Rename + JSON type looks right; add on-type validation and brief operator help.Helps users enter valid JSON and clarifies supported operators.
Apply:
- "name": "where", - "type": "json", + "name": "where", + "type": "json", + "validateOnType": true, "label": "Where Clause (JSON)", "required": false, - "placeholder": "[[\"normalizedParentDomainName\", \"==\", \"dash\"], [\"normalizedLabel\", \"==\", \"therea1s11mshaddy5\"]]" + "placeholder": "[[\"normalizedParentDomainName\", \"==\", \"dash\"], [\"normalizedLabel\", \"startsWith\", \"test\"]]", + "help": "Array of clauses: [[field, op, value], ...]. Ops include ==, !=, <, <=, >, >=, in, startsWith."
409-414
: Switching orderBy to JSON is correct; enable on-type validation and clarify format.Small UX polish to reduce input errors.
Apply:
"name": "orderBy", - "type": "json", + "type": "json", + "validateOnType": true, "label": "Order By (JSON)", "required": false, - "placeholder": "[[\"$createdAt\", \"desc\"]]" + "placeholder": "[[\"$createdAt\", \"desc\"]]", + "help": "Array of [field, direction] pairs. Direction: \"asc\" or \"desc\"."
📜 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.
📒 Files selected for processing (2)
packages/wasm-sdk/api-definitions.json
(1 hunks)packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
📚 Learning: 2025-07-23T08:31:42.268Z
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Applied to files:
packages/wasm-sdk/api-definitions.json
packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
📚 Learning: 2025-07-23T08:31:42.268Z
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Applied to files:
packages/wasm-sdk/api-definitions.json
packages/wasm-sdk/test/ui-automation/fixtures/test-data.js
📚 Learning: 2025-08-14T15:03:56.681Z
Learnt from: thephez
PR: dashpay/platform#2726
File: packages/wasm-sdk/check_documentation.py:69-76
Timestamp: 2025-08-14T15:03:56.681Z
Learning: In packages/wasm-sdk/api-definitions.json, the structure is nested by categories: { "queries": { "categoryName": { "label": "...", "queries": { "actualQueryName": {...} } } } }. The check_documentation.py script correctly iterates over categories and then accesses the nested 'queries'/'transitions' objects within each category to collect the actual query/transition names.
Applied to files:
packages/wasm-sdk/api-definitions.json
⏰ 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). (3)
- GitHub Check: build-wasm-sdk
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: Build JS packages / Build JS
🔇 Additional comments (1)
packages/wasm-sdk/test/ui-automation/fixtures/test-data.js (1)
229-231
: Remove optional array refactor; keep JSON strings forwhere
/orderBy
. The UI harness treats array values via its generic array‐handling branch (not the JSON branch) and will misfill rather than inject a valid JSON clause—so continue usingJSON.stringify
for these fields.Likely an incorrect or invalid review comment.
…changes - Change whereClause to where in generate_docs.py parameter mapping - Regenerate docs with correct field names and types (text→json) - Update AI_REFERENCE.md and docs.html to reflect API definition changes - Fix documentation examples to use correct field name 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add white-space: pre-wrap to preserve formatting in code examples - Add overflow-x: auto to handle long code lines with horizontal scrolling - Ensures code examples remain readable and properly formatted 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/wasm-sdk/generate_docs.py (2)
121-129
: Update stale comment and clarify local var names for dpnsSearchThe comment still mentions whereClause. Also consider renaming local vars to avoid confusion with the new API field names.
Apply this diff:
- # get_documents expects: sdk, contractId, documentType, whereClause, orderBy, limit + # get_documents expects: sdk, contractId, documentType, where (json), orderBy (json), limit - where_clause = 'JSON.stringify([["normalizedLabel", "startsWith", "ali"], ["normalizedParentDomainName", "==", "dash"]])' - order_by = 'JSON.stringify([["normalizedLabel", "asc"]])' - limit = "10" - params = [dpns_contract_id, document_type, where_clause, order_by, limit] + where_json = 'JSON.stringify([["normalizedLabel", "startsWith", "ali"], ["normalizedParentDomainName", "==", "dash"]])' + order_by_json = 'JSON.stringify([["normalizedLabel", "asc"]])' + limit = "10" + params = [dpns_contract_id, document_type, where_json, order_by_json, limit]
665-666
: Example code UX: prevent overflow on long unbroken tokens (optional)If you want very long hex/ids to wrap instead of forcing horizontal scroll, add overflow-wrap.
.example-code { @@ - white-space: pre-wrap; - overflow-x: auto; + white-space: pre-wrap; + overflow-x: auto; + overflow-wrap: anywhere; /* optional */ }
📜 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.
📒 Files selected for processing (4)
packages/wasm-sdk/AI_REFERENCE.md
(1 hunks)packages/wasm-sdk/docs.html
(1 hunks)packages/wasm-sdk/docs_manifest.json
(1 hunks)packages/wasm-sdk/generate_docs.py
(2 hunks)
✅ Files skipped from review due to trivial changes (3)
- packages/wasm-sdk/docs_manifest.json
- packages/wasm-sdk/AI_REFERENCE.md
- packages/wasm-sdk/docs.html
🧰 Additional context used
📓 Path-based instructions (2)
packages/wasm-sdk/generate_docs.py
📄 CodeRabbit inference engine (CLAUDE.md)
Keep documentation for the WASM SDK in sync by running 'python3 generate_docs.py' in 'packages/wasm-sdk'
Files:
packages/wasm-sdk/generate_docs.py
packages/wasm-sdk/**/generate_docs.py
📄 CodeRabbit inference engine (packages/wasm-sdk/CLAUDE.md)
When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.
Files:
packages/wasm-sdk/generate_docs.py
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
📚 Learning: 2025-07-23T08:31:42.268Z
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/generate_docs.py : When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.
Applied to files:
packages/wasm-sdk/generate_docs.py
📚 Learning: 2025-07-23T08:31:42.268Z
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Applied to files:
packages/wasm-sdk/generate_docs.py
📚 Learning: 2025-07-23T08:31:42.268Z
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Applied to files:
packages/wasm-sdk/generate_docs.py
📚 Learning: 2025-07-23T08:31:42.268Z
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.
Applied to files:
packages/wasm-sdk/generate_docs.py
📚 Learning: 2025-07-23T08:31:05.082Z
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/generate_docs.py : Keep documentation for the WASM SDK in sync by running 'python3 generate_docs.py' in 'packages/wasm-sdk'
Applied to files:
packages/wasm-sdk/generate_docs.py
📚 Learning: 2025-07-28T20:00:08.502Z
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.
Applied to files:
packages/wasm-sdk/generate_docs.py
⏰ 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). (3)
- GitHub Check: Build JS packages / Build JS
- GitHub Check: Rust crates security audit
- GitHub Check: build-wasm-sdk
🔇 Additional comments (2)
packages/wasm-sdk/generate_docs.py (2)
86-88
: Good fix: map where/orderBy to JSON stringsUsing JSON.stringify for both aligns with the updated API (json types). LGTM.
86-88
: Remove stalewhereClause
references
All leftoverwhereClause
usages must be updated to usewhere
(type json) andorderBy
per api-definitions.json. This affects:
packages/wasm-sdk/generate_docs.py
(L123; example block at L1766–1779)packages/wasm-sdk/test/document-queries.test.mjs
(L107, L161)packages/wasm-sdk/test/ui-automation/utils/parameter-injector.js
(L87)- Documentation (
CLAUDE.md
at L89,AI_REFERENCE.md
at L1244,index.html
around L1276)⛔ Skipped due to learnings
Learnt from: CR PR: dashpay/platform#0 File: packages/wasm-sdk/CLAUDE.md:0-0 Timestamp: 2025-07-23T08:31:42.268Z Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: CR PR: dashpay/platform#0 File: packages/wasm-sdk/CLAUDE.md:0-0 Timestamp: 2025-07-23T08:31:42.268Z Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: CR PR: dashpay/platform#0 File: packages/wasm-sdk/CLAUDE.md:0-0 Timestamp: 2025-07-23T08:31:42.268Z Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.
Issue being fixed or feature implemented
Fixes a bug where
where
clauses in getDocuments queries were being ignored. The issue was caused by a field name mismatch and incorrect field type handling in the API definitions.What was done?
Fixed API field mapping, enabled JSON parsing, and added test coverage
How Has This Been Tested?
Ran tests locally
Breaking Changes
N/A
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Tests
Documentation