-
Notifications
You must be signed in to change notification settings - Fork 13
Re-enable Volume tab with Float-based volume calculations #2375
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis PR adds a public Changes
Sequence Diagram(s)sequenceDiagram
participant Client as RaindexClient (UI)
participant Order as RaindexOrder (common)
participant Subgraph as OrderbookSubgraphClient
participant Perf as performance::vol
Client->>Order: get_vaults_volume(orderHash, period)
Order->>Subgraph: order_vaults_volume(orderHash, period)
Subgraph->>Perf: get_vaults_vol(trades)
Perf->>Perf: Parse amounts (hex → Float)
Perf->>Perf: Build/aggregate VolumeDetails (total_in, total_out)
Perf->>Subgraph: Vec<VaultVolume>
Subgraph->>Order: return vault volumes
Order->>Client: Vec<RaindexVaultVolume> (converted via from_volume_details)
Note over Perf: total_vol = total_in + total_out<br/>net_vol = total_in - total_out
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (3)crates/**/*.rs📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/crates/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.rs📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (29)📓 Common learnings📚 Learning: 2025-08-01T09:07:20.383ZApplied to files:
📚 Learning: 2025-07-31T19:34:11.716ZApplied to files:
📚 Learning: 2025-06-24T08:46:03.368ZApplied to files:
📚 Learning: 2025-07-16T10:40:05.717ZApplied to files:
📚 Learning: 2025-08-01T07:44:53.910ZApplied to files:
📚 Learning: 2025-05-17T15:32:28.733ZApplied to files:
📚 Learning: 2025-08-02T03:55:25.215ZApplied to files:
📚 Learning: 2025-05-09T05:21:40.234ZApplied to files:
📚 Learning: 2025-07-16T05:52:05.576ZApplied to files:
📚 Learning: 2025-07-21T16:34:31.193ZApplied to files:
📚 Learning: 2025-07-15T08:01:38.534ZApplied to files:
📚 Learning: 2025-06-20T07:51:08.790ZApplied to files:
📚 Learning: 2025-06-17T16:32:04.554ZApplied to files:
📚 Learning: 2025-07-04T10:24:56.163ZApplied to files:
📚 Learning: 2025-10-18T10:38:41.273ZApplied to files:
📚 Learning: 2025-06-24T13:36:28.797ZApplied to files:
📚 Learning: 2025-10-06T14:13:18.531ZApplied to files:
📚 Learning: 2025-10-02T19:17:20.332ZApplied to files:
📚 Learning: 2025-06-17T16:21:24.384ZApplied to files:
📚 Learning: 2025-12-18T08:19:55.397ZApplied to files:
📚 Learning: 2025-08-02T02:34:32.237ZApplied to files:
📚 Learning: 2025-06-07T05:19:46.330ZApplied to files:
📚 Learning: 2025-05-20T10:20:08.206ZApplied to files:
📚 Learning: 2025-07-21T16:37:20.599ZApplied to files:
📚 Learning: 2025-07-18T10:31:05.498ZApplied to files:
📚 Learning: 2025-05-09T05:28:22.089ZApplied to files:
📚 Learning: 2025-12-17T13:17:58.487ZApplied to files:
📚 Learning: 2025-07-04T10:27:22.544ZApplied to files:
⏰ 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). (19)
🔇 Additional comments (3)
Comment |
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: 2
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (10)
crates/common/src/raindex_client/orders.rscrates/common/src/raindex_client/vaults.rscrates/subgraph/src/orderbook_client/mod.rscrates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/mod.rscrates/subgraph/src/performance/vol.rspackages/orderbook/test/js_api/raindexClient.test.tspackages/ui-components/src/__tests__/OrderVaultsVolTable.test.tspackages/ui-components/src/lib/components/detail/OrderDetail.sveltepackages/ui-components/src/lib/components/tables/OrderVaultsVolTable.svelte
🧰 Additional context used
📓 Path-based instructions (11)
crates/**/*.rs
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
crates/**/*.rs: For Rust crates incrates/*, run lints usingnix develop -c cargo clippy --workspace --all-targets --all-features -D warnings
For Rust crates incrates/*, run tests usingnix develop -c cargo test --workspaceor--package <crate>
Files:
crates/subgraph/src/orderbook_client/mod.rscrates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/vol.rscrates/subgraph/src/performance/mod.rscrates/common/src/raindex_client/vaults.rs
**/crates/**
📄 CodeRabbit inference engine (AGENTS.md)
Rust workspace organized as
crates/*with subdirectories: cli, common, bindings, js_api, quote, subgraph, settings, math, integration_tests
Files:
crates/subgraph/src/orderbook_client/mod.rscrates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/vol.rscrates/subgraph/src/performance/mod.rscrates/common/src/raindex_client/vaults.rs
**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
**/*.rs: Rust: format code withnix develop -c cargo fmt --all
Rust: lint withnix develop -c rainix-rs-static(preconfigured flags included)
Rust: crates and modules usesnake_case; types usePascalCase
Files:
crates/subgraph/src/orderbook_client/mod.rscrates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/vol.rscrates/subgraph/src/performance/mod.rscrates/common/src/raindex_client/vaults.rs
packages/ui-components/**/*.{svelte,ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
For UI components (
packages/ui-components), run lints and format checks usingnix develop -c npm run svelte-lint-format-check -w @rainlanguage/ui-components
Files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltepackages/ui-components/src/lib/components/detail/OrderDetail.sveltepackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
packages/{webapp,ui-components}/**/*.{svelte,ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
If you modify frontend code or functionality affecting the frontend, you MUST provide a screenshot of the built webapp reflecting your change.
Files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltepackages/ui-components/src/lib/components/detail/OrderDetail.sveltepackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
packages/**/*.{js,ts,svelte}
📄 CodeRabbit inference engine (AGENTS.md)
JavaScript/Svelte organized as
packages/*including webapp, ui-components, and orderbook (wasm wrapper published to npm)
Files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltepackages/orderbook/test/js_api/raindexClient.test.tspackages/ui-components/src/lib/components/detail/OrderDetail.sveltepackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
**/*.{ts,tsx,svelte}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,svelte}: TypeScript/Svelte: format withnix develop -c npm run format
TypeScript/Svelte: lint withnix develop -c npm run lint
TypeScript/Svelte: type-check withnix develop -c npm run check
Files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltepackages/orderbook/test/js_api/raindexClient.test.tspackages/ui-components/src/lib/components/detail/OrderDetail.sveltepackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
**/*.svelte
📄 CodeRabbit inference engine (AGENTS.md)
Svelte components should use
PascalCase.sveltenaming convention; other files use kebab or snake case as appropriate
Files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltepackages/ui-components/src/lib/components/detail/OrderDetail.svelte
packages/orderbook/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
packages/orderbook/**/*.{ts,tsx,js,jsx}: For Orderbook TypeScript (packages/orderbook), run lints usingnix develop -c npm run check -w @rainlanguage/orderbook
For Orderbook TypeScript (packages/orderbook), run tests usingnix develop -c npm run test -w @rainlanguage/orderbook
Files:
packages/orderbook/test/js_api/raindexClient.test.ts
**/*.{test,spec}.ts
📄 CodeRabbit inference engine (AGENTS.md)
TypeScript/Svelte: run tests with
nix develop -c npm run test(Vitest). Name test files*.test.tsor*.spec.ts
Files:
packages/orderbook/test/js_api/raindexClient.test.tspackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
packages/ui-components/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
For UI components (
packages/ui-components), run tests usingnix develop -c npm run test -w @rainlanguage/ui-components
Files:
packages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
🧠 Learnings (65)
📓 Common learnings
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2000
File: crates/common/src/raindex_client/vaults.rs:183-183
Timestamp: 2025-07-16T10:40:05.717Z
Learning: In the rainlanguage/rain.orderbook codebase, user findolor considers breaking changes from Option<U256> to U256 for required fields like decimals in RaindexVaultToken to be acceptable and safe, even when they affect multiple usage sites across the codebase.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:26:31.566Z
Learning: For PR #1884 and future PRs in rainlanguage/rain.orderbook repository, provide PR size reports in a separate comment with ONLY the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number", without any additional text or explanation. Reports should exclude irrelevant files such as lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock).
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T23:09:27.578Z
Learning: For PR #1884 in rainlanguage/rain.orderbook repository, I must always reassess the PR size after each new commit, calculating the total changes up to the very latest commit and ensuring accuracy of the report. The calculation must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock) and report in the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number".
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T23:09:46.344Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, I must reassess the PR size after each new commit to ensure the report includes the latest changes, and calculate the total size up to the very latest commit.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1994
File: crates/common/src/raindex_client/vaults.rs:59-59
Timestamp: 2025-07-16T05:52:05.576Z
Learning: User findolor prefers to handle documentation updates for getter methods in batch via dedicated PRs rather than addressing them individually during feature development, as mentioned for the formatted amount string fields in crates/common/src/raindex_client/vaults.rs.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1956
File: packages/ui-components/src/lib/components/ButtonVaultLink.svelte:18-18
Timestamp: 2025-07-04T09:13:39.020Z
Learning: In the RaindexVault type, the vaultId field is a bigint, so bigintToHex should be used instead of bigintStringToHex when converting vault IDs to hex format in UI components.
📚 Learning: 2025-05-09T05:28:22.089Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1744
File: crates/js_api/src/subgraph/order.rs:109-114
Timestamp: 2025-05-09T05:28:22.089Z
Learning: In the rain.orderbook project, SubgraphError contains or converts from OrderbookSubgraphClientError, so using OrderbookSubgraphClientError in error creation followed by a conversion to SubgraphError (via ? operator) is acceptable.
Applied to files:
crates/subgraph/src/orderbook_client/mod.rscrates/subgraph/src/performance/mod.rscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-07-18T10:31:05.498Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2008
File: crates/common/src/raindex_client/add_orders.rs:85-86
Timestamp: 2025-07-18T10:31:05.498Z
Learning: In the rainlanguage/rain.orderbook codebase, cfg-guarded imports like `#[cfg(not(target_family = "wasm"))] use super::*;` in test modules are sometimes needed to fix compiler warnings, even when similar imports exist in nested sub-modules. These should not be removed as they serve a specific purpose in the compilation process.
Applied to files:
crates/subgraph/src/orderbook_client/mod.rscrates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/vol.rscrates/subgraph/src/performance/mod.rscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-07-21T16:34:31.193Z
Learnt from: 0xgleb
Repo: rainlanguage/rain.orderbook PR: 1911
File: crates/subgraph/src/types/impls.rs:7-15
Timestamp: 2025-07-21T16:34:31.193Z
Learning: In the rainlanguage/rain.orderbook codebase, user 0xgleb considers breaking changes that remove unsafe default behaviors to be intentional and acceptable. Specifically, the get_decimals() method in crates/subgraph/src/types/impls.rs was intentionally changed to return MissingDecimals error instead of defaulting to 18 decimals, as defaulting to 18 is considered unsafe and should never have been done.
Applied to files:
crates/subgraph/src/orderbook_client/mod.rscrates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/vol.rscrates/subgraph/src/performance/mod.rscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-07-21T16:37:20.599Z
Learnt from: 0xgleb
Repo: rainlanguage/rain.orderbook PR: 1911
File: crates/subgraph/src/utils/mod.rs:1-1
Timestamp: 2025-07-21T16:37:20.599Z
Learning: In the rainlanguage/rain.orderbook codebase, user 0xgleb prefers explicit module imports over re-exporting symbols at higher levels. Specifically for the float constants in crates/subgraph/src/utils/float.rs, they prefer using `utils::float::*` rather than re-exporting with `pub use float::*` in the utils module, as the explicit import makes it clearer what is being imported and why it's needed.
Applied to files:
crates/subgraph/src/orderbook_client/mod.rscrates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/mod.rscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-12-03T10:40:25.429Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2344
File: crates/common/src/local_db/pipeline/runner/mod.rs:18-31
Timestamp: 2025-12-03T10:40:25.429Z
Learning: In `crates/common/src/local_db/pipeline/runner/mod.rs`, the `TargetSuccess` struct does not need separate `ob_id` or `orderbook_key` fields because the contained `SyncOutcome` already includes orderbook identification information such as chain_id and orderbook_address. This avoids redundant data duplication.
Applied to files:
crates/subgraph/src/orderbook_client/mod.rscrates/subgraph/src/orderbook_client/performance.rs
📚 Learning: 2025-06-24T08:46:03.368Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1947
File: crates/common/src/raindex_client/orders.rs:98-125
Timestamp: 2025-06-24T08:46:03.368Z
Learning: In the vault merging logic in crates/common/src/raindex_client/orders.rs, optimization isn't necessary because the maximum list items are usually around 5 items. For such small datasets, the simple three-loop approach is preferred over HashMap-based optimization due to clarity and minimal performance impact.
Applied to files:
crates/subgraph/src/orderbook_client/mod.rscrates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rs
📚 Learning: 2025-10-06T14:13:18.531Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2155
File: crates/common/src/raindex_client/trades.rs:133-152
Timestamp: 2025-10-06T14:13:18.531Z
Learning: In the rain.orderbook codebase, the `page` parameter in `RaindexOrder::get_trades_list` method (in crates/common/src/raindex_client/trades.rs) is kept for backwards compatibility with subgraph logic, but the LocalDb fast-path intentionally returns all trades without implementing pagination.
Applied to files:
crates/subgraph/src/orderbook_client/mod.rspackages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltecrates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rs
📚 Learning: 2025-05-17T15:32:28.733Z
Learnt from: 0xgleb
Repo: rainlanguage/rain.orderbook PR: 1790
File: tauri-app/src-tauri/src/commands/vault.rs:67-67
Timestamp: 2025-05-17T15:32:28.733Z
Learning: For the PR focused on testing Tauri commands::order module, the generic type parameter R: Runtime was selectively added where needed for the PR scope, applying the changes primarily to order.rs and related files while leaving other modules like vault.rs for potential future refactoring.
Applied to files:
crates/subgraph/src/orderbook_client/mod.rspackages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltecrates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rs
📚 Learning: 2025-05-19T13:40:56.080Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1858
File: crates/subgraph/src/orderbook_client/mod.rs:54-58
Timestamp: 2025-05-19T13:40:56.080Z
Learning: The `wasm_bindgen_utils` crate in the Rain Orderbook project handles conditional compilation for `JsValue` and `JsError` internally, allowing `impl From<Error> for JsValue` to work on non-WASM targets without explicit cfg guards.
Applied to files:
crates/subgraph/src/orderbook_client/mod.rs
📚 Learning: 2025-07-26T06:56:28.207Z
Learnt from: hardyjosh
Repo: rainlanguage/rain.orderbook PR: 2035
File: packages/ui-components/src/lib/components/tables/OrdersListTable.svelte:167-174
Timestamp: 2025-07-26T06:56:28.207Z
Learning: In OrdersListTable.svelte, maintainer hardyjosh considers keyed each-blocks unnecessary for item.inputs and item.outputs arrays because the entire query result updates at once during refresh, making DOM diffing optimizations negligible when the whole dataset is replaced rather than individual items being modified.
Applied to files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltepackages/ui-components/src/lib/components/detail/OrderDetail.svelte
📚 Learning: 2025-06-27T17:34:15.825Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 1957
File: packages/ui-components/src/lib/components/tables/VaultsListTable.svelte:60-60
Timestamp: 2025-06-27T17:34:15.825Z
Learning: In the VaultsListTable.svelte component, the `activeAccounts` store is redundant in query keys when the `owners` variable (derived from `activeAccountsItems`) is already included, as `owners` is what's actually used in the query function while `activeAccounts` is just a transformed version of the same data.
Applied to files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltepackages/ui-components/src/lib/components/detail/OrderDetail.svelte
📚 Learning: 2025-04-10T16:32:51.198Z
Learnt from: hardingjam
Repo: rainlanguage/rain.orderbook PR: 1651
File: packages/ui-components/src/lib/components/TanstackAppTable.svelte:13-13
Timestamp: 2025-04-10T16:32:51.198Z
Learning: In the TanstackAppTable.svelte component, the queryKey prop should be required (type: string) rather than optional (string | undefined) to ensure proper query invalidation.
Applied to files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltepackages/ui-components/src/lib/components/detail/OrderDetail.svelte
📚 Learning: 2025-04-11T06:05:46.473Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1599
File: tauri-app/src/routes/orders/add/+page.svelte:287-287
Timestamp: 2025-04-11T06:05:46.473Z
Learning: The ScenarioDebugTable component in tauri-app/src/routes/orders/add/+page.svelte has been designed to manage its own data fetching internally without requiring a chartData prop.
Applied to files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltepackages/ui-components/src/lib/components/detail/OrderDetail.svelte
📚 Learning: 2025-09-02T08:04:44.814Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2117
File: packages/ui-components/src/__tests__/VaultIdInformation.test.ts:9-13
Timestamp: 2025-09-02T08:04:44.814Z
Learning: In packages/ui-components/src/__tests__/VaultIdInformation.test.ts and similar test files in the rain.orderbook project, the passthrough vi.mock('rainlanguage/orderbook', async (importOriginal) => { return { ...(await importOriginal()) }; }); block is required for tests to run properly, even when not overriding any exports. This is needed due to the specific Vitest configuration or test environment setup in the project.
Applied to files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltepackages/orderbook/test/js_api/raindexClient.test.tspackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-07-17T10:36:02.846Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1996
File: packages/ui-components/src/__tests__/VaultIdInformation.test.ts:6-6
Timestamp: 2025-07-17T10:36:02.846Z
Learning: In packages/ui-components/src/__tests__/VaultIdInformation.test.ts, findolor prefers to keep exported type aliases like `VaultIdInformationComponentProps` in test files, even when static analysis tools flag this as discouraged practice.
Applied to files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltepackages/ui-components/src/lib/components/detail/OrderDetail.sveltepackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-08-01T07:44:53.910Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2036
File: crates/js_api/src/filters/raindex_filter_store.rs:319-336
Timestamp: 2025-08-01T07:44:53.910Z
Learning: In the rainlanguage/rain.orderbook project's RaindexFilterStore (crates/js_api/src/filters/raindex_filter_store.rs), the team chose a simplified monolithic approach with hard-coded keys and default auto-save behavior over configurable stores. The update_vaults method intentionally auto-saves to both localStorage and URL after each update as the default behavior, following a design evolution from a previous configurable approach.
Applied to files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltecrates/common/src/raindex_client/orders.rs
📚 Learning: 2025-03-31T10:16:53.544Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1469
File: packages/ui-components/src/__tests__/CodeMirrorDotrain.test.ts:75-98
Timestamp: 2025-03-31T10:16:53.544Z
Learning: In the rainlanguage/rain.orderbook project, direct manipulation of Svelte's internal state (component.$$.ctx) in tests is an acceptable approach for testing component behavior, as demonstrated in the CodeMirrorDotrain tests.
Applied to files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltepackages/ui-components/src/lib/components/detail/OrderDetail.sveltepackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-07-31T19:34:11.716Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2044
File: crates/common/src/raindex_client/vaults_list.rs:363-423
Timestamp: 2025-07-31T19:34:11.716Z
Learning: In the rainlanguage/rain.orderbook project, for WASM-exposed functionality like VaultsList, the team prefers to keep comprehensive tests in the non-WASM environment due to the complexity of recreating objects like RaindexVaults in WASM. WASM tests focus on basic functionality and error cases since the WASM code reuses the already-tested non-WASM implementation.
Applied to files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.sveltecrates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/vol.rspackages/orderbook/test/js_api/raindexClient.test.tspackages/ui-components/src/__tests__/OrderVaultsVolTable.test.tscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-06-07T05:19:04.767Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1872
File: packages/webapp/src/lib/services/handleVaultWithdraw.ts:50-54
Timestamp: 2025-06-07T05:19:04.767Z
Learning: In the rainlanguage/rain.orderbook codebase, the team prefers pragmatic code approaches over strict TypeScript patterns when the current implementation is sufficient for their use case, such as using `if (result.error)` instead of `if ('error' in result)` for discriminated union type checking.
Applied to files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.svelte
📚 Learning: 2025-04-17T08:47:59.930Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1599
File: tauri-app/src/lib/components/ScenarioDebugTable.svelte:46-53
Timestamp: 2025-04-17T08:47:59.930Z
Learning: The ScenarioDebugTable component in tauri-app/src/lib/components/ScenarioDebugTable.svelte has been designed to manage its own data fetching internally without requiring a chartData prop.
Applied to files:
packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.svelte
📚 Learning: 2025-08-01T09:07:20.383Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2044
File: packages/orderbook/README.md:186-189
Timestamp: 2025-08-01T09:07:20.383Z
Learning: In the rainlanguage/rain.orderbook project, Rust methods on structs like RaindexVaultsList are exported as JavaScript getters in WASM bindings using #[wasm_bindgen(getter)]. This means while the Rust code uses method calls like items(), the JavaScript/WASM API exposes them as property access like .items. The README.md correctly documents the JavaScript API surface, not the Rust implementation details.
Applied to files:
crates/common/src/raindex_client/orders.rscrates/subgraph/src/performance/vol.rscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-07-16T10:40:05.717Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2000
File: crates/common/src/raindex_client/vaults.rs:183-183
Timestamp: 2025-07-16T10:40:05.717Z
Learning: In the rainlanguage/rain.orderbook codebase, user findolor considers breaking changes from Option<U256> to U256 for required fields like decimals in RaindexVaultToken to be acceptable and safe, even when they affect multiple usage sites across the codebase.
Applied to files:
crates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/vol.rscrates/subgraph/src/performance/mod.rscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-07-16T05:52:05.576Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1994
File: crates/common/src/raindex_client/vaults.rs:59-59
Timestamp: 2025-07-16T05:52:05.576Z
Learning: User findolor prefers to handle documentation updates for getter methods in batch via dedicated PRs rather than addressing them individually during feature development, as mentioned for the formatted amount string fields in crates/common/src/raindex_client/vaults.rs.
Applied to files:
crates/common/src/raindex_client/orders.rscrates/subgraph/src/performance/vol.rscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-05-09T05:21:40.234Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1744
File: crates/js_api/src/subgraph/vault.rs:19-37
Timestamp: 2025-05-09T05:21:40.234Z
Learning: In the rain.orderbook project, the developer prefers to use tuple structs for WASM wrappers (like VaultCalldataResult, GetVaultsResult) rather than structs with named fields.
Applied to files:
crates/common/src/raindex_client/orders.rs
📚 Learning: 2025-08-02T03:55:25.215Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2036
File: packages/orderbook/test/js_api/filters.test.ts:19-36
Timestamp: 2025-08-02T03:55:25.215Z
Learning: In the rainlanguage/rain.orderbook project's WASM tests, the pattern of chaining `.value!` calls on WASM result types (like from VaultsFilterBuilder methods) is the established and preferred approach for handling WASM results, and should not be refactored into intermediate variables as it would add unnecessary verbosity without improving the code.
Applied to files:
crates/common/src/raindex_client/orders.rscrates/subgraph/src/performance/vol.rspackages/orderbook/test/js_api/raindexClient.test.tscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-06-20T07:51:08.790Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1941
File: crates/js_api/src/raindex/vaults.rs:175-181
Timestamp: 2025-06-20T07:51:08.790Z
Learning: In the RaindexClient vault methods, `&self` parameters are intentionally kept for API consistency to make all vault operations instance methods, even when the methods don't use client state. This is a design preference for maintaining a uniform interface.
Applied to files:
crates/common/src/raindex_client/orders.rscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-06-24T13:36:28.797Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1950
File: crates/common/src/raindex_client/orders.rs:301-301
Timestamp: 2025-06-24T13:36:28.797Z
Learning: In the RaindexClient codebase, when Arc::new(RwLock::new(self.clone())) is used (e.g., in get_orders and get_order_by_hash methods), this creates new Arc/RwLock wrappers around a cloned RaindexClient, but the underlying client data is functionally the same. This pattern is used to provide the correct Arc<RwLock<RaindexClient>> type expected by RaindexOrder::try_from_sg_order() method.
Applied to files:
crates/common/src/raindex_client/orders.rs
📚 Learning: 2025-10-18T10:38:41.273Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2237
File: crates/common/src/raindex_client/local_db/sync.rs:79-89
Timestamp: 2025-10-18T10:38:41.273Z
Learning: In `crates/common/src/raindex_client/local_db/sync.rs`, the sync_database method currently only supports indexing a single orderbook per chain ID, which is why `.first()` is used to select the orderbook configuration. Multi-orderbook support per chain ID is planned for future PRs.
Applied to files:
crates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rs
📚 Learning: 2025-06-17T16:21:24.384Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1903
File: crates/settings/src/yaml/orderbook.rs:371-377
Timestamp: 2025-06-17T16:21:24.384Z
Learning: In crates/settings/src/yaml/orderbook.rs tests, the user findolor considers RPC ordering in Vec<Url> assertions to be intentional and not a test brittleness issue. The ordering of RPCs in tests should be preserved as specified.
Applied to files:
crates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/vol.rs
📚 Learning: 2025-12-18T08:19:55.397Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2363
File: crates/common/src/take_orders/preflight.rs:80-107
Timestamp: 2025-12-18T08:19:55.397Z
Learning: In crates/common/src/take_orders/preflight.rs, the simulate_take_orders function intentionally returns () and discards the simulation result data because it only needs to verify that the transaction doesn't revert with the given parameters, without requiring access to output amounts or other returndata.
Applied to files:
crates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rs
📚 Learning: 2025-07-04T10:24:56.163Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1956
File: crates/common/src/raindex_client/trades.rs:215-223
Timestamp: 2025-07-04T10:24:56.163Z
Learning: In the rain.orderbook codebase, the get_trade_count method implementation that fetches all trades to count them is intentionally consistent with previous implementations and not considered a performance issue, as indicated by findolor for the trades counting functionality in crates/common/src/raindex_client/trades.rs.
Applied to files:
crates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rs
📚 Learning: 2025-08-02T02:34:32.237Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2036
File: crates/js_api/src/filters/raindex_filter_store.rs:446-533
Timestamp: 2025-08-02T02:34:32.237Z
Learning: In the rainlanguage/rain.orderbook project's RaindexFilterStore WASM tests (crates/js_api/src/filters/raindex_filter_store.rs), brusherru decided to focus on testing only methods without side effects (that don't use web_sys) due to difficulties with mocking localStorage and window APIs in the WASM test environment. This pragmatic approach tests pure logic separately from browser integration.
Applied to files:
crates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/vol.rspackages/orderbook/test/js_api/raindexClient.test.tspackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-06-07T05:19:46.330Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1872
File: packages/webapp/src/__tests__/handleVaultDeposit.test.ts:20-53
Timestamp: 2025-06-07T05:19:46.330Z
Learning: In the rain.orderbook codebase, simple wrapper/adapter functions that just delegate to other functions (like handleVaultDeposit) don't need extensive edge case testing for missing parameters or error handling - the current test coverage focusing on core functionality is sufficient.
Applied to files:
crates/common/src/raindex_client/orders.rspackages/orderbook/test/js_api/raindexClient.test.tscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-05-20T10:20:08.206Z
Learnt from: 0xgleb
Repo: rainlanguage/rain.orderbook PR: 1859
File: crates/quote/src/quote_debug.rs:472-492
Timestamp: 2025-05-20T10:20:08.206Z
Learning: In the Rain Orderbook codebase, the `#[tokio::test(flavor = "multi_thread")]` annotation is specifically needed for tests that use `LocalEvm`, not just for consistency across all async tests.
Applied to files:
crates/common/src/raindex_client/orders.rscrates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/vol.rs
📚 Learning: 2025-06-17T16:32:04.554Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1903
File: crates/js_api/src/gui/order_operations.rs:124-134
Timestamp: 2025-06-17T16:32:04.554Z
Learning: In the rain.orderbook codebase, RPC lists are typically small (2 items maximum), so performance optimizations around cloning and converting small Vec<Url> collections are generally unnecessary.
Applied to files:
crates/common/src/raindex_client/orders.rscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-05-19T12:09:10.694Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1858
File: crates/subgraph/src/orderbook_client/vault.rs:81-92
Timestamp: 2025-05-19T12:09:10.694Z
Learning: The `vault_balance_changes_list` function in OrderbookSubgraphClient uses a different pagination approach compared to other list methods. It uses hard-coded GraphQL query parameters (first=200, skip=0) while still accepting pagination arguments, and the pagination is handled by special logic inside the `query_paginated` method that properly processes these values.
Applied to files:
crates/subgraph/src/orderbook_client/performance.rs
📚 Learning: 2025-07-15T08:01:38.534Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1994
File: crates/common/src/raindex_client/vaults.rs:282-292
Timestamp: 2025-07-15T08:01:38.534Z
Learning: In the rainlanguage/rain.orderbook codebase, findolor prefers to avoid concurrency optimizations like using `futures::future::try_join_all` for parallel processing of balance changes, considering such optimizations "not that critical at the moment" when the performance impact is minimal.
Applied to files:
crates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/mod.rscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-10-02T19:17:20.332Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2163
File: crates/common/src/raindex_client/orders.rs:738-741
Timestamp: 2025-10-02T19:17:20.332Z
Learning: In crates/common/src/raindex_client/orders.rs, fetch_dotrain_source() is intentionally called in try_from_sg_order for every order conversion because the dotrain source information is needed immediately. A future optimization with local DB logic is planned to eliminate the network round-trip concern.
Applied to files:
crates/subgraph/src/orderbook_client/performance.rs
📚 Learning: 2025-07-04T10:27:22.544Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1956
File: crates/common/src/raindex_client/orders.rs:609-609
Timestamp: 2025-07-04T10:27:22.544Z
Learning: In the rainlanguage/rain.orderbook codebase, user findolor prefers not to implement overflow protection for trades count casting (usize to u16) at this time, considering it unnecessary for the current scope since the practical risk of orders having 65,535+ trades is extremely low.
Applied to files:
crates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/vol.rscrates/subgraph/src/performance/mod.rscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-07-21T16:34:04.947Z
Learnt from: 0xgleb
Repo: rainlanguage/rain.orderbook PR: 1911
File: crates/common/src/raindex_client/orders.rs:720-720
Timestamp: 2025-07-21T16:34:04.947Z
Learning: In the rainlanguage/rain.orderbook codebase, user 0xgleb prefers using `.unwrap()` in test code rather than `.expect()` with descriptive messages, considering the direct unwrap approach acceptable for test contexts where failures should be fast and clear.
Applied to files:
crates/subgraph/src/orderbook_client/performance.rscrates/subgraph/src/performance/vol.rs
📚 Learning: 2025-11-25T16:50:31.752Z
Learnt from: CR
Repo: rainlanguage/rain.orderbook PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T16:50:31.752Z
Learning: Applies to crates/integration_tests/**/*.rs : Rust: write tests using `cargo test`; integration tests live in `crates/integration_tests`. Prefer `insta` snapshots and `proptest` where helpful
Applied to files:
crates/subgraph/src/performance/vol.rs
📚 Learning: 2025-12-17T13:17:58.487Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2360
File: crates/common/src/test_helpers.rs:329-367
Timestamp: 2025-12-17T13:17:58.487Z
Learning: In the rainlanguage/rain.orderbook codebase, findolor considers hardcoded values (like decimals) acceptable in test helper functions such as deposit_to_orderbook in crates/common/src/test_helpers.rs, as test infrastructure doesn't need the same level of parameterization as production code.
Applied to files:
crates/subgraph/src/performance/vol.rscrates/common/src/raindex_client/vaults.rs
📚 Learning: 2025-05-13T20:06:22.602Z
Learnt from: 0xgleb
Repo: rainlanguage/rain.orderbook PR: 1713
File: crates/settings/src/remote/chains/mod.rs:43-226
Timestamp: 2025-05-13T20:06:22.602Z
Learning: When writing tests for collections of complex objects in Rust, prefer item-by-item comparison over direct vector comparison to get more specific error messages that pinpoint exactly which item and field has a mismatch.
Applied to files:
crates/subgraph/src/performance/vol.rs
📚 Learning: 2025-06-04T10:21:01.388Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1907
File: packages/orderbook/test/common/test.test.ts:75-77
Timestamp: 2025-06-04T10:21:01.388Z
Learning: The DotrainOrder.create API in packages/orderbook/test/common/test.test.ts is internal and not used directly in consumer applications, so API changes here don't require external breaking change documentation.
Applied to files:
packages/orderbook/test/js_api/raindexClient.test.tspackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-04-04T11:25:21.518Z
Learnt from: hardingjam
Repo: rainlanguage/rain.orderbook PR: 1559
File: packages/ui-components/src/__tests__/OrderOrVaultHash.test.ts:94-94
Timestamp: 2025-04-04T11:25:21.518Z
Learning: In the rain.orderbook project, minimal test fixtures are preferred over complete mocks that implement the entire interface. Type casting (e.g., `as unknown as SgVault`) is an acceptable approach to maintain both minimal fixtures and TypeScript type compatibility.
Applied to files:
packages/orderbook/test/js_api/raindexClient.test.tspackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-11-25T16:50:11.197Z
Learnt from: CR
Repo: rainlanguage/rain.orderbook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:50:11.197Z
Learning: Applies to packages/orderbook/**/*.{ts,tsx,js,jsx} : For Orderbook TypeScript (`packages/orderbook`), run tests using `nix develop -c npm run test -w rainlanguage/orderbook`
Applied to files:
packages/orderbook/test/js_api/raindexClient.test.ts
📚 Learning: 2025-07-04T09:14:35.748Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1956
File: packages/ui-components/src/__tests__/VaultDetail.test.ts:177-181
Timestamp: 2025-07-04T09:14:35.748Z
Learning: In the rain.orderbook project, maintainer findolor is fine with mutating mock data directly in test files using ts-expect-error comments, preferring this pragmatic approach over immutable patterns like spread operators for test data updates.
Applied to files:
packages/orderbook/test/js_api/raindexClient.test.tspackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-03-26T16:16:51.943Z
Learnt from: hardingjam
Repo: rainlanguage/rain.orderbook PR: 1515
File: packages/webapp/src/routes/deploy/[strategyName]/[deploymentKey]/layout.test.ts:37-37
Timestamp: 2025-03-26T16:16:51.943Z
Learning: For Rain Orderbook projects, in test files, the preference is to use "as any" type assertions with per-line ESLint disable comments rather than creating dedicated types for test parameters.
Applied to files:
packages/orderbook/test/js_api/raindexClient.test.ts
📚 Learning: 2025-05-03T10:29:04.009Z
Learnt from: hardingjam
Repo: rainlanguage/rain.orderbook PR: 1724
File: packages/ui-components/src/__tests__/ButtonDarkMode.test.ts:1-54
Timestamp: 2025-05-03T10:29:04.009Z
Learning: JSDoc comments are not considered necessary for test files in the rainlanguage/rain.orderbook repository. Test descriptions and assertions are sufficient documentation.
Applied to files:
packages/orderbook/test/js_api/raindexClient.test.ts
📚 Learning: 2025-04-08T09:18:46.653Z
Learnt from: hardingjam
Repo: rainlanguage/rain.orderbook PR: 1597
File: packages/ui-components/src/__tests__/OrderDetail.test.ts:120-120
Timestamp: 2025-04-08T09:18:46.653Z
Learning: In test files for the Rain Orderbook project, it's acceptable to bypass TypeScript's strict typing using constructs like `as unknown as [Type]` to create simplified mock objects that don't need to implement the entire interface.
Applied to files:
packages/orderbook/test/js_api/raindexClient.test.ts
📚 Learning: 2025-06-08T18:43:51.842Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1891
File: packages/webapp/src/routes/deploy/[strategyName]/[deploymentKey]/page.test.ts:66-80
Timestamp: 2025-06-08T18:43:51.842Z
Learning: In the rain.orderbook webapp test files, when mocking objects like the transaction manager, it's acceptable to use simple empty objects with ts-expect-error comments rather than providing complete mock implementations with all properties and methods.
Applied to files:
packages/orderbook/test/js_api/raindexClient.test.tspackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-06-16T10:49:47.770Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.orderbook PR: 1926
File: test/concrete/ob/OrderBook.clear.zeroAmount.t.sol:24-32
Timestamp: 2025-06-16T10:49:47.770Z
Learning: LibTestAddOrder.conformConfig() in test/util/lib/LibTestAddOrder.sol automatically constrains OrderConfigV3 to prevent common test failures by ensuring validInputs[0].token != validOutputs[0].token, setting them to address(0) and address(1) respectively if they're equal. This prevents TokenSelfTrade errors in fuzz tests.
Applied to files:
packages/orderbook/test/js_api/raindexClient.test.ts
📚 Learning: 2025-05-19T18:24:17.608Z
Learnt from: hardingjam
Repo: rainlanguage/rain.orderbook PR: 1860
File: packages/ui-components/src/lib/stores/transactionStore.ts:130-136
Timestamp: 2025-05-19T18:24:17.608Z
Learning: In the `rain.orderbook` project, the `getTransaction` function (and related entity fetch functions) use `wasmEncodedResult` to validate the returned data, ensuring that only valid data is returned. This makes a simple truthiness check (`!!data`) sufficient for the `isSuccess` predicate in `awaitSubgraphIndexing`.
Applied to files:
packages/orderbook/test/js_api/raindexClient.test.ts
📚 Learning: 2025-05-19T18:24:17.608Z
Learnt from: hardingjam
Repo: rainlanguage/rain.orderbook PR: 1860
File: packages/ui-components/src/lib/stores/transactionStore.ts:130-136
Timestamp: 2025-05-19T18:24:17.608Z
Learning: In the `rain.orderbook` project, the `awaitSubgraphIndexing` function has a two-step validation process: it first checks that `data.value` from `WasmEncodedResult` exists, and only then applies the `isSuccess` predicate. This makes a simple truthiness check (`!!data`) sufficient in the `isSuccess` predicate since the value has already been pre-validated.
Applied to files:
packages/orderbook/test/js_api/raindexClient.test.ts
📚 Learning: 2025-04-08T12:56:03.272Z
Learnt from: hardingjam
Repo: rainlanguage/rain.orderbook PR: 1512
File: packages/ui-components/src/__tests__/OrderDetail.test.ts:125-143
Timestamp: 2025-04-08T12:56:03.272Z
Learning: The OrderDetail component in the Rain orderbook UI doesn't currently have error handling tests, but issue #1605 has been created to address this in the future.
Applied to files:
packages/orderbook/test/js_api/raindexClient.test.tspackages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-04-09T09:28:05.097Z
Learnt from: hardingjam
Repo: rainlanguage/rain.orderbook PR: 1512
File: packages/ui-components/src/__tests__/OrderDetail.test.ts:0-0
Timestamp: 2025-04-09T09:28:05.097Z
Learning: The OrderDetail component has been refactored to use an `onRemove` callback approach instead of the previous `handleOrderRemoveModal` pattern for order removal functionality, as part of PR #1512.
Applied to files:
packages/ui-components/src/lib/components/detail/OrderDetail.svelte
📚 Learning: 2025-04-08T07:38:01.209Z
Learnt from: hardingjam
Repo: rainlanguage/rain.orderbook PR: 1597
File: packages/ui-components/src/__tests__/OrderDetail.test.ts:147-163
Timestamp: 2025-04-08T07:38:01.209Z
Learning: The OrderDetail component in the Rain orderbook UI does not implement a loading view or loading indicator.
Applied to files:
packages/ui-components/src/lib/components/detail/OrderDetail.svelte
📚 Learning: 2025-07-09T12:35:45.699Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1974
File: packages/ui-components/src/__tests__/DeploymentSteps.test.ts:123-126
Timestamp: 2025-07-09T12:35:45.699Z
Learning: In packages/ui-components/src/__tests__/DeploymentSteps.test.ts, findolor prefers to keep mock initializations (like setSelectToken) in individual test cases rather than consolidating them into shared beforeEach blocks, even when it results in duplication.
Applied to files:
packages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-08-14T18:29:32.933Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2083
File: packages/ui-components/src/__tests__/VaultsListTable.test.ts:16-19
Timestamp: 2025-08-14T18:29:32.933Z
Learning: In the rain.orderbook project's UI components tests, mocking hooks like useToasts is often required as infrastructure even when not directly asserting on their calls, because components internally depend on these hooks. Removing such mocks would break component rendering in tests and require more complex test setup with providers.
Applied to files:
packages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-08-04T09:07:00.160Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2048
File: packages/webapp/src/__tests__/WithdrawModal.test.ts:36-37
Timestamp: 2025-08-04T09:07:00.160Z
Learning: In packages/webapp/src/__tests__/WithdrawModal.test.ts and similar test files, findolor considers it acceptable to directly unwrap .value from Float.fromFixedDecimal() and Float.parse() calls without explicit error handling, preferring to keep test fixtures simple rather than adding comprehensive error checking.
Applied to files:
packages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-06-17T14:55:22.914Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1936
File: packages/ui-components/vite.config.ts:21-23
Timestamp: 2025-06-17T14:55:22.914Z
Learning: In the rain.orderbook project, the Vite configuration uses `'import.meta.vitest': 'undefined'` (as a string) combined with conditional `if (import.meta.vitest)` checks for in-source testing. The mock files are excluded from test execution using `exclude: ['src/lib/__mocks__/**/*.ts']`. This configuration successfully allows dev builds to work without `vi` undefined errors, despite the theoretical expectation that the string "undefined" would be truthy and cause issues.
Applied to files:
packages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-06-30T14:17:16.626Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1926
File: packages/ui-components/src/lib/__mocks__/stores.ts:13-17
Timestamp: 2025-06-30T14:17:16.626Z
Learning: User findolor reports that vi.mock(import('rainlanguage/orderbook'), async (importOriginal) => { ... }) syntax works in their testing environment, despite official Vitest documentation indicating the first argument should be a string. This suggests there may be specific Vitest versions or configurations that support dynamic import() as the first argument to vi.mock().
Applied to files:
packages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-08-15T20:56:15.592Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 1978
File: packages/webapp/src/routes/deploy/[orderName]/[deploymentKey]/fullDeployment.test.ts:22-29
Timestamp: 2025-08-15T20:56:15.592Z
Learning: In packages/webapp/src/routes/deploy/[orderName]/[deploymentKey]/fullDeployment.test.ts, brusherru prefers fail-fast testing approaches where type mismatches cause immediate test failures to alert developers about interface changes, rather than using defensive programming with type guards that might mask API evolution.
Applied to files:
packages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
📚 Learning: 2025-03-26T15:00:17.997Z
Learnt from: hardingjam
Repo: rainlanguage/rain.orderbook PR: 1516
File: packages/webapp/src/routes/deploy/[strategyName]/layout.test.ts:0-0
Timestamp: 2025-03-26T15:00:17.997Z
Learning: For Rain Orderbook projects, there's a preference not to include tests for SvelteKit methods (like parent function rejections) in test files, as these are considered framework responsibilities rather than application code that needs testing.
Applied to files:
packages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts
🧬 Code graph analysis (3)
crates/common/src/raindex_client/orders.rs (1)
crates/common/src/raindex_client/vaults.rs (16)
vaults(1322-1343)try_from_vault_volume(950-961)id(121-123)id(166-168)id(258-260)id(284-286)id(924-927)id(939-941)token(141-143)token(181-183)token(658-660)token(707-709)token(929-931)token(942-944)details(933-935)details(945-947)
packages/orderbook/test/js_api/raindexClient.test.ts (2)
subgraph/src/float.ts (1)
Float(4-4)crates/common/src/raindex_client/orders.rs (2)
order(837-848)order(851-862)
crates/common/src/raindex_client/vaults.rs (4)
crates/common/src/local_db/decode.rs (1)
U256(250-250)crates/common/src/local_db/pipeline/adapters/apply.rs (1)
U256(1140-1140)subgraph/src/float.ts (1)
Float(4-4)crates/common/src/local_db/pipeline/adapters/window.rs (1)
cfg(153-163)
⏰ 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). (18)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-legal)
- GitHub Check: standard-tests (ubuntu-latest, test-js-bindings)
- GitHub Check: git-clean
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-browser-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-artifacts)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
- GitHub Check: standard-tests (ubuntu-latest, ob-rs-test, true)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-artifacts)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-static)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-artifacts, true)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-static)
- GitHub Check: test
- GitHub Check: test
- GitHub Check: test
- GitHub Check: Deploy-Docs-Preview
- GitHub Check: Deploy-Preview-Push
- GitHub Check: build-tauri (ubuntu-22.04, true)
🔇 Additional comments (19)
packages/ui-components/src/lib/components/detail/OrderDetail.svelte (1)
11-11: Volume tab wiring looks correct
OrderVaultsVolTableis imported and used with the correctorder={data}prop in the Volume tab; this cleanly re-enables the volume view without altering existing query behavior.Also applies to: 271-273
crates/subgraph/src/orderbook_client/mod.rs (1)
23-23: PerformanceError integration into client error surface is soundEnabling the
performancemodule and adding thePerformanceErrorvariant cleanly exposes performance-layer failures throughOrderbookSubgraphClientErrorwithout disrupting existing variants.Also applies to: 44-45
crates/subgraph/src/performance/mod.rs (1)
1-3: PerformanceError now matches Float-based volume mechanicsExposing
voland adding theFloatErrorvariant brings the performance module in line with the new float math path while keeping APY-related pieces cleanly gated behind TODO comments.Also applies to: 6-11, 12-16, 20-23, 25-36
packages/orderbook/test/js_api/raindexClient.test.ts (1)
308-312: End‑to‑end getVaultsVolume test is well‑constructedThe Float‑backed fixtures (order3 and mockVolumeTradesList) and the
getVaultsVolumetest accurately exercise the new vault‑volume WASM API, including token metadata and all formatted volume fields for both vaults. This gives good coverage of the new volume path without over‑mocking.Also applies to: 313-379, 381-454, 698-759
packages/ui-components/src/__tests__/OrderVaultsVolTable.test.ts (1)
1-7: OrderVaultsVolTable UI test correctly validates formatted volume columnsThe test wires a
QueryClientinto Svelte context, mocksorder.getVaultsVolumewith realisticRaindexVaultVolumedata (including negative net volumes), and asserts all four formatted columns viadata-testids, which aligns well with the component’s new Float‑based rendering.Also applies to: 8-41, 44-80
crates/common/src/raindex_client/orders.rs (1)
11-12: RaindexOrder::get_vaults_volume and its test are correctly wiredThe new WASM‑exported
get_vaults_volumemethod uses the subgraph orderidviaId::new(self.id.to_string()), delegates toorder_vaults_volume, and converts eachVaultVolumewithRaindexVaultVolume::try_from_vault_volume, keeping error propagation consistent. Thetest_order_vaults_volumefixture with Float‑encoded trades thoroughly validates IDs, token metadata, and all formatted volume fields for both vaults, so the end‑to‑end Rust path looks solid.Also applies to: 18-25, 326-356, 2019-2094, 2096-2184
crates/subgraph/src/orderbook_client/performance.rs (1)
2-15: Subgraph order_vaults_volume wrapper and tests are coherent
order_vaults_volumecleanly composesorder_trades_list_allwithget_vaults_vol, and the added tests validate both normal aggregation (including Float‑exact totals/net) and edge cases (no trades, upstream query failure). With APY logic explicitly TODO’d, the current volume functionality is well‑scoped and well‑covered.Also applies to: 67-134, 136-173, 175-208
crates/subgraph/src/performance/vol.rs (8)
9-21: LGTM! Struct derives are appropriate for Float-based volume details.The removal of
PartialEq,Eq, andHashfrom the derive list is correct sinceFloatlikely doesn't implement these traits. TheCopytrait is retained which is appropriate for the underlying Float representation.
23-30: LGTM! VaultVolume struct is consistent with Float-based VolumeDetails.The derive traits are correctly aligned with VolumeDetails, and WASM bindings are properly configured.
38-57: LGTM! Robust volume update logic with drift prevention.The approach of recomputing
total_volandnet_volafter updatingtotal_in/total_outensures consistency and prevents accumulated rounding errors. Error handling is properly propagated.
59-78: LGTM! Clean and correct volume details creation logic.The function correctly handles both positive and negative amounts, with derived totals computed consistently. The logic for
net_volcorrectly results in negative values whentotal_out > total_in.
80-100: LGTM! Vault balance change processing is correct.The function properly identifies vaults by both ID and token address, ensuring correct aggregation. The linear search is acceptable for typical trade volumes.
102-121: LGTM! Vault volume aggregation from trades is correct.The function properly iterates through trades and processes both input and output vault balance changes, accumulating volume data per vault-token pair.
123-127: LGTM! Efficient negative net volume check.Using
total_in.lt(total_out)is mathematically equivalent to checkingnet_vol < 0and avoids creating a zero Float for comparison.
420-457: LGTM! Comprehensive test coverage for volume detail functions.Tests properly verify the hex-based Float parsing, volume updates with positive and negative amounts, and error handling for invalid hex input.
crates/common/src/raindex_client/vaults.rs (4)
26-36: LGTM! Import consolidation and performance module enablement.The imports are properly organized with VaultVolume and VolumeDetails from the now-enabled performance module, and the subgraph client imports are consolidated.
949-962: LGTM! Simplified volume details construction.The change from
try_from_volume_details(token, volume_details)tofrom_volume_details(volume_details)is appropriate since Float values no longer require token decimals for conversion.
964-1053: LGTM! Float-based volume details with proper formatting.The struct fields and getters are correctly updated to use Float types. The
from_volume_detailsconstructor properly formats each Float value and propagates errors. Based on learnings, breaking changes to field types are considered acceptable in this codebase.
1874-3177: LGTM! Comprehensive test coverage for Float-based vault operations.The tests properly verify Float-based volume details, balance changes with negative amounts, and various decimal precision scenarios. The use of
Float::eq()for comparisons is correct.
| // TODO: APY related logic - overflow test for Float arithmetic | ||
| // #[test] | ||
| // fn test_vaults_vol_overflow() { | ||
| // let bytes = SgBytes("".to_string()); | ||
| // let bigint = SgBigInt("".to_string()); | ||
| // let token1_address = Address::random(); | ||
| // let token2_address = Address::random(); | ||
| // let vault_id1 = B256::random(); | ||
| // let vault_id2 = B256::random(); | ||
| // | ||
| // let token1 = SgErc20 { | ||
| // id: SgBytes(token1_address.to_string()), | ||
| // address: SgBytes(token1_address.to_string()), | ||
| // name: Some("Token1".to_string()), | ||
| // symbol: Some("Token1".to_string()), | ||
| // decimals: Some(SgBigInt(18.to_string())), | ||
| // }; | ||
| // | ||
| // let token2 = SgErc20 { | ||
| // id: SgBytes(token2_address.to_string()), | ||
| // address: SgBytes(token2_address.to_string()), | ||
| // name: Some("Token2".to_string()), | ||
| // symbol: Some("Token2".to_string()), | ||
| // decimals: Some(SgBigInt(18.to_string())), | ||
| // }; | ||
| // | ||
| // let trade1 = SgTrade { | ||
| // id: bytes.clone(), | ||
| // order: SgTradeStructPartialOrder { | ||
| // id: bytes.clone(), | ||
| // order_hash: bytes.clone(), | ||
| // }, | ||
| // trade_event: SgTradeEvent { | ||
| // sender: bytes.clone(), | ||
| // transaction: SgTransaction { | ||
| // id: bytes.clone(), | ||
| // from: bytes.clone(), | ||
| // block_number: bigint.clone(), | ||
| // timestamp: bigint.clone(), | ||
| // }, | ||
| // }, | ||
| // timestamp: bigint.clone(), | ||
| // orderbook: SgOrderbook { id: bytes.clone() }, | ||
| // output_vault_balance_change: SgTradeVaultBalanceChange { | ||
| // id: bytes.clone(), | ||
| // __typename: "TradeVaultBalanceChange".to_string(), | ||
| // amount: SgBytes(NEG1.as_hex()), | ||
| // new_vault_balance: bytes.clone(), | ||
| // old_vault_balance: bytes.clone(), | ||
| // vault: SgVaultBalanceChangeVault { | ||
| // id: bytes.clone(), | ||
| // token: token1.clone(), | ||
| // vault_id: SgBytes(vault_id1.to_string()), | ||
| // }, | ||
| // timestamp: bigint.clone(), | ||
| // transaction: SgTransaction { | ||
| // id: bytes.clone(), | ||
| // from: bytes.clone(), | ||
| // block_number: bigint.clone(), | ||
| // timestamp: bigint.clone(), | ||
| // }, | ||
| // orderbook: SgOrderbook { id: bytes.clone() }, | ||
| // }, | ||
| // input_vault_balance_change: SgTradeVaultBalanceChange { | ||
| // id: bytes.clone(), | ||
| // __typename: "TradeVaultBalanceChange".to_string(), | ||
| // amount: SgBytes(FMAX.as_hex()), | ||
| // new_vault_balance: bytes.clone(), | ||
| // old_vault_balance: bytes.clone(), | ||
| // vault: SgVaultBalanceChangeVault { | ||
| // id: bytes.clone(), | ||
| // token: token2.clone(), | ||
| // vault_id: SgBytes(vault_id2.to_string()), | ||
| // }, | ||
| // timestamp: bigint.clone(), | ||
| // transaction: SgTransaction { | ||
| // id: bytes.clone(), | ||
| // from: bytes.clone(), | ||
| // block_number: bigint.clone(), | ||
| // timestamp: bigint.clone(), | ||
| // }, | ||
| // orderbook: SgOrderbook { id: bytes.clone() }, | ||
| // }, | ||
| // }; | ||
| // | ||
| // let trade2 = SgTrade { | ||
| // id: bytes.clone(), | ||
| // order: SgTradeStructPartialOrder { | ||
| // id: bytes.clone(), | ||
| // order_hash: bytes.clone(), | ||
| // }, | ||
| // trade_event: SgTradeEvent { | ||
| // sender: bytes.clone(), | ||
| // transaction: SgTransaction { | ||
| // id: bytes.clone(), | ||
| // from: bytes.clone(), | ||
| // block_number: bigint.clone(), | ||
| // timestamp: bigint.clone(), | ||
| // }, | ||
| // }, | ||
| // timestamp: bigint.clone(), | ||
| // orderbook: SgOrderbook { id: bytes.clone() }, | ||
| // output_vault_balance_change: SgTradeVaultBalanceChange { | ||
| // id: bytes.clone(), | ||
| // __typename: "TradeVaultBalanceChange".to_string(), | ||
| // amount: SgBytes(F1.as_hex()), | ||
| // new_vault_balance: bytes.clone(), | ||
| // old_vault_balance: bytes.clone(), | ||
| // vault: SgVaultBalanceChangeVault { | ||
| // id: bytes.clone(), | ||
| // token: token2.clone(), | ||
| // vault_id: SgBytes(vault_id2.to_string()), | ||
| // }, | ||
| // timestamp: bigint.clone(), | ||
| // transaction: SgTransaction { | ||
| // id: bytes.clone(), | ||
| // from: bytes.clone(), | ||
| // block_number: bigint.clone(), | ||
| // timestamp: bigint.clone(), | ||
| // }, | ||
| // orderbook: SgOrderbook { id: bytes.clone() }, | ||
| // }, | ||
| // input_vault_balance_change: SgTradeVaultBalanceChange { | ||
| // id: bytes.clone(), | ||
| // __typename: "TradeVaultBalanceChange".to_string(), | ||
| // amount: SgBytes(F1.as_hex()), | ||
| // new_vault_balance: bytes.clone(), | ||
| // old_vault_balance: bytes.clone(), | ||
| // vault: SgVaultBalanceChangeVault { | ||
| // id: bytes.clone(), | ||
| // token: token1.clone(), | ||
| // vault_id: SgBytes(vault_id1.to_string()), | ||
| // }, | ||
| // timestamp: bigint.clone(), | ||
| // transaction: SgTransaction { | ||
| // id: bytes.clone(), | ||
| // from: bytes.clone(), | ||
| // block_number: bigint.clone(), | ||
| // timestamp: bigint.clone(), | ||
| // }, | ||
| // orderbook: SgOrderbook { id: bytes.clone() }, | ||
| // }, | ||
| // }; | ||
| // | ||
| // let err = get_vaults_vol(&[trade1, trade2]).unwrap_err(); | ||
| // assert!(matches!(err, PerformanceError::FloatError(_))); | ||
| // } |
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.
🧹 Nitpick | 🔵 Trivial
Track the commented-out overflow test.
The overflow test is commented out with a TODO for APY-related logic. Consider creating a tracking issue to ensure this test is re-enabled when Float arithmetic overflow handling is addressed.
Would you like me to open an issue to track re-enabling this overflow test when the APY logic is implemented?
🤖 Prompt for AI Agents
crates/subgraph/src/performance/vol.rs lines 481-627: the overflow test for
Float arithmetic is commented out with a TODO; create a tracking issue in the
repository (e.g., "Re-enable vaults_vol overflow test / implement APY Float
overflow handling") that references these lines and explains the failing Float
overflow scenario, expected behavior, and acceptance criteria (implement
APY-related Float overflow handling, add necessary guards or types, re-enable
the test); update the TODO comment to include the new issue number/URL and add
an appropriate issue label (bug/tech-debt) so the test can be re-enabled once
the APY logic and Float overflow handling are implemented.
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.
The TODO comment already serves as sufficient tracking for this. We'll address it when implementing APY-related Float overflow handling.
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.
@findolor, understood! I'll defer to your judgment on this—the TODO comment is clear and will serve as a reminder when APY logic is implemented.
🧠 Learnings used
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1956
File: crates/common/src/raindex_client/orders.rs:609-609
Timestamp: 2025-07-04T10:27:22.544Z
Learning: In the rainlanguage/rain.orderbook codebase, user findolor prefers not to implement overflow protection for trades count casting (usize to u16) at this time, considering it unnecessary for the current scope since the practical risk of orders having 65,535+ trades is extremely low.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2000
File: crates/common/src/raindex_client/vaults.rs:183-183
Timestamp: 2025-07-16T10:40:05.717Z
Learning: In the rainlanguage/rain.orderbook codebase, user findolor considers breaking changes from Option<U256> to U256 for required fields like decimals in RaindexVaultToken to be acceptable and safe, even when they affect multiple usage sites across the codebase.
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2044
File: crates/common/src/raindex_client/vaults_list.rs:363-423
Timestamp: 2025-07-31T19:34:11.716Z
Learning: In the rainlanguage/rain.orderbook project, for WASM-exposed functionality like VaultsList, the team prefers to keep comprehensive tests in the non-WASM environment due to the complexity of recreating objects like RaindexVaults in WASM. WASM tests focus on basic functionality and error cases since the WASM code reuses the already-tested non-WASM implementation.
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2036
File: packages/orderbook/test/js_api/filters.test.ts:19-36
Timestamp: 2025-08-02T03:55:25.215Z
Learning: In the rainlanguage/rain.orderbook project's WASM tests, the pattern of chaining `.value!` calls on WASM result types (like from VaultsFilterBuilder methods) is the established and preferred approach for handling WASM results, and should not be refactored into intermediate variables as it would add unnecessary verbosity without improving the code.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1947
File: crates/common/src/raindex_client/orders.rs:98-125
Timestamp: 2025-06-24T08:46:03.368Z
Learning: In the vault merging logic in crates/common/src/raindex_client/orders.rs, optimization isn't necessary because the maximum list items are usually around 5 items. For such small datasets, the simple three-loop approach is preferred over HashMap-based optimization due to clarity and minimal performance impact.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1994
File: crates/common/src/raindex_client/vaults.rs:59-59
Timestamp: 2025-07-16T05:52:05.576Z
Learning: User findolor prefers to handle documentation updates for getter methods in batch via dedicated PRs rather than addressing them individually during feature development, as mentioned for the formatted amount string fields in crates/common/src/raindex_client/vaults.rs.
Learnt from: 0xgleb
Repo: rainlanguage/rain.orderbook PR: 1911
File: crates/subgraph/src/types/impls.rs:7-15
Timestamp: 2025-07-21T16:34:31.193Z
Learning: In the rainlanguage/rain.orderbook codebase, user 0xgleb considers breaking changes that remove unsafe default behaviors to be intentional and acceptable. Specifically, the get_decimals() method in crates/subgraph/src/types/impls.rs was intentionally changed to return MissingDecimals error instead of defaulting to 18 decimals, as defaulting to 18 is considered unsafe and should never have been done.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:26:31.566Z
Learning: For PR #1884 and future PRs in rainlanguage/rain.orderbook repository, provide PR size reports in a separate comment with ONLY the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number", without any additional text or explanation. Reports should exclude irrelevant files such as lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock).
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T23:09:27.578Z
Learning: For PR #1884 in rainlanguage/rain.orderbook repository, I must always reassess the PR size after each new commit, calculating the total changes up to the very latest commit and ensuring accuracy of the report. The calculation must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock) and report in the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number".
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T23:09:46.344Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, I must reassess the PR size after each new commit to ensure the report includes the latest changes, and calculate the total size up to the very latest commit.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T22:14:22.646Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, I must consistently report the PR size after EVERY new commit in the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number" without any formatting blocks. The report must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock) and can be included either as part of the review or as a separate comment.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T22:14:22.646Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, I must consistently report the PR size after EVERY new commit in the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number" without any additional text or formatting blocks. The report must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock) and can be included either as part of the review or as a separate comment.
| @@ -1,8 +1,8 @@ | |||
| <!-- <script lang="ts"> | |||
| <script lang="ts"> | |||
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.
🧹 Nitpick | 🔵 Trivial
Volume table query & rendering are consistent with the new Float API
The infinite query correctly calls order.getVaultsVolume with bigint timestamps, and the AppTable<RaindexVaultVolume> usage plus formatted fields (formattedTotalIn/Out/Vol/NetVol) line up with the new type surface and tests. Only minor nit is the emptyMessage="No trades found" label on a volume table, which you may optionally adjust to something like “No volume data found” for clarity.
Also applies to: 5-5, 15-18, 18-27, 29-29, 32-32, 62-63
🤖 Prompt for AI Agents
In packages/ui-components/src/lib/components/tables/OrderVaultsVolTable.svelte
(lines 1, 5-5, 15-18, 18-27, 29-29, 32-32, 62-63), the volume table uses an
emptyMessage intended for trades; change the emptyMessage text to a clearer
volume-specific label (for example "No volume data found") wherever the AppTable
or similar volume-table rendering sets "No trades found" so the UI matches the
volume context; ensure only the string is updated and types/formatting for
formattedTotalIn/Out/Vol/NetVol and the infinite query usage remain unchanged.
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.
The current message is technically accurate since volume is derived from trades - no trades means no volume data. Keeping as-is.
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.
@findolor, that makes sense — the message accurately reflects the underlying data dependency. Thanks for clarifying!
🧠 Learnings used
Learnt from: hardyjosh
Repo: rainlanguage/rain.orderbook PR: 2035
File: packages/ui-components/src/lib/components/tables/OrdersListTable.svelte:167-174
Timestamp: 2025-07-26T06:56:28.207Z
Learning: In OrdersListTable.svelte, maintainer hardyjosh considers keyed each-blocks unnecessary for item.inputs and item.outputs arrays because the entire query result updates at once during refresh, making DOM diffing optimizations negligible when the whole dataset is replaced rather than individual items being modified.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1599
File: tauri-app/src/routes/orders/add/+page.svelte:287-287
Timestamp: 2025-04-11T06:05:46.473Z
Learning: The ScenarioDebugTable component in tauri-app/src/routes/orders/add/+page.svelte has been designed to manage its own data fetching internally without requiring a chartData prop.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1599
File: tauri-app/src/lib/components/ScenarioDebugTable.svelte:46-53
Timestamp: 2025-04-17T08:47:59.930Z
Learning: The ScenarioDebugTable component in tauri-app/src/lib/components/ScenarioDebugTable.svelte has been designed to manage its own data fetching internally without requiring a chartData prop.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1831
File: packages/ui-components/src/lib/components/transactions/TransactionList.svelte:10-15
Timestamp: 2025-06-05T12:21:16.329Z
Learning: The transactions array in TransactionList.svelte is expected to remain small, so performance optimizations like derived stores for array reversal are not necessary and simpler code is preferred.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2358
File: packages/ui-components/src/lib/components/tables/OrdersListTable.svelte:82-85
Timestamp: 2025-12-11T07:46:32.817Z
Learning: In packages/ui-components/src/lib/components/tables/OrdersListTable.svelte, the token filter intentionally sets both inputs and outputs to the same selectedTokens array (lines 82-85) to achieve OR filtering behavior. This is by design: the single UI token filter should match orders containing the selected token(s) in either inputs OR outputs, not pair-specific filtering. Even though the API supports more granular directional filtering, the UI uses the same tokens in both fields for broader matching.
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2002
File: packages/ui-components/src/lib/components/tables/VaultsListTable.svelte:63-68
Timestamp: 2025-07-24T19:31:29.248Z
Learning: In Svelte components, functions that depend on reactive state and are used in template rendering (like `isVaultDisabled` in VaultsListTable.svelte) should remain as reactive statements ($:) rather than regular functions, because regular functions won't trigger UI updates when their dependencies change. This is especially important for UI state like disabled/enabled status that needs to update across multiple rendered items when selection state changes.
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 1957
File: packages/ui-components/src/lib/components/tables/VaultsListTable.svelte:60-60
Timestamp: 2025-06-27T17:34:15.825Z
Learning: In the VaultsListTable.svelte component, the `activeAccounts` store is redundant in query keys when the `owners` variable (derived from `activeAccountsItems`) is already included, as `owners` is what's actually used in the query function while `activeAccounts` is just a transformed version of the same data.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2384
File: packages/ui-components/src/lib/components/dropdown/DropdownOrderbooksFilter.svelte:95-107
Timestamp: 2026-01-07T10:37:53.185Z
Learning: In DropdownOrderbooksFilter.svelte, selectedOrderbookAddresses is a filtered view (by selected chain IDs) while the activeOrderbookAddresses store holds all user selections across all chains. The toggleOrderbook function intentionally checks selection state against the filtered view (selectedOrderbookAddresses) but modifies the full store ($activeOrderbookAddresses) to preserve selections even when chain filters change.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1469
File: packages/ui-components/src/__tests__/CodeMirrorDotrain.test.ts:75-98
Timestamp: 2025-03-31T10:16:53.544Z
Learning: In the rainlanguage/rain.orderbook project, direct manipulation of Svelte's internal state (component.$$.ctx) in tests is an acceptable approach for testing component behavior, as demonstrated in the CodeMirrorDotrain tests.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1994
File: crates/common/src/raindex_client/vaults.rs:59-59
Timestamp: 2025-07-16T05:52:05.576Z
Learning: User findolor prefers to handle documentation updates for getter methods in batch via dedicated PRs rather than addressing them individually during feature development, as mentioned for the formatted amount string fields in crates/common/src/raindex_client/vaults.rs.
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2000
File: crates/common/src/raindex_client/vaults.rs:183-183
Timestamp: 2025-07-16T10:40:05.717Z
Learning: In the rainlanguage/rain.orderbook codebase, user findolor considers breaking changes from Option<U256> to U256 for required fields like decimals in RaindexVaultToken to be acceptable and safe, even when they affect multiple usage sites across the codebase.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:26:31.566Z
Learning: For PR #1884 and future PRs in rainlanguage/rain.orderbook repository, provide PR size reports in a separate comment with ONLY the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number", without any additional text or explanation. Reports should exclude irrelevant files such as lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock).
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T23:09:27.578Z
Learning: For PR #1884 in rainlanguage/rain.orderbook repository, I must always reassess the PR size after each new commit, calculating the total changes up to the very latest commit and ensuring accuracy of the report. The calculation must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock) and report in the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number".
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T23:09:46.344Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, I must reassess the PR size after each new commit to ensure the report includes the latest changes, and calculate the total size up to the very latest commit.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T22:14:22.646Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, I must consistently report the PR size after EVERY new commit in the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number" without any formatting blocks. The report must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock) and can be included either as part of the review or as a separate comment.
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T22:14:22.646Z
Learning: For PR #1884 in rainlanguage/rain.orderbook, I must consistently report the PR size after EVERY new commit in the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number" without any additional text or formatting blocks. The report must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock) and can be included either as part of the review or as a separate comment.
| let client = self.get_orderbook_client()?; | ||
|
|
||
| let mut result_volumes = Vec::new(); | ||
| let volumes = client | ||
| .order_vaults_volume(Id::new(self.id.to_string()), start_timestamp, end_timestamp) | ||
| .await?; | ||
| for volume in volumes { | ||
| let volume = RaindexVaultVolume::try_from_vault_volume(self.chain_id, volume)?; | ||
| result_volumes.push(volume); | ||
| } | ||
| Ok(result_volumes) |
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.
nitpick: consider
| let client = self.get_orderbook_client()?; | |
| let mut result_volumes = Vec::new(); | |
| let volumes = client | |
| .order_vaults_volume(Id::new(self.id.to_string()), start_timestamp, end_timestamp) | |
| .await?; | |
| for volume in volumes { | |
| let volume = RaindexVaultVolume::try_from_vault_volume(self.chain_id, volume)?; | |
| result_volumes.push(volume); | |
| } | |
| Ok(result_volumes) | |
| let client = self.get_orderbook_client()?; | |
| client | |
| .order_vaults_volume(Id::new(self.id.to_string()), start_timestamp, end_timestamp) | |
| .await? | |
| .into_iter() | |
| .map(|volume| RaindexVaultVolume::try_from_vault_volume(self.chain_id, volume)) | |
| .collect() |
Motivation
See issues:
The Volume tab in order detail view was previously disabled. This PR re-enables it with updated Float-based volume calculations, replacing the previous U256/BigInt approach for better precision and consistency with the subgraph's Float representation.
Solution
This PR re-enables the Volume tab feature across all layers:
Subgraph client layer (
crates/subgraph/src/performance/):vol.rsto useFloatfor volume calculations instead of U256order_vaults_volumefunctionTODO: APY related logicmarkers for future workSDK/Common layer (
crates/common/src/raindex_client/):getVaultsVolumemethod onRaindexOrderRaindexVaultVolumeandRaindexVolumeDetailstypes with Float-based fieldsformatted_total_in,formatted_net_vol, etc.)UI layer (
packages/ui-components/):OrderDetail.svelteOrderVaultsVolTable.svelteto work with new Float-based APITests:
OrderVaultsVolTable.test.tsgetVaultsVolumetest inraindexClient.test.tstest_order_vaults_volumeintegration test inorders.rsChecks
By submitting this for review, I'm confirming I've done the following:
fix #1989
Summary by CodeRabbit
New Features
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.