-
Notifications
You must be signed in to change notification settings - Fork 6
Remove config source #1689
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?
Remove config source #1689
Conversation
Change webapp settings to be yaml instead of json
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: 3
♻️ Duplicate comments (4)
crates/settings/src/orderbook.rs (1)
37-39
: 🧹 Nitpick (assertive)Surface hex-parsing failures verbatim in error message
The error message in
AddressParseError
currently hard-codes "Failed to parse address" rather than including the specificFromHexError
details, requiring additional calls toto_readable_msg()
to see the actual problem.Consider forwarding the error in the
#[error]
attribute to provide more precise feedback:-#[error("Failed to parse address")] +#[error("Invalid orderbook address: {0}")] AddressParseError(FromHexError),This would give users the exact reason (e.g., "Invalid orderbook address: odd number of digits") when printing the error.
crates/settings/src/config.rs (3)
89-92
:accounts
wrapped inArc<String>
adds needless indirectionUser-supplied account labels/addresses are unlikely to be shared across
threads; a plainString
(or evenAddress
) is sufficient and simpler:-accounts: Option<HashMap<String, Arc<String>>>, +accounts: Option<HashMap<String, String>>,Re-evaluate if there’s a hard requirement for
Arc
.
124-129
:⚠️ Potential issueError variants & messages are cross-wired – will confuse users
OrderNotFound
,TokenNotFound
, andDeployerNotFound
display the wrong
resource in their error text.-#[error("Token not found: {0}")] -OrderNotFound(String), -#[error("Deployer not found: {0}")] -TokenNotFound(String), -#[error("Order not found: {0}")] -DeployerNotFound(String), +#[error("Order not found: {0}")] +OrderNotFound(String), +#[error("Token not found: {0}")] +TokenNotFound(String), +#[error("Deployer not found: {0}")] +DeployerNotFound(String),Please swap either the variant names or the
#[error]
strings so they match.
153-155
: 🧹 Nitpick (assertive)
settings.clone()
makes a full copy – avoid the extra allocation
DotrainYaml::new
andOrderbookYaml::new
only need read-only access to
the same strings. Instead of cloning the wholeVec
, hand out
references:- let dotrain_yaml = DotrainYaml::new(settings.clone(), validate)?; - let orderbook_yaml = OrderbookYaml::new(settings, validate)?; + let dotrain_yaml = DotrainYaml::new(settings.iter().cloned().collect(), validate)?; + let orderbook_yaml = OrderbookYaml::new(settings, validate)?;(or adjust the constructors to accept
&[String]
). Saves memory when
loading large config files.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (7)
crates/js_api/src/config.rs
(1 hunks)crates/js_api/src/lib.rs
(1 hunks)crates/settings/src/config.rs
(3 hunks)crates/settings/src/orderbook.rs
(3 hunks)packages/ui-components/src/lib/components/detail/VaultDetail.svelte
(1 hunks)packages/webapp/src/routes/+layout.ts
(17 hunks)packages/webapp/test-setup.ts
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
crates/js_api/src/config.rs (1)
crates/settings/src/config.rs (1)
try_from_settings
(149-238)
packages/webapp/src/routes/+layout.ts (1)
tauri-app/src/lib/stores/settings.ts (5)
settings
(25-36)accounts
(99-99)activeAccountsItems
(100-111)subgraphUrl
(82-86)activeOrderbook
(75-81)
⏰ Context from checks skipped due to timeout of 90000ms (15)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-static)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-artifacts)
- GitHub Check: standard-tests (ubuntu-latest, test-js-bindings)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-legal)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-artifacts, true)
- GitHub Check: standard-tests (ubuntu-latest, ob-rs-test, true)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-static)
- GitHub Check: test
- GitHub Check: git-clean
- GitHub Check: Deploy-Preview
- GitHub Check: test
- GitHub Check: test
- GitHub Check: build-tauri (ubuntu-22.04, true)
🔇 Additional comments (6)
crates/js_api/src/lib.rs (1)
1-3
: LGTM: New config module for WASM exportsThe addition of the
config
module alongside the existing WASM-only modules is consistent with the broader refactoring that replacesConfigSource
with the newConfig
type. This provides the necessary WASM bindings for the new configuration parsing approach.packages/webapp/test-setup.ts (1)
16-19
: LGTM: Added mock for parseSettings functionThe mock implementation has been appropriately updated to include the new
parseSettings
function, which aligns with the migration fromConfigSource
to the new synchronous config parsing approach.packages/ui-components/src/lib/components/detail/VaultDetail.svelte (1)
43-43
: LGTM: Updated access to subgraph URL via object propertyCorrectly updated to access the
.url
property from the subgraph configuration object, reflecting the new richer, strongly-typedConfig
structure where subgraphs are objects with explicit properties rather than simple strings.crates/settings/src/orderbook.rs (2)
186-194
: LGTM: Renamed error enum to match new architectureThe error enum has been appropriately renamed from
ParseOrderbookConfigSourceError
toParseOrderbookCfgError
, consistent with the removal of theConfigSource
type and the overall refactoring approach.
196-207
: LGTM: Updated error implementation for the renamed enumThe implementation of the error enum has been correctly updated to use the new name, maintaining all the existing functionality for generating user-friendly error messages.
packages/webapp/src/routes/+layout.ts (1)
354-377
: Changing network keeps a stale orderbook – consider auto-resettingactiveOrderbookRef
When
$activeNetworkRef
changes, the previousactiveOrderbookRef
might still point to an orderbook belonging to another network, leading
to inconsistent UI (seen in the test whereorderbook1
remains active
after switching tonetwork2
).A lightweight fix:
$activeNetworkRef.subscribe((network) => { if (network && get(activeOrderbook)?.network.key !== network) { - // nothing happens – stale orderbook + activeOrderbookRef.set(''); } });Or, make
activeOrderbook
derived solely fromactiveNetworkRef
activeOrderbookRef
to enforce the constraint.Would you like me to draft the derived-store rewrite?
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: 6
🔭 Outside diff range comments (2)
crates/settings/src/unit_test.rs (1)
78-99
: 💡 Verification agent🧩 Analysis chain
Error handling has been removed from
try_into_test_config
methodThe method has been simplified to return
TestConfig
directly without error handling, but the method name still starts withtry_into_
which conventionally indicates that it might fail.Consider either:
- Renaming the method to just
into_test_config
since it no longer tries and cannot fail, or- Restore error handling if there are cases where the conversion might actually fail
🏁 Script executed:
#!/bin/bash # Check if there are any callers of this method that expect Result<TestConfig, Error> rg -A 2 -B 2 "try_into_test_config" --type rustLength of output: 785
Rename
try_into_test_config
tointo_test_config
The
try_
prefix implies a fallible conversion, but this method always returns aTestConfig
unconditionally. To avoid confusion, rename it and update its callers:• In
crates/settings/src/unit_test.rs
- pub fn try_into_test_config(self) -> TestConfig { + pub fn into_test_config(self) -> TestConfig { // …implementation unchanged… }• In
crates/common/src/unit_tests/mod.rs
- source.test.try_into_test_config() + source.test.into_test_config()tauri-app/src/lib/stores/settings.ts (1)
156-156
:⚠️ Potential issueFix logic error in the orderbooks undefined check
The current condition
!$settings?.orderbooks === undefined
has incorrect operator precedence. The negation (!
) applies only to$settings?.orderbooks
, creating a boolean that is then compared with=== undefined
.Fix the condition to properly check if orderbooks is undefined:
- if ( - !$settings?.orderbooks === undefined || - $activeOrderbookRef === undefined || - ($settings?.orderbooks !== undefined && - $activeOrderbookRef !== undefined && - !Object.keys($settings.orderbooks).includes($activeOrderbookRef)) - ) { + if ( + $settings?.orderbooks === undefined || + $activeOrderbookRef === undefined || + ($settings?.orderbooks !== undefined && + $activeOrderbookRef !== undefined && + !Object.keys($settings.orderbooks).includes($activeOrderbookRef)) + ) {
♻️ Duplicate comments (2)
packages/webapp/src/routes/+layout.ts (1)
30-37
: 🧹 Nitpick (assertive)Guard against missing
network
field in orderbook objects
The predicate assumes every orderbook has a truthynetwork
field; corrupted configs will throw.- (orderbook) => orderbook.network.key === $activeNetworkRef + (orderbook) => orderbook.network?.key === $activeNetworkRefA small check keeps the UI responsive even with partial data.
crates/settings/src/config.rs (1)
153-155
: Cloning the entiresettings
vector is unnecessary (duplicate from earlier review)
DotrainYaml::new(settings.clone(), …)
duplicates potentially large YAML blobs.
Passing a borrow or splitting the vector (as suggested previously) avoids the extra allocation.(This has been pointed out in a past review; re-flagging for visibility.)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (10)
crates/js_api/src/config.rs
(1 hunks)crates/settings/src/config.rs
(3 hunks)crates/settings/src/unit_test.rs
(4 hunks)crates/settings/src/yaml/orderbook.rs
(6 hunks)packages/webapp/src/routes/+layout.ts
(17 hunks)tauri-app/src/lib/services/configCodemirrorProblems.ts
(1 hunks)tauri-app/src/lib/services/order.ts
(3 hunks)tauri-app/src/lib/stores/order.ts
(1 hunks)tauri-app/src/lib/stores/settings.ts
(7 hunks)tauri-app/src/routes/orders/[network]-[orderHash]/page.test.ts
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (4)
tauri-app/src/lib/services/configCodemirrorProblems.ts (1)
tauri-app/src/lib/services/config.ts (1)
parseConfig
(6-7)
tauri-app/src/lib/services/order.ts (1)
tauri-app/src/lib/stores/settings.ts (1)
subgraph
(82-86)
tauri-app/src/lib/stores/order.ts (1)
tauri-app/src/lib/stores/settings.ts (1)
subgraph
(82-86)
packages/webapp/src/routes/+layout.ts (2)
packages/ui-components/src/lib/index.ts (1)
AppStoresInterface
(70-70)tauri-app/src/lib/stores/settings.ts (5)
settings
(25-36)accounts
(99-99)activeAccountsItems
(100-111)subgraph
(82-86)activeOrderbook
(75-81)
⏰ Context from checks skipped due to timeout of 90000ms (16)
- GitHub Check: test
- GitHub Check: test
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-legal)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-artifacts)
- GitHub Check: build-tauri (ubuntu-22.04, true)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-static)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-test)
- GitHub Check: standard-tests (ubuntu-latest, test-js-bindings)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-artifacts)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-artifacts, true)
- GitHub Check: standard-tests (ubuntu-latest, ob-rs-test, true)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-static)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
- GitHub Check: test
- GitHub Check: Deploy-Preview
- GitHub Check: git-clean
🔇 Additional comments (17)
tauri-app/src/lib/services/configCodemirrorProblems.ts (2)
3-3
: Updated import to use the new Config approachThe import statement has been updated to use
parseConfig
instead ofparseConfigSource
, aligning with the PR objective to remove the config source.
9-9
: Updated function call to use new parseConfig methodThe function call has been correctly updated to use
parseConfig
with properawait
keyword to ensure the Promise is resolved before proceeding.tauri-app/src/lib/services/order.ts (2)
3-3
: Updated import to use the new Config structureThe import has been updated to use
subgraph
instead ofsubgraphUrl
, aligning with the PR objective to remove config source and use the new Config structure.
52-52
: Correctly updated to access URL property from subgraph objectThis line correctly accesses the
url
property from the subgraph object using the optional chaining operator, which is the right approach given the new Config structure.tauri-app/src/lib/stores/order.ts (3)
3-3
: Updated import to use the new Config structureThe import has been updated to use
subgraph
instead ofsubgraphUrl
, aligning with the PR objective to remove config source.
19-22
: Correctly updated to access URL property from subgraph objectThese lines correctly load the subgraph and pass its URL property in the expected format for the
order_trades_list
function.
27-33
: Correctly updated to access URL property from subgraph objectThese lines correctly load the subgraph and pass its URL property in the expected format for the
order_trades_list_write_csv
function.tauri-app/src/routes/orders/[network]-[orderHash]/page.test.ts (5)
4-4
: Added Config type importAdded import for the Config type from orderbook package, which is used for type casting the mock settings object.
62-73
: Updated mock data structure to match new Config formatThe mock data structure has been updated to match the new Config format with nested objects for network and subgraph, each with explicit keys and URLs.
76-79
: Updated subgraph mock data structureThe subgraph mock data has been updated to include both key and URL properties, aligning with the new Config structure.
82-86
: Updated network mock data structure and renamed chainId propertyThe network mock data has been updated to include a key property, and the property name has been standardized from
chain-id
tochainId
to match the new Config structure.
88-88
: Added type casting for ConfigThe mock settings object is now properly type cast as
Config
to ensure type safety with the new structure.crates/settings/src/yaml/orderbook.rs (2)
197-214
: Good implementation of robust boolean parsing for sentry settingsThe updated
get_sentry
method now correctly parses boolean values from YAML with proper case-insensitive handling and detailed error reporting.Your implementation matches the previous review feedback perfectly - it now correctly handles case variations and provides clear error messages when invalid values are encountered.
101-103
: Well-structured refactoring of entity retrieval methodsThe addition of comprehensive
get_<entity>s
methods that return full mappings is a good design choice. Delegating the existing key retrieval methods to these new methods removes redundant parsing logic and improves maintainability.Also applies to: 118-124, 139-145, 150-156, 171-177, 185-191
tauri-app/src/lib/stores/settings.ts (1)
9-9
: Well-executed migration from ConfigSource to strongly-typed ConfigThe changes to import and use the new
Config
,OrderbookCfg
, andSubgraphCfg
types are comprehensive and consistent throughout the file. The updated code properly accesses nested properties of these structured configuration objects.The migration from string-based configuration to the strongly-typed Config structure will improve type safety and make the codebase more maintainable.
Also applies to: 25-26, 31-31, 52-52, 71-73, 82-86, 123-126, 189-189
packages/webapp/src/routes/+layout.ts (2)
61-62
:activeSubgraphs
store appears unused
activeSubgraphs
is created but never read or mutated anywhere in this file (nor in the tests).
Dead stores increase bundle size and cognitive load; please remove or wire it into the UI logic.
43-47
: 🧹 Nitpick (assertive)Same defensive null-check for
subgraph.key
If an orderbook lacks asubgraph
, the current expression throws. Apply optional-chaining for parity with the previous fix.- ? $settings.subgraphs[$activeOrderbook.subgraph.key] + ? $settings.subgraphs[$activeOrderbook.subgraph?.key]Likely an incorrect or invalid review 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: 8
🔭 Outside diff range comments (1)
tauri-app/src/lib/stores/settings.ts (1)
188-197
: 🧹 Nitpick (assertive)Simplify filter operation for activeSubgraphs
The filtering of subgraphs is properly updated to compare
value.key
instead of the value directly. However, there's an opportunity to simplify this code.Similar to a previous fix, you could simplify this by removing any redundant operations:
const updatedActiveSubgraphs = Object.fromEntries( Object.entries($settings.subgraphs).filter(([key, value]) => { if (key in currentActiveSubgraphs) { return currentActiveSubgraphs[key].key === value.key; } return false; }) );
♻️ Duplicate comments (1)
crates/settings/src/config.rs (1)
154-155
:settings.clone()
duplication revisit (already raised earlier)Cloning the entire
Vec<String>
just to split between
DotrainYaml::new
andOrderbookYaml::new
still incurs an allocation.
Previously suggested slicing/iter duplication remains applicable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (14)
crates/js_api/src/config.rs
(1 hunks)crates/settings/src/config.rs
(3 hunks)packages/ui-components/src/__tests__/DropdownOrderListAccounts.test.ts
(1 hunks)packages/ui-components/src/lib/components/ListViewOrderbookFilters.svelte
(1 hunks)packages/ui-components/src/lib/components/dropdown/DropdownOrderListAccounts.svelte
(1 hunks)packages/ui-components/src/lib/components/tables/VaultsListTable.svelte
(4 hunks)packages/ui-components/src/lib/types/appStores.ts
(1 hunks)packages/webapp/src/routes/+layout.ts
(17 hunks)tauri-app/src/lib/services/order.ts
(3 hunks)tauri-app/src/lib/stores/order.ts
(1 hunks)tauri-app/src/lib/stores/settings.test.ts
(5 hunks)tauri-app/src/lib/stores/settings.ts
(8 hunks)tauri-app/src/routes/vaults/+page.svelte
(2 hunks)tauri-app/src/tests/pickConfig.test.ts
(3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (4)
tauri-app/src/lib/stores/order.ts (1)
tauri-app/src/lib/stores/settings.ts (1)
subgraph
(82-86)
tauri-app/src/lib/services/order.ts (1)
tauri-app/src/lib/stores/settings.ts (1)
subgraph
(82-86)
tauri-app/src/lib/stores/settings.test.ts (1)
tauri-app/src/lib/stores/settings.ts (3)
settings
(25-36)activeAccountsItems
(100-111)activeSubgraphs
(126-137)
packages/webapp/src/routes/+layout.ts (2)
packages/ui-components/src/lib/types/appStores.ts (1)
AppStoresInterface
(3-20)tauri-app/src/lib/stores/settings.ts (5)
settings
(25-36)accounts
(99-99)activeAccountsItems
(100-111)subgraph
(82-86)activeOrderbook
(75-81)
⏰ Context from checks skipped due to timeout of 90000ms (16)
- GitHub Check: test
- GitHub Check: standard-tests (ubuntu-latest, test-js-bindings)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-static)
- GitHub Check: build-tauri (ubuntu-22.04, true)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-artifacts, true)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-legal)
- GitHub Check: 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-artifacts)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-static)
- GitHub Check: test
- GitHub Check: git-clean
- GitHub Check: Deploy-Preview
🔇 Additional comments (40)
tauri-app/src/routes/vaults/+page.svelte (2)
8-8
: LGTM: Import updated to use the new configuration structureThis change correctly updates the import from
subgraphUrl
tosubgraph
, aligning with the broader migration from simple string URLs to structuredSubgraphCfg
objects.
45-45
: LGTM: Updated prop to pass the new subgraph objectThe prop passed to the
VaultsListTable
component has been correctly updated fromsubgraphUrl
tosubgraph
, ensuring the component receives the proper structured configuration object.packages/ui-components/src/__tests__/DropdownOrderListAccounts.test.ts (2)
5-5
: LGTM: Updated account type to use the new AccountCfg structureThe type definition has been properly updated to import and use the
AccountCfg
type from@rainlanguage/orderbook
, which aligns with the broader migration to structured configuration objects.Also applies to: 8-8
13-24
: LGTM: Updated mock data to match the new AccountCfg structureThe test mock data has been correctly updated to use objects with
address
andkey
properties instead of simple strings, ensuring tests are consistent with the new data structure.packages/ui-components/src/lib/components/dropdown/DropdownOrderListAccounts.svelte (2)
2-2
: LGTM: Updated component to use the new AccountCfg typeThe import and prop type declaration have been correctly updated to use the
AccountCfg
type from@rainlanguage/orderbook
.Also applies to: 5-5
7-9
: LGTM: Updated options mapping to extract address from AccountCfgThe reactive statement has been properly modified to extract the
address
property from eachAccountCfg
value, ensuring the dropdown displays the correct information despite the change in the underlying data structure.tauri-app/src/lib/services/order.ts (3)
3-3
: LGTM: Updated import to use the new subgraph storeThe import has been correctly updated from
subgraphUrl
tosubgraph
, aligning with the broader migration to structured configuration objects.
29-29
: LGTM: Updated to use the subgraph URL propertyThe code now correctly accesses the URL property from the subgraph configuration object.
50-50
: Fix missing optional chaining in URL accessThe URL property is correctly accessed, but there's an inconsistency with the handling in line 29. Both should use optional chaining to safely access the URL property.
- url: get(subgraph)?.url, + url: get(subgraph)?.url,Wait, there's no actual issue here as the code already has optional chaining. This is correct as is.
tauri-app/src/lib/stores/order.ts (4)
3-3
: Import updated to use new subgraph storeThe import has been updated from
subgraphUrl
tosubgraph
to align with the new configuration structure where subgraphs are now objects with properties rather than simple URL strings.
10-11
: Correctly implemented previous review feedbackThis implementation properly addresses the previous review comment by passing only the URL property in a structured object (
{ url: loadedSubgraph?.url }
) rather than the entire subgraph object.
19-22
: Consistent subgraph URL handlingThe implementation correctly follows the same pattern for passing the subgraph URL, ensuring consistency across all invoke calls.
27-32
: CSV export function updated consistentlyThe CSV export function has been updated to consistently use the same subgraph URL structure as other calls.
tauri-app/src/lib/stores/settings.test.ts (4)
6-6
: Updated imports to use the new Config typesImports have been updated to replace
ConfigSource
withConfig
and the specific config types needed for the tests.
9-54
: Mock configuration updated to use new nested structureThe mock configuration has been properly updated to use the new
Config
structure with nested objects including explicitkey
properties and typed sub-objects for networks, subgraphs, orderbooks, and deployers.
71-75
: Updated test expectations for subgraph structureTest expectations have been updated to match the new structure of subgraphs, which now include a
key
property and aurl
property instead of being simple strings.
113-125
: 🧹 Nitpick (assertive)Consistent use of type casting in tests
Similar to the previous test case, this test also uses type casting. Consider refactoring the mock data structure to better match the expected types and reduce the need for type assertions.
Also applies to: 155-155
⛔ Skipped due to learnings
Learnt from: hardingjam PR: rainlanguage/rain.orderbook#1615 File: packages/webapp/src/routes/deploy/+layout.ts:37-56 Timestamp: 2025-04-09T13:13:48.419Z Learning: For test fixtures in the Rain codebase, it's acceptable to use type casting (e.g., `as unknown as SomeType[]`) for minimal test fixtures rather than creating fully-populated mock objects, especially when the internal structure of the mock data isn't critical to the tests.
packages/ui-components/src/lib/components/ListViewOrderbookFilters.svelte (2)
11-11
: Updated imports for new configuration typesImports have been updated to use the more granular types (
AccountCfg
,Config
,SubgraphCfg
) instead of the previous monolithicConfigSource
type, reflecting the new configuration model.
15-16
: Updated prop types to match new configuration structureThe component's prop types have been correctly updated to use the new configuration structure:
settings
now usesConfig
instead ofConfigSource
accounts
now expectsRecord<string, AccountCfg>
instead of a simple string mapactiveSubgraphs
now expectsRecord<string, SubgraphCfg>
with the new subgraph structureThis change correctly aligns with the broader refactor to use a more structured configuration model.
Also applies to: 20-20
tauri-app/src/tests/pickConfig.test.ts (4)
4-4
: Updated imports to match new configuration typesImport statements have been simplified to remove unused types (
ConfigSource
,DeploymentConfigSource
) and retain only the necessary types (Config
,DeploymentCfg
,ScenarioCfg
), aligning with the overall codebase cleanup.
174-181
: Account structure updated to nested objectsThe
accounts
field in the test configuration has been updated from simple string mappings to objects withkey
andaddress
properties, consistent with the newAccountCfg
type.
187-240
: Test expectations updated for new deployment structureThe test expectations for
pickDeployments
have been properly updated to use the new nested structure with explicit keys and references to full network and subgraph details, reflecting the richerDeploymentCfg
structure.
248-249
: Consistent updates across all test functionsAll test functions have been consistently updated to handle the new configuration structure, including this empty result test case.
crates/js_api/src/config.rs (2)
4-11
: Implementation looks good - well-designed WASM bindingThe implementation of this WASM binding function is clean and straightforward. I like that:
- It's a synchronous function - appropriate since no actual async work is being done
- It provides validation as an optional parameter with a sensible default
- It leverly leverages the
Config::try_from_settings
method to parse the settingsThis aligns perfectly with the PR objective of removing the config source and simplifies the API.
175-188
: Well-designed test with proper validationThe test ensures that parsing YAML configurations produces the same result whether done directly via Rust or through the WASM binding. This is an excellent verification strategy that confirms the consistency of the configuration parsing across language boundaries.
packages/ui-components/src/lib/types/appStores.ts (2)
2-2
: Type imports correctly updated to use the new config systemThe import statement is properly updated to import the new typed configuration models instead of the old
ConfigSource
types.
4-18
: Interface properties properly migrated to structured config typesAll interface properties have been consistently updated to use the new configuration types:
settings
is nowConfig
instead ofConfigSource
activeSubgraphs
now uses structuredSubgraphCfg
objectssubgraphUrl
is renamed tosubgraph
and usesSubgraphCfg
activeOrderbook
andactiveAccounts
use their respective typed configsThis delivers on the PR's goal of removing config source dependencies throughout the codebase.
packages/ui-components/src/lib/components/tables/VaultsListTable.svelte (5)
13-18
: Import statement correctly updated to use typed configsThe import statement is properly updated to import the new configuration types that replace the removed
ConfigSource
.
30-37
: Props correctly updated to use structured config typesThese props are properly updated to use the new configuration types (
OrderbookCfg
,SubgraphCfg
,Config
), replacing the old string-based orConfigSource
-based types.
41-43
: activeAccounts type properly updated to use AccountCfgThe nested type definition for
activeAccounts
is correctly updated to use the newAccountCfg
type.
54-59
: Reactive statement updated to handle the new structureThe reactive statement for
multiSubgraphArgs
is properly updated to extract the URL from theSubgraphCfg
object viavalue.url
property instead of using the value directly, reflecting the migration from string values to structured objects.
92-93
: Query enabled condition updated for new subgraph typeThe
enabled
property of the query is correctly updated to check for the existence of the newsubgraph
store (renamed fromsubgraphUrl
).tauri-app/src/lib/stores/settings.ts (8)
9-9
: Imports correctly updated to use the new config typesThe import statement is properly updated to import the new configuration types that replace the removed
ConfigSource
.
25-36
: Settings store type updated to use the new Config typeThe
settings
store is correctly updated to use the newConfig
type instead ofConfigSource
, along with appropriate JSON parsing logic.
52-52
: Property access standardized to camelCaseThe
chainId
derived store now directly accesses thechainId
property instead of using the string key'chain-id'
, which is a more consistent approach in TypeScript.
65-74
: Filtering logic updated to use structured config typesThe
activeNetworkOrderbooks
derived store is properly updated to filter orderbooks by comparing the structuredorderbook.network.key
to the active network reference, instead of using direct string comparisons.
82-86
: Renamed and updated subgraph derived storeThe store is properly renamed from
subgraphUrl
tosubgraph
and updated to access the subgraph configuration using the new nested structure via$activeOrderbook.subgraph.key
.
123-126
: Additional derived store for subgraph entriesA derived store for subgraph entries is properly added to provide access to the structured subgraph configurations.
126-137
: ActiveSubgraphs writable store updated to structured typeThe
activeSubgraphs
cached writable store is correctly updated to use the newRecord<string, SubgraphCfg>
type instead of strings.
170-179
: Accounts filtering logic updated for structured typesThe subscription callback for the
settings
store is properly updated to filter and map account entries based on the new structure, comparingvalue.address
instead of the value directly.
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: 3
♻️ Duplicate comments (1)
tauri-app/src/lib/stores/settings.test.ts (1)
140-140
: Type assertion used repeatedly in test casesMultiple test cases use
as unknown as Config
to force type compatibility. While this works for tests, it would be better to properly type the test objects to avoid these casts.Also applies to: 153-153, 164-164
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
packages/ui-components/src/lib/types/appStores.ts
(1 hunks)tauri-app/src/lib/services/order.ts
(3 hunks)tauri-app/src/lib/stores/settings.test.ts
(5 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
tauri-app/src/lib/services/order.ts (1)
tauri-app/src/lib/stores/settings.ts (1)
subgraph
(82-86)
tauri-app/src/lib/stores/settings.test.ts (1)
tauri-app/src/lib/stores/settings.ts (3)
settings
(25-36)activeAccountsItems
(100-111)activeSubgraphs
(126-137)
⏰ Context from checks skipped due to timeout of 90000ms (16)
- GitHub Check: test
- GitHub Check: standard-tests (ubuntu-latest, test-js-bindings)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-artifacts)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-artifacts)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-legal)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-artifacts, true)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-static)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-static)
- GitHub Check: standard-tests (ubuntu-latest, ob-rs-test, true)
- GitHub Check: build-tauri (ubuntu-22.04, true)
- GitHub Check: test
- GitHub Check: Deploy-Preview
- GitHub Check: test
- GitHub Check: git-clean
🔇 Additional comments (11)
tauri-app/src/lib/services/order.ts (3)
3-3
: Updated import to use subgraph object from settings storeThe import has been correctly updated to use
subgraph
instead of the previoussubgraphUrl
. This aligns with the broader PR changes replacing the config source with the structured Config object.
30-30
: Correctly accessing URL property from subgraph objectThe code now properly accesses the URL via the
?.url
property from the subgraph object, with optional chaining to handle potential undefined values. This matches the new configuration structure where subgraphs are objects containing key and URL properties rather than simple string URLs.
52-52
: Consistent parameter format for subgraph URLThe code now consistently passes subgraph information as an object with a URL property across both
orderRemove
andorderRemoveCalldata
functions. This standardization addresses the inconsistency mentioned in previous review comments.tauri-app/src/lib/stores/settings.test.ts (4)
4-4
: Updated type imports to align with new Config structureThe imports have been correctly updated to use
Config
,NetworkCfg
, andSubgraphCfg
types from the orderbook package, which aligns with the PR's goal of replacing the legacyConfigSource
with the newConfig
type.
7-52
: Refactored mock configuration to use the new structured Config typeThe mock configuration has been properly restructured to use the new
Config
type with nested objects that have explicitkey
properties. Network and subgraph references now use typed objects instead of string keys.I notice the continued use of type assertions (
as unknown as NetworkCfg
,as unknown as SubgraphCfg
,as unknown as Config
). While this works for tests, it might indicate a need for better type definitions to avoid these casts.Could you check if it's possible to define the mock objects with proper types to avoid these type assertions? This would make the tests more type-safe and reduce the risk of errors.
69-73
: Updated activeSubgraphs structure to match the new Config formatThe activeSubgraphs test data has been correctly updated to use the object structure with
key
andurl
properties instead of simple strings, consistent with the changes in the main Config structure.
91-99
: Updated account structure in test casesThe account structure has been correctly updated to use objects with
key
andaddress
properties instead of simple string addresses, which aligns with the new Config structure.packages/ui-components/src/lib/types/appStores.ts (4)
2-2
: Imports updated to use new Config-based typesThis change properly imports the new configuration types (
AccountCfg
,Config
,OrderbookCfg
,SubgraphCfg
) that replace the previousConfigSource
-based system, aligning with the PR objective to remove the config source.
16-18
: Type change for activeAccounts propertyThe
activeAccounts
property now usesAccountCfg
objects instead of string values, which provides more structured configuration data. This is consistent with the overall migration from simple strings to richer configuration objects.
5-6
:✅ Verification successful
Data structure changes for subgraphs and accounts
The
activeSubgraphs
andaccounts
properties have been updated to use structured configuration objects (SubgraphCfg
andAccountCfg
) instead of simple string records. This change improves type safety but requires updates to any code that accesses these properties.
🏁 Script executed:
#!/bin/bash # Check for any code that directly accesses properties of these objects rg -A 2 -B 2 "activeSubgraphs\[|accounts\[" --type ts packages/ui-components/Length of output: 79
I want to double-check if any code is still using dot- or bracket-access on these stores or referencing the new types elsewhere:
🏁 Script executed:
#!/bin/bash # Look for any dot- or bracket-access to activeSubgraphs and accounts rg -n "activeSubgraphs(\[|\.)" -A2 -B2 packages/ui-components rg -n "accounts(\[|\.)" -A2 -B2 packages/ui-components # Find all usages of the new types and the appStores export rg -n "SubgraphCfg" -A2 -B2 . rg -n "AccountCfg" -A2 -B2 . rg -n "appStores" -A2 -B2 .Length of output: 38129
Data structure changes for subgraphs and accounts applied consistently
Verification confirms that all component and test usages ofactiveSubgraphs
andaccounts
now correctly useSubgraphCfg
andAccountCfg
. No remaining string‐based or outdated access patterns were detected.
4-4
:❓ Verification inconclusive
Settings type no longer allows undefined
The
settings
property has been updated to beWritable<Config>
instead ofWritable<ConfigSource | undefined>
, removing the possibility of it being undefined. Ensure that any code initializing or accessing this property has been updated to always provide a validConfig
object.
🏁 Script executed:
#!/bin/bash # Search for code that initializes or accesses the settings store rg -A 2 -B 2 "settings\s*=" --type ts packages/ui-components/Length of output: 63
I couldn’t find any direct
settings =
assignments, so let’s locate the type file and then look for allwritable
usages and any implicitsettings
assignments across the UI package:#!/bin/bash set -e # 1. Locate and dump the appStores type file FILE=$(fd appStores.ts -t f) echo "=== File: $FILE ===" sed -n '1,200p' "$FILE" # 2. List all places where stores are created echo "=== All 'writable' usages ===" rg -n "writable" packages/ui-components/ # 3. Search for any 'settings =' patterns (all file types) echo "=== All 'settings =' assignments ===" rg -n "settings\s*=" packages/ui-components/
Let’s locate where the
settings
store is actually created or initialized in the UI package:#!/usr/bin/env bash set -e # 1. Dump the appStores type definition FILE=$(fd appStores.ts -t f) echo "=== appStores.ts ===" sed -n '1,200p' "$FILE" # 2. Find where a `settings` store is instantiated or assigned echo "=== settings = writable(...) ===" rg -n "settings\s*=\s*writable" -R packages/ui-components # 3. Find any writable<Config> usage for context echo "=== writable<Config> usages ===" rg -n "writable<Config" -R packages/ui-components # 4. Show surrounding context for all writable calls echo "=== All writable(...) contexts ===" rg -n -A5 -B5 "writable" -R packages/ui-components
Ensure
settings
store is always initialized with a valid ConfigYou’ve changed
settings
fromWritable<ConfigSource | undefined>
toWritable<Config>
, so it can no longer beundefined
. Please verify that:
- Any code that instantiates the
settings
store (e.g. in your app’s store setup) now always provides a fully populatedConfig
object.- All checks or branches that handled
settings === undefined
have been removed or updated.I didn’t find any direct
settings = ...
assignments in the UI package—be sure to double-check your application’s store initialization and consumer code for leftover undefined 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.
Actionable comments posted: 2
🔭 Outside diff range comments (2)
tauri-app/src/lib/stores/settings.ts (2)
203-210
: 🛠️ Refactor suggestionSubgraph filtering logic is missing the same mapping operation.
The account filtering logic uses
.map()
to transform objects, but the subgraph filtering logic doesn't, which could lead to inconsistent behavior.For consistency with the account filtering logic above, consider adding a similar mapping operation:
const updatedActiveSubgraphs = Object.fromEntries( Object.entries($settings.subgraphs).filter(([key, value]) => { if (key in currentActiveSubgraphs) { return currentActiveSubgraphs[key].key === value.key; } return false; - }), + }).map(([key, value]) => [key, value]), );Or if the mapping operation is unnecessary in both cases, remove it from the account filtering logic.
170-170
:⚠️ Potential issueLogic error in condition check.
The condition uses a negation (
!
) with an equality check (===undefined
), which means the condition will be true if$settings?.orderbooks
is not undefined, which is the opposite of what's intended.Fix the condition to check if orderbooks is undefined:
- if ( - !$settings?.orderbooks === undefined || + if ( + $settings?.orderbooks === undefined ||
♻️ Duplicate comments (6)
tauri-app/src/lib/stores/settings.test.ts (6)
40-43
: Type assertions in mock should be avoided (duplicate).Similar to the previous issue with
network
andsubgraph
type assertions.Create proper mock objects that match the expected types without assertions:
- network: { - key: 'mainnet', - } as unknown as NetworkCfg, + network: mockConfig.networks.mainnet,
164-164
: Unnecessary type assertion in test.Same issue as above with type assertion when setting store values.
Fix the mock data structure to match the expected type instead of using type assertions:
-settings.set(newSettings as unknown as Config); +settings.set(newSettings);
175-175
: Unnecessary type assertion in test.Same issue as above with type assertion when setting store values.
Fix the mock data structure to match the expected type instead of using type assertions:
-settings.set(newSettings as unknown as Config); +settings.set(newSettings);
143-143
: 🛠️ Refactor suggestionUnnecessary type assertion in test.
The test uses
as unknown as Config
when setting values in the store, which indicates a type mismatch between the mock data and the expected type.Fix the mock data structure to match the expected type instead of using type assertions:
-settings.set(newSettings as unknown as Config); +settings.set(newSettings);
27-33
: 🛠️ Refactor suggestionType assertions in mock should be avoided.
The code is using type assertions (
as unknown as NetworkCfg
andas unknown as SubgraphCfg
) to force the nested mock objects to match the expected types. This approach is error-prone and bypasses TypeScript's type checking.Consider creating proper mock objects that match the expected types without assertions:
- network: { - key: 'mainnet', - } as unknown as NetworkCfg, - subgraph: { - key: 'uniswap', - } as unknown as SubgraphCfg, + network: mockConfig.networks.mainnet, + subgraph: { + key: 'uniswap', + url: 'https://api.thegraph.com/subgraphs/name/uniswap' + },
52-52
: 🛠️ Refactor suggestionUnnecessary type assertion at the top level mock.
The mock object is unnecessarily cast using a double assertion pattern.
If the mock structure matches the
Config
type, the assertion shouldn't be needed. Consider removing it or fixing the mock structure to match the type:-} as unknown as Config; +};
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
tauri-app/src/lib/stores/settings.test.ts
(4 hunks)tauri-app/src/lib/stores/settings.ts
(8 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tauri-app/src/lib/stores/settings.test.ts (1)
tauri-app/src/lib/stores/settings.ts (4)
settings
(39-50)EMPTY_SETTINGS
(13-25)activeAccountsItems
(114-125)activeSubgraphs
(140-151)
⏰ Context from checks skipped due to timeout of 90000ms (16)
- GitHub Check: test
- GitHub Check: git-clean
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-legal)
- GitHub Check: standard-tests (ubuntu-latest, test-js-bindings)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-test)
- GitHub Check: build-tauri (ubuntu-22.04, true)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-static)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-artifacts)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-static)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-artifacts)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-artifacts, true)
- GitHub Check: standard-tests (ubuntu-latest, ob-rs-test, true)
- GitHub Check: test
- GitHub Check: Deploy-Preview
- GitHub Check: test
🔇 Additional comments (1)
tauri-app/src/lib/stores/settings.ts (1)
185-193
: 🧹 Nitpick (assertive)Updated account filtering logic to handle new object structure.
The logic has been updated to account for the new structure of accounts, but there's an extra map operation that could be simplified.
The
.map()
operation can be inlined into the filter result:const updatedActiveAccounts = Object.fromEntries( Object.entries($settings.accounts ?? {}) .filter(([key, value]) => { if (key in currentActiveAccounts) { return currentActiveAccounts[key] === value.address; } return false; - }) - .map(([key, value]) => [key, value.address]), + }) + .map(([key, value]) => [key, value.address]), );Likely an incorrect or invalid review comment.
Cargo.toml
Outdated
@@ -54,6 +54,7 @@ portpicker = "0.1.1" | |||
rain-erc = { git = "https://github.com/rainlanguage/rain.erc", rev = "0106e645ebd49334addc698c5aad9a85370eb54d" } | |||
rain-error-decoding = { git = "https://github.com/rainlanguage/rain.error", rev = "72d9577fdaf7135113847027ba951f9a43b41827" } | |||
wasm-bindgen-utils = "0.0.7" | |||
web-sys = { version = "0.3.77", features = [ "console" ] } |
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.
what is web-sys being used for?
Things to do
|
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: 7
🔭 Outside diff range comments (1)
packages/webapp/src/routes/+layout.ts (1)
59-63
:⚠️ Potential issue
activeSubgraphs
gains a wrong element typeThe interface requires
Writable<Record<string, SubgraphCfg>>
, yet we provideWritable<Record<string, string>>
.
Return the actual config objects to keep runtime and typing consistent.- activeSubgraphs: writable<Record<string, string>>({}), + activeSubgraphs: writable<Record<string, SubgraphCfg>>({}),
♻️ Duplicate comments (4)
tauri-app/src/lib/stores/settings.test.ts (3)
30-30
: 🧹 Nitpick (assertive)Type assertion usage in test
The test uses
as unknown as Config
andas unknown as NetworkCfg
to force type compatibility. While this works for tests, consider improving the type definitions to avoid the need for this kind of casting.Also applies to: 42-42, 154-154, 178-178, 192-192
117-131
: 🛠️ Refactor suggestionInconsistent account structure in second test
The second test also uses the object structure for accounts while the mock uses strings. This inconsistency should be resolved to ensure test reliability.
93-104
: 🛠️ Refactor suggestionInconsistent account structure in test data
There's an inconsistency in how accounts are structured. The original mock uses string values for accounts (lines 50-51), but the test update uses object structure with
key
andaddress
properties. This makes the API usage confusing.Make the account structure consistent throughout the test file:
- accounts: { - name_one: 'address_one', - name_two: 'address_two', - }, + accounts: { + name_one: { + key: 'name_one', + address: 'address_one', + }, + name_two: { + key: 'name_two', + address: 'address_two', + }, + },packages/webapp/src/routes/+layout.ts (1)
28-37
: Duplicate comment – previous review on using nativeObject.entries
instead of lodash/pickByThe cast to
unknown as
plus lodash import was discussed earlier; keeping as-is per owner’s decision.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
tauri-app/src-tauri/Cargo.lock
is excluded by!**/*.lock
📒 Files selected for processing (17)
crates/cli/src/commands/chart/mod.rs
(2 hunks)crates/common/src/frontmatter.rs
(1 hunks)crates/common/src/fuzz/impls.rs
(9 hunks)crates/common/src/unit_tests/mod.rs
(2 hunks)crates/js_api/src/config.rs
(1 hunks)crates/settings/src/config.rs
(1 hunks)crates/settings/src/test.rs
(1 hunks)packages/webapp/src/routes/+layout.ts
(17 hunks)packages/webapp/test-setup.ts
(1 hunks)tauri-app/src-tauri/src/commands/config.rs
(1 hunks)tauri-app/src/lib/components/ModalExecute.svelte
(1 hunks)tauri-app/src/lib/components/ModalExecute.test.ts
(2 hunks)tauri-app/src/lib/services/pickConfig.ts
(2 hunks)tauri-app/src/lib/stores/settings.test.ts
(3 hunks)tauri-app/src/lib/stores/settings.ts
(7 hunks)tauri-app/src/lib/stores/walletconnect.ts
(1 hunks)tauri-app/src/tests/pickConfig.test.ts
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (6)
crates/cli/src/commands/chart/mod.rs (2)
tauri-app/src/tests/pickConfig.test.ts (1)
config
(6-187)crates/settings/src/config.rs (1)
try_from_yaml
(168-266)
tauri-app/src/lib/components/ModalExecute.test.ts (1)
tauri-app/src/lib/stores/settings.ts (1)
settings
(48-59)
tauri-app/src/lib/services/pickConfig.ts (1)
tauri-app/src/lib/stores/settings.ts (1)
activeNetworkRef
(65-65)
tauri-app/src-tauri/src/commands/config.rs (1)
crates/settings/src/config.rs (1)
try_from_yaml
(168-266)
tauri-app/src/lib/stores/settings.test.ts (1)
tauri-app/src/lib/stores/settings.ts (4)
settings
(48-59)EMPTY_SETTINGS
(18-34)activeAccountsItems
(123-134)activeSubgraphs
(149-160)
packages/webapp/src/routes/+layout.ts (2)
packages/ui-components/src/lib/types/appStores.ts (1)
AppStoresInterface
(3-20)tauri-app/src/lib/stores/settings.ts (5)
settings
(48-59)accounts
(122-122)activeAccountsItems
(123-134)subgraph
(105-109)activeOrderbook
(98-104)
🪛 Biome (1.9.4)
tauri-app/src/tests/pickConfig.test.ts
[error] 5-187: Do not export from a test file.
(lint/suspicious/noExportsInTest)
🔇 Additional comments (22)
tauri-app/src/lib/components/ModalExecute.svelte (1)
35-36
: Configuration structure update looks goodThe code now correctly accesses networks through the nested
orderbook
property and uses the camelCasechainId
property, which aligns with the new configuration structure. This change is consistent with the PR objective of removing the config source and splitting the Config struct.tauri-app/src/lib/stores/walletconnect.ts (1)
74-77
: Network configuration path updated correctlyThe update correctly accesses network configurations from the nested
orderbook.networks
property and uses camelCasechainId
property, maintaining consistency with the new configuration structure throughout the application.packages/webapp/test-setup.ts (1)
17-18
: Good addition of parseYaml mockThe mock now includes the
parseYaml
function that replaces the previous config source parsing approach. This ensures tests will work correctly with the new configuration handling pattern.crates/cli/src/commands/chart/mod.rs (2)
4-4
: Simpler import reflects removed ConfigSourceThe import now correctly includes only
Config
and removes the no-longer-neededConfigSource
, aligning with the PR objective.
25-25
: Configuration parsing simplifiedThe code now uses the direct
Config::try_from_yaml
method instead of the previous two-step process withConfigSource
. This simplification makes the code more maintainable and less error-prone.Based on the implementation of
try_from_yaml
from the relevant code snippets, this approach correctly handles YAML parsing into the new structured Config object.tauri-app/src/lib/components/ModalExecute.test.ts (1)
28-28
: Correctly updated test to use new Config structure.The test file has been properly adapted to the new
Config
type structure with nested properties. The changes correctly implement:
- The import of the new
Config
type- The nesting of configurations under the
orderbook
property- The use of camelCase property names (e.g.,
chainId
instead ofchain-id
)- Additional
key
property for network identificationThese changes align with the broader refactoring to improve configuration organization.
Also applies to: 35-38, 67-76
crates/common/src/frontmatter.rs (1)
3-8
: API improvement: Simplified frontmatter parsing.The function has been successfully converted from an asynchronous
ConfigSource
parser to a synchronousConfig
parser, which streamlines the API by:
- Removing unnecessary asynchronous complexity
- Adding explicit validation control with the
validate
parameter- Eliminating the intermediate
ConfigSource
conversion stepThis change aligns well with the PR's goal of removing the config source and makes the configuration parsing more direct and straightforward.
crates/settings/src/test.rs (1)
93-252
: Well-structured mock data enhances test coverage.The addition of these comprehensive YAML mock constants is excellent for testing:
- They provide consistent, reusable test data across multiple test cases
- They serve as documentation for the expected configuration structure
- They enable thorough testing of the configuration parsing logic
- They cover a wide range of configuration scenarios including networks, tokens, deployers, orders, scenarios, and charts
These constants will make tests more reliable and easier to maintain while ensuring the new
Config
parsing functionality is well-tested with realistic data.crates/common/src/fuzz/impls.rs (3)
94-94
: Properly updated to use encapsulated Config getter methods.The code has been updated to use the proper getter methods (
get_scenarios()
andget_charts()
) instead of direct field access, aligning with the encapsulation provided by the newConfig
structure.Also applies to: 232-232
267-295
: Good addition of reusable test configuration.The addition of a constant YAML configuration for testing provides a reusable, consistent configuration structure that can be used across multiple test cases, improving test maintainability.
327-329
: Successfully updated tests to use synchronous Config parsing.All test cases have been properly updated to use the new synchronous
Config::try_from_yaml
method, combining the frontmatter and constant YAML configuration. This is more straightforward than the previous approach and correctly implements the new configuration parsing design.Also applies to: 380-382, 441-443, 498-500, 544-546, 585-587
crates/common/src/unit_tests/mod.rs (4)
325-325
: API change: Using getter method instead of direct field accessThe change from accessing
main_config.deployers
directly to usingmain_config.get_deployers()
aligns with the encapsulation ofConfig
struct fields mentioned in the PR objectives. This improves the API by enforcing access through getters rather than exposing internal fields.
375-403
: Added static configuration for testsThe new
SETTINGS
constant provides a centralized, static configuration for tests, replacing what was likely dynamic configuration generation or multiple config fragments. This approach is cleaner and more maintainable as all test settings are defined in one place.
407-407
: Updated configuration parsing methodThe change from the previous approach to using
Config::try_from_yaml()
aligns with the PR objective of removing the config source and simplifying the configuration handling.
413-413
:✅ Verification successful
Simplified test config conversion
The updated code directly uses
source.test.try_into_test_config()
without additional error handling, which simplifies the code. However, make sure this method properly handles errors internally or that errors at this point are expected to be fatal to the test.Run this script to check if
try_into_test_config()
handles errors properly:
🏁 Script executed:
#!/bin/bash # Check if try_into_test_config handles errors internally rg -A 5 "try_into_test_config" crates/settings/src/unit_test.rsLength of output: 278
Simplified test config conversion is safe
The
try_into_test_config()
method returns aTestConfig
(not aResult
) and contains no error branches or panics, so invoking it directly here requires no additional error handling.• crates/common/src/unit_tests/mod.rs:413
tauri-app/src/lib/stores/settings.test.ts (3)
7-54
: Updated mock Config structure with nested fieldsThe mock configuration has been updated to match the new
Config
structure with nestedorderbook
anddotrainOrder
properties, reflecting the refactoring mentioned in the PR objectives. This ensures tests will validate against the correct structure.
144-150
: Updated subgraph structure in testThe subgraph structure has been updated to use proper object format with
key
andurl
properties instead of simple strings, fixing the issue highlighted in a previous review.
169-173
: Updated subgraph structure in testThis test case properly uses the object structure for subgraphs with
key
andurl
properties, addressing the issue from a previous review.tauri-app/src/lib/services/pickConfig.ts (1)
25-28
: Updated property access in pickScenarios functionThe
pickScenarios
function has been updated to work with the nesteddotrainOrder.scenarios
structure, maintaining consistent access patterns with other code changes.crates/js_api/src/config.rs (2)
4-11
: New synchronous YAML parser for WebAssemblyThis new function provides a synchronous YAML parsing interface for WebAssembly, allowing JavaScript code to parse configuration directly. The function properly wraps the
Config::try_from_yaml
method and handles potential errors.
175-188
: Comprehensive test for YAML parsingThe test verifies that the WebAssembly binding produces results consistent with direct Rust parsing, ensuring compatibility between the two approaches. The test uses realistic YAML examples that cover various configuration scenarios.
tauri-app/src/lib/stores/settings.ts (1)
148-160
: Potential JSON-serialisation pitfalls for complexSubgraphCfg
objects
activeSubgraphs
persists aRecord<string, SubgraphCfg>
byJSON.stringify/parse
.
IfSubgraphCfg
ever gains non-JSON-serialisable fields (e.g.BigInt
,Url
objects or methods added by Wasm-bindgen), they will be silently lost on reload, producing plain objects that no longer satisfy the expected run-time contracts.A safer pattern is to persist only the keys (string list) and rebuild the objects from
$settings.orderbook.subgraphs
on load – mirroring the approach used foractiveOrderbookRef
andactiveNetworkRef
.[ suggest_optional_refactor ]
#[tauri::command] | ||
pub async fn parse_configstring(text: String) -> CommandResult<ConfigSource> { | ||
Ok(ConfigSource::try_from_string(text, None).await?.0) | ||
pub fn parse_configstring(text: String, validate: bool) -> CommandResult<Config> { | ||
Ok(Config::try_from_yaml(vec![text], validate)?) | ||
} |
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 (assertive)
Consider off-loading YAML parsing to a background thread
Both parse_configstring
and merge_configstrings
are now synchronous and run on Tauri’s main JS thread.
Config::try_from_yaml
performs YAML deserialization and a fair amount of collection building (see crates/settings/src/config.rs:168-266
). On large config files this can easily block the event-loop long enough to freeze the UI.
#[tauri::command]
pub async fn parse_configstring(text: String, validate: bool) -> CommandResult<Config> {
tauri::async_runtime::spawn_blocking(move || Config::try_from_yaml(vec![text], validate))
.await?
}
The same pattern can be applied to merge_configstrings
.
If you prefer to keep a sync signature, at least mark the command with tauri::command(async)
so Tauri spawns it on its thread-pool.
Also applies to: 11-23
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.
No need to do this
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 respect your decision on this.
(/ᐠ⑅•ω•⑅ᐟ)\
pub fn get_orderbook_config(&self) -> OrderbookConfig { | ||
self.orderbook.clone() | ||
} | ||
|
||
pub fn get_dotrain_order_config(&self) -> DotrainOrderConfig { | ||
self.dotrain_order.clone() | ||
} |
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 (assertive)
Avoid cloning large config trees in getters
get_orderbook_config()
and get_dotrain_order_config()
return owned copies, cloning every HashMap
(even if the values are Arc
).
In real-world configs with hundreds of entries this creates avoidable allocations every time a caller needs read-only access.
- pub fn get_orderbook_config(&self) -> OrderbookConfig {
- self.orderbook.clone()
- }
+ pub fn orderbook_config(&self) -> &OrderbookConfig {
+ &self.orderbook
+ }
- pub fn get_dotrain_order_config(&self) -> DotrainOrderConfig {
- self.dotrain_order.clone()
- }
+ pub fn dotrain_order_config(&self) -> &DotrainOrderConfig {
+ &self.dotrain_order
+ }
Returning references keeps the API ergonomic, eliminates the extra hashes, and leaves cloning to callers that truly need ownership.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
pub fn get_orderbook_config(&self) -> OrderbookConfig { | |
self.orderbook.clone() | |
} | |
pub fn get_dotrain_order_config(&self) -> DotrainOrderConfig { | |
self.dotrain_order.clone() | |
} | |
pub fn orderbook_config(&self) -> &OrderbookConfig { | |
&self.orderbook | |
} | |
pub fn dotrain_order_config(&self) -> &DotrainOrderConfig { | |
&self.dotrain_order | |
} |
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.
No need to do this now
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 move on from this optimization suggestion.
✏️ Learnings added
Learnt from: findolor
PR: rainlanguage/rain.orderbook#1689
File: crates/settings/src/config.rs:268-274
Timestamp: 2025-04-28T07:35:23.455Z
Learning: The user (findolor) has decided not to modify the `get_orderbook_config()` and `get_dotrain_order_config()` methods to return references instead of cloned objects at this time, as it's not currently a priority.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
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: 6
🔭 Outside diff range comments (1)
tauri-app/src/tests/pickConfig.test.ts (1)
417-437
:⚠️ Potential issueMock returns a YAML string instead of a
Config
– test passes by accidentHere
vi.mocked(parseYaml).mockReturnValue(partialSettings as unknown as Config)
feeds the raw YAML string intoload()
.
load()
then executes.orderbook
on that string, silently yieldingundefined
, so the stores are seeded withundefined
instead of a valid (even if partial) object.This hides real-world failures (e.g. runtime error when accessing
$settings.accounts
).
Return a minimal but typed object instead:-vi.mocked(parseYaml).mockReturnValue(partialSettings as unknown as Config); +vi.mocked(parseYaml).mockReturnValue({ orderbook: {} } as Config);or craft a proper
Config
reflecting the partial content you want to test.
♻️ Duplicate comments (2)
packages/webapp/src/routes/+layout.ts (1)
30-37
: 🧹 Nitpick (assertive)
unknown as
cast &pickBy
pull unnecessary weightThe cast hides potential typing errors and the full lodash bundle costs ≈ 70 kB (min+gzip).
A fully typed, treeshake-friendly alternative:
- return $settings?.orderbooks - ? (pickBy( - $settings.orderbooks as unknown as Record<string, OrderbookCfg>, - (orderbook) => orderbook.network.key === $activeNetworkRef - ) as Record<string, OrderbookCfg>) - : ({} as Record<string, OrderbookCfg>); + if (!$settings?.orderbooks) return {}; + return Object.fromEntries( + Object.entries($settings.orderbooks).filter( + ([, ob]) => ob.network.key === $activeNetworkRef, + ), + ) as Record<string, OrderbookCfg>;Eliminates the cast and avoids pulling
pickBy
.tauri-app/src/lib/stores/settings.ts (1)
210-218
: Redundantmap
removed – cleaner and cheaperNice follow-up to the earlier nitpick: the
filter
result is now passed straight toObject.fromEntries
, eliminating the no-opmap
.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
packages/ui-components/src/lib/types/appStores.ts
(1 hunks)packages/webapp/src/routes/+layout.ts
(17 hunks)tauri-app/src/lib/services/pickConfig.ts
(2 hunks)tauri-app/src/lib/stores/settings.ts
(7 hunks)tauri-app/src/tests/pickConfig.test.ts
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
tauri-app/src/lib/services/pickConfig.ts (1)
tauri-app/src/lib/stores/settings.ts (1)
activeNetworkRef
(65-65)
tauri-app/src/tests/pickConfig.test.ts (2)
tauri-app/src/lib/stores/settings.ts (1)
activeNetwork
(66-73)tauri-app/src/lib/services/pickConfig.ts (1)
pickDeployments
(4-16)
packages/webapp/src/routes/+layout.ts (2)
packages/ui-components/src/lib/types/appStores.ts (1)
AppStoresInterface
(9-26)tauri-app/src/lib/stores/settings.ts (5)
settings
(48-59)accounts
(122-122)activeAccountsItems
(123-134)subgraph
(105-109)activeOrderbook
(98-104)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: test
🔇 Additional comments (4)
packages/ui-components/src/lib/types/appStores.ts (1)
11-17
: Type mismatch foractiveSubgraphs
AppStoresInterface.activeSubgraphs
is declared asWritable<Record<string, SubgraphCfg>>
, but the provider in+layout.ts
initialises it withRecord<string, string>
.
Either change the interface toRecord<string, string>
or initialise the store with properSubgraphCfg
objects to keep the contract sound.packages/webapp/src/routes/+layout.ts (1)
60-73
: Interface drift:activeNetworkOrderbooks
is not part ofAppStoresInterface
LayoutData.stores
is typed asAppStoresInterface
, yet you append an extraactiveNetworkOrderbooks
store.
While TypeScript’s structural typing allows excess properties, consumers relying on the interface won’t “see” this store.Either
- add
activeNetworkOrderbooks
toAppStoresInterface
, or- expose it through a separate top-level property (e.g.
derivedStores
) to keep the contract clear.tauri-app/src/lib/stores/settings.ts (2)
82-84
: Confirm return type ofgetBlockNumberFromRpc
getBlockNumberFromRpc
looks like an async call (RPC).
If it actually returns aPromise<number>
,activeChainLatestBlockNumber
will emit a promise instead of a plainnumber
, which consumers may not expect.Please verify the signature and, if it is async, wrap the call in
asyncDerived
orawait
it before returning.
168-174
: Logic-negation bug fixed – good catchThe guard now correctly resets the active network when the reference is stale or the list is missing.
return !isNil(mergedConfig) | ||
? pickBy(mergedConfig.scenarios, (d) => d?.deployer?.network?.key === activeNetworkRef) | ||
? pickBy( | ||
mergedConfig.dotrainOrder.scenarios, | ||
(d) => d?.deployer?.network?.key === activeNetworkRef, | ||
) | ||
: {}; | ||
} |
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 (assertive)
Unify null-checks & add an explicit return type
pickScenarios
uses !isNil
whereas pickDeployments
relies on optional chaining. Mixing styles hampers readability and may confuse linters.
Consider:
-export function pickScenarios(
- mergedConfig: Config | undefined,
- activeNetworkRef: string | undefined,
-) {
- return !isNil(mergedConfig)
+export function pickScenarios(
+ mergedConfig: Config | undefined,
+ activeNetworkRef: string | undefined,
+): Record<string, ScenarioCfg>
+{
+ return mergedConfig?.dotrainOrder?.scenarios
This also documents the exact return type, helping downstream code and tests.
Committable suggestion skipped: line range outside the PR's diff.
$settings.orderbook.orderbooks | ||
? (pickBy( | ||
$settings.orderbooks, | ||
(orderbook) => orderbook.network === $activeNetworkRef, | ||
) as Record<OrderbookCfgRef, OrderbookConfigSource>) | ||
: ({} as Record<OrderbookCfgRef, OrderbookConfigSource>), | ||
$settings.orderbook.orderbooks, | ||
(orderbook) => orderbook.network.key === $activeNetworkRef, | ||
) as Record<string, OrderbookCfg>) | ||
: ({} as Record<string, OrderbookCfg>), | ||
); |
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 (assertive)
Avoid unsafe cast when filtering orderbooks
The cast as Record<string, OrderbookCfg>
hides potential mismatches between the runtime shape and the declared type.
You can preserve type-safety by helping TS with a generic on pickBy
instead of casting:
const filtered = pickBy(
$settings.orderbook.orderbooks,
(o): o is OrderbookCfg => o.network.key === $activeNetworkRef,
);
This keeps the resulting object strongly typed without a blanket assertion.
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.
No need to do this
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 respect your preference on this. The current implementation works fine as is.
export const activeNetwork = asyncDerived( | ||
[settings, activeNetworkRef], | ||
async ([$settings, $activeNetworkRef]) => { | ||
return $activeNetworkRef !== undefined && $settings?.networks !== undefined | ||
? $settings.networks[$activeNetworkRef] | ||
return $activeNetworkRef !== undefined && $settings.orderbook.networks !== undefined | ||
? $settings.orderbook.networks[$activeNetworkRef] | ||
: undefined; | ||
}, | ||
); |
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 (assertive)
asyncDerived
is unnecessary – switch to derived
and drop the unused import
The callback no longer performs any await
operations, so the async-aware helper adds overhead without benefits.
Replacing it with derived
also lets you remove the asyncDerived
import that is otherwise unused after this refactor.
-import { asyncDerived, derived, get } from '@square/svelte-store';
+import { derived, get } from '@square/svelte-store';
…
-export const activeNetwork = asyncDerived(
+export const activeNetwork = derived(
[settings, activeNetworkRef],
- async ([$settings, $activeNetworkRef]) => {
+ ([$settings, $activeNetworkRef]) => {
return $activeNetworkRef !== undefined && $settings.orderbook.networks !== undefined
? $settings.orderbook.networks[$activeNetworkRef]
: undefined;
},
);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export const activeNetwork = asyncDerived( | |
[settings, activeNetworkRef], | |
async ([$settings, $activeNetworkRef]) => { | |
return $activeNetworkRef !== undefined && $settings?.networks !== undefined | |
? $settings.networks[$activeNetworkRef] | |
return $activeNetworkRef !== undefined && $settings.orderbook.networks !== undefined | |
? $settings.orderbook.networks[$activeNetworkRef] | |
: undefined; | |
}, | |
); | |
--- a/tauri-app/src/lib/stores/settings.ts | |
+++ b/tauri-app/src/lib/stores/settings.ts | |
@@ -1,7 +1,6 @@ | |
-import { asyncDerived, derived, get } from '@square/svelte-store'; | |
+import { derived, get } from '@square/svelte-store'; | |
import { writable } from 'svelte/store'; | |
import type { Config } from '../../../crates/settings/src/types'; | |
@@ -66,8 +65,7 @@ export const activeNetworkRef = writable<string | undefined>(undefined); | |
-export const activeNetwork = asyncDerived( | |
- [settings, activeNetworkRef], | |
- async ([$settings, $activeNetworkRef]) => { | |
+export const activeNetwork = derived( | |
+ [settings, activeNetworkRef], | |
+ ([$settings, $activeNetworkRef]) => { | |
return $activeNetworkRef !== undefined && $settings.orderbook.networks !== undefined | |
? $settings.orderbook.networks[$activeNetworkRef] | |
: undefined; |
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: 1
♻️ Duplicate comments (1)
packages/ui-components/src/lib/types/appStores.ts (1)
15-19
: Property types and naming updated for consistency.The interface correctly:
- Renames
subgraphUrl
tosubgraph
- Updates from string type to
SubgraphCfg
type- Updates
activeOrderbook
to useOrderbookCfg
- Updates
activeAccounts
to useAccountCfg
These changes align with the PR objectives of removing the config source and splitting the Config struct.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (13)
packages/ui-components/src/__tests__/DeploymentSteps.test.ts
(4 hunks)packages/ui-components/src/__tests__/DropdownActiveSubgraphs.test.ts
(2 hunks)packages/ui-components/src/lib/__mocks__/settings.ts
(1 hunks)packages/ui-components/src/lib/components/ListViewOrderbookFilters.svelte
(2 hunks)packages/ui-components/src/lib/components/deployment/DeploymentSteps.svelte
(3 hunks)packages/ui-components/src/lib/components/dropdown/DropdownActiveSubgraphs.svelte
(1 hunks)packages/ui-components/src/lib/components/tables/OrdersListTable.svelte
(1 hunks)packages/ui-components/src/lib/components/tables/VaultsListTable.svelte
(4 hunks)packages/ui-components/src/lib/index.ts
(1 hunks)packages/ui-components/src/lib/types/appStores.ts
(1 hunks)tauri-app/src/routes/orders/[network]-[orderHash]/+page.svelte
(1 hunks)tauri-app/src/routes/orders/[network]-[orderHash]/page.test.ts
(4 hunks)tauri-app/src/routes/orders/add/+page.svelte
(4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
packages/ui-components/src/__tests__/DeploymentSteps.test.ts (1)
packages/ui-components/src/lib/__mocks__/settings.ts (1)
mockConfig
(4-68)
packages/ui-components/src/__tests__/DropdownActiveSubgraphs.test.ts (1)
packages/ui-components/src/lib/__mocks__/settings.ts (1)
mockConfig
(4-68)
tauri-app/src/routes/orders/[network]-[orderHash]/page.test.ts (1)
packages/ui-components/src/lib/__mocks__/stores.ts (1)
mockSettingsStore
(42-46)
⏰ Context from checks skipped due to timeout of 90000ms (16)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-static)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-artifacts)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-static)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-legal)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-artifacts)
- GitHub Check: standard-tests (ubuntu-latest, test-js-bindings)
- GitHub Check: standard-tests (ubuntu-latest, ob-rs-test, true)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-artifacts, true)
- GitHub Check: build-tauri (ubuntu-22.04, true)
- GitHub Check: test
- GitHub Check: Deploy-Preview
- GitHub Check: git-clean
- GitHub Check: test
- GitHub Check: test
🔇 Additional comments (40)
packages/ui-components/src/lib/components/tables/OrdersListTable.svelte (1)
46-52
: Updated configuration access pattern.The code correctly implements the new configuration structure where settings are now nested under the
orderbook
namespace, and subgraph entries use object format with expliciturl
property. This change aligns with the broader refactoring of removing theConfigSource
type.packages/ui-components/src/lib/components/deployment/DeploymentSteps.svelte (3)
6-7
: Updated import type from ConfigSource to Config.The import correctly reflects the new configuration structure introduced in this PR.
45-45
: Updated settings type from Writable to Writable.The prop type is properly updated to use the new Config type.
74-74
: Updated subgraph URL access pattern.The code now correctly accesses the subgraph URL through the nested
orderbook
structure and the expliciturl
property.tauri-app/src/routes/orders/[network]-[orderHash]/+page.svelte (3)
27-28
: Updated orderbooks access pattern.The code now correctly accesses orderbook configuration through the nested
orderbook
structure, aligning with the new Config type implementation.
31-33
: Updated subgraphs access pattern.The code now correctly accesses subgraph configuration through the nested
orderbook
structure and explicitly uses theurl
property.
35-37
: Updated networks access pattern.The code now correctly accesses network configuration through the nested
orderbook
structure.packages/ui-components/src/lib/index.ts (1)
134-134
: Renamed export to match new config structure.The mock export name has been updated from
mockConfigSource
tomockConfig
to reflect the transition from the removedConfigSource
type to the newConfig
type.packages/ui-components/src/__tests__/DeploymentSteps.test.ts (4)
13-13
: Import updated to use new Config structure.The import has been updated from
mockConfigSource
tomockConfig
to align with the PR objective of removing the config source and using the new nested Config structure.
93-93
: Updated settings prop to use the new Config structure.The
settings
prop indefaultProps
now correctly useswritable(mockConfig)
instead of the previouswritable(mockConfigSource)
.
166-166
: Updated config access pattern to use nested structure.The access to the subgraph URL has been correctly updated to use
mockConfig.orderbook.subgraphs.mainnet.url
instead of accessing it directly from the root level of the config object.
469-469
: Updated config access pattern for Flare subgraph.The access to the Flare subgraph URL has been correctly updated to use
mockConfig.orderbook.subgraphs.flare.url
following the new nested Config structure.packages/ui-components/src/__tests__/DropdownActiveSubgraphs.test.ts (4)
5-6
: Updated imports for new Config structure.The imports have been properly updated to use
mockConfig
instead ofmockConfigSource
and import the newConfig
andSubgraphCfg
types from@rainlanguage/orderbook
.
10-27
: Refactored mock settings to use nested Config structure.The mock settings have been correctly restructured to nest subgraphs under the
orderbook
namespace with each subgraph now havingkey
andurl
properties instead of being direct string values.
28-28
: Updated type definition for activeSubgraphsStore.The type of
activeSubgraphsStore
has been properly updated fromWritable<Record<string, string>>
toWritable<Record<string, SubgraphCfg>>
to match the new subgraph configuration type.
71-99
: Updated test assertions to match new Config structure.The test assertions have been correctly updated to expect objects with
key
andurl
properties instead of direct string values, matching the new Config structure.tauri-app/src/routes/orders/[network]-[orderHash]/page.test.ts (4)
4-4
: Updated import to use Config type.The import has been properly updated to use the
Config
type from@rainlanguage/orderbook
instead of the previousConfigSource
type.
60-90
: Refactored mock settings to use nested Config structure.The mock settings object has been correctly restructured to use a nested
orderbook
object containingorderbooks
,subgraphs
, andnetworks
keys. Each entity now includes the appropriate properties likekey
,chainId
(instead ofchain-id
), etc., and the object is properly cast to theConfig
type.
100-100
: Updated empty settings structure.The empty settings object has been correctly updated to use
{ orderbook: {} }
as the starting point, aligning with the new Config structure.
118-130
: Updated partial settings to use nested structure.The partial settings object has been correctly refactored to nest
orderbooks
andnetworks
under theorderbook
namespace, consistent with the new Config structure.packages/ui-components/src/lib/components/ListViewOrderbookFilters.svelte (3)
11-11
: Updated type imports for new Config structure.The import statement has been properly updated to import
AccountCfg
,Config
, andSubgraphCfg
types from@rainlanguage/orderbook
instead of the previousConfigSource
type.
15-16
: Updated prop type definitions for new Config structure.The type annotations for the exported props have been correctly updated:
settings
now usesWritable<Config | undefined>
accounts
now usesReadable<Record<string, AccountCfg>>
activeSubgraphs
now usesWritable<Record<string, SubgraphCfg>>
These changes align with the new typed Config structure where simple string mappings are replaced with richer objects.
Also applies to: 20-20
33-33
: Updated conditional check for nested Config structure.The conditional check for displaying the "No networks added" alert has been correctly updated to check
isEmpty($settings?.orderbook?.networks)
instead ofisEmpty($settings?.networks)
, reflecting the new nested structure.packages/ui-components/src/lib/components/dropdown/DropdownActiveSubgraphs.svelte (3)
4-7
: Type updates correctly align with the new Config structure.The component has been properly updated to use the new
Config
andSubgraphCfg
types from@rainlanguage/orderbook
, aligning with the PR objective of removing the config source.
9-15
: Accessing updated nested structure correctly.The component now properly accesses subgraphs through the new nested path
settings.orderbook.subgraphs
instead of the previous flat structure. This change is consistent with splitting the Config struct intoOrderbookConfig
andDotrainOrderConfig
.
17-23
: Event handler updated to work with the new SubgraphCfg type.The event handler now correctly processes
Record<string, SubgraphCfg>
objects rather than simple strings, matching the more structured configuration approach introduced in this PR.packages/ui-components/src/lib/__mocks__/settings.ts (2)
1-68
: Mock configuration structure correctly updated to match new Config type.The mock has been extensively restructured to match the new nested configuration approach with separate
orderbook
namespace. This properly reflects the splitting of theConfig
struct intoOrderbookConfig
andDotrainOrderConfig
as mentioned in the PR objectives.
70-76
: Store types updated to reflect new Config structure.The writable store and helper methods have been properly updated to use the new
Config
type, ensuring type safety throughout the application.tauri-app/src/routes/orders/add/+page.svelte (4)
28-28
: Import updated to match new configuration API.The import has been simplified to only include the new
mergeDotrainConfigWithSettings
function, removing the now obsolete conversion functions.
48-48
: Access pattern updated for new nested configuration structure.Deployments are now correctly accessed through the nested
dotrainOrder
property, reflecting the new configuration structure where data is split intoDotrainOrderConfig
andOrderbookConfig
.
78-81
: Updated reactive statement to use new config structure.The reactive statement for generating Rainlang strings has been properly updated to access scenarios through the nested
dotrainOrder
property.
125-128
: Config merging simplified with direct approach.The function now directly uses
mergeDotrainConfigWithSettings
which returns aConfig
instance, removing the intermediate conversion steps that were previously needed withConfigSource
.packages/ui-components/src/lib/types/appStores.ts (2)
1-3
: Import types from the new Config structure.The import statement has been correctly updated to use the new types from the reorganized configuration model.
5-8
: Core store interface properties updated to use new Config types.The main configuration stores have been properly updated to use
Config
,SubgraphCfg
, andAccountCfg
types, ensuring type safety throughout the application.packages/ui-components/src/lib/components/tables/VaultsListTable.svelte (6)
13-18
: Import statements updated for new configuration typesThe import statements have been correctly updated to reference the new configuration types (
AccountCfg
,Config
,OrderbookCfg
,SubgraphCfg
) which replace the previousConfigSource
andOrderbookConfigSource
types. This change aligns with the PR objective of removing the config source and splitting the Config struct.
30-31
: Props updated to use new typed configuration objectsThe props have been properly updated to use the new configuration types. Notably:
activeOrderbook
now usesOrderbookCfg
instead of the previous typesubgraphUrl
has been renamed tosubgraph
with typeSubgraphCfg
These changes are consistent with the move from string-based configuration to structured, typed configuration objects.
35-37
: Collection types updated for configuration changesThe collection type props have been updated to use the new configuration structure:
activeSubgraphs
now uses a record ofSubgraphCfg
objectssettings
now uses the newConfig
typeThis improves type safety and aligns with the new configuration model where configs are strongly typed objects rather than string mappings.
41-43
: ActiveAccounts type updated to use AccountCfgThe
activeAccounts
property has been correctly updated to use the newAccountCfg
type, maintaining consistency with the rest of the configuration changes.
54-61
: Updated multiSubgraphArgs to use new nested configuration structureThe reactive computation for
multiSubgraphArgs
has been properly updated to reflect the new nested configuration structure where subgraphs are now accessed via$settings?.orderbook?.subgraphs
instead of directly from$settings?.subgraphs
. The code also correctly extracts the URL property from each subgraph configuration object.
94-95
: Updated query enablement conditionThe query enablement condition has been updated from checking
$subgraphUrl
to checking$subgraph
, which is appropriate given the prop rename and type change. This ensures the query only runs when a valid subgraph configuration is available.
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: 1
🔭 Outside diff range comments (2)
packages/ui-components/src/__tests__/ListViewOrderbookFilters.test.ts (2)
56-74
:⚠️ Potential issueFix missing
orderbook
wrapper inbeforeEach
reset
ThebeforeEach
block resetsmockSettings
with an object missing the top-levelorderbook
property, which the component relies on at runtime (settings.orderbook.networks
). This will cause undefined lookups.Apply this diff to wrap networks and subgraphs under
orderbook
:beforeEach(() => { - mockSettings.set({ - networks: { - ethereum: { - key: 'ethereum', - rpc: 'https://rpc.ankr.com/eth', - chainId: 1, - networkId: 1, - currency: 'ETH' - } - }, - subgraphs: { - mainnet: { - key: 'mainnet', - url: 'mainnet-url' - } - } - } as unknown as Config); + mockSettings.set({ + orderbook: { + networks: { + ethereum: { + key: 'ethereum', + rpc: 'https://rpc.ankr.com/eth', + chainId: 1, + networkId: 1, + currency: 'ETH' + } + }, + subgraphs: { + mainnet: { + key: 'mainnet', + url: 'mainnet-url' + } + } + } + } as unknown as Config); });
76-82
:⚠️ Potential issueWrap empty networks/subgraphs under
orderbook
in test
In the “shows no networks alert” test, themockSettings.set
also omits theorderbook
wrapper. Since the component readssettings.orderbook.networks
, this will break the alert logic.Use this diff:
test('shows no networks alert when networks are empty', () => { - mockSettings.set({ networks: {}, subgraphs: {} } as unknown as Config); + mockSettings.set({ + orderbook: { + networks: {}, + subgraphs: {} + } + } as unknown as Config); render(ListViewOrderbookFilters, defaultProps);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
packages/ui-components/src/__tests__/ListViewOrderbookFilters.test.ts
(3 hunks)
🔇 Additional comments (1)
packages/ui-components/src/__tests__/ListViewOrderbookFilters.test.ts (1)
5-5
: Import updated to newConfig
type
The test now importsConfig
instead of the legacyConfigSource
, which aligns with the PR objective to remove the config source. Ensure that@rainlanguage/orderbook
exportsConfig
from the correct module.
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: 5
♻️ Duplicate comments (4)
tauri-app/src/lib/services/pickConfig.ts (1)
18-21
: 🧹 Nitpick (assertive)Add explicit return type annotation to pickScenarios function.
Similar to pickDeployments, this function would benefit from an explicit return type annotation.
export function pickScenarios( mergedConfig: Config | undefined, activeNetworkRef: string | undefined, -) { +): Record<string, any> {The exact return type should match what's in the
scenarios
structure from the Config type.packages/ui-components/src/__tests__/ListViewOrderbookFilters.test.ts (1)
23-41
: Mock still usesas unknown as Config
– consider safer typingThe double-cast keeps popping up and could easily mask structural drift between the real
Config
type and the fixture.
APartial<Config>
(or a purpose-built factory) narrows that risk while preserving flexibility.I flagged the very same pattern in an earlier round and understand you decided to leave it as-is, so marking this as a duplicate for traceability only.
Also applies to: 56-76
packages/webapp/src/routes/+layout.ts (2)
13-15
: Avoid hard-coding the remote settings URLEmbedding a SHA-pinned GitHub raw URL forces a redeploy every time
settings.yaml
changes and makes local/offline dev painful.
Read the endpoint from an env variable (e.g.PUBLIC_SETTINGS_URL
) or server-side config instead.```diff
-const response = await fetch(
- 'https://raw.githubusercontent.com/findolor/sample-dotrains/6865d8c76dc4182c5f6f41c20299cb017a6298fe/settings.yaml'
-);
+const response = await fetch(import.meta.env.PUBLIC_SETTINGS_URL);
```
30-37
: 🧹 Nitpick (assertive)Null-safe access in
activeNetworkOrderbooks
orderbook.network
could beundefined
in malformed configs; accessing.key
directly will throw. A tiny guard keeps the UI alive:- (orderbook) => orderbook.network.key === $activeNetworkRef + (orderbook) => orderbook.network?.key === $activeNetworkRef(No functional change for valid data.)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
packages/ui-components/src/__tests__/ListViewOrderbookFilters.test.ts
(3 hunks)packages/webapp/src/routes/+layout.ts
(16 hunks)tauri-app/src/lib/services/pickConfig.ts
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tauri-app/src/lib/services/pickConfig.ts (1)
tauri-app/src/lib/stores/settings.ts (1)
activeNetworkRef
(65-65)
⏰ Context from checks skipped due to timeout of 90000ms (16)
- 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-artifacts)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-artifacts, true)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-static)
- GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-rs-static)
- GitHub Check: standard-tests (ubuntu-latest, test-js-bindings)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-legal)
- GitHub Check: git-clean
- GitHub Check: Deploy-Preview
- GitHub Check: test
- GitHub Check: test
- GitHub Check: build-tauri (ubuntu-22.04, true)
- GitHub Check: test
🔇 Additional comments (1)
packages/webapp/src/routes/+layout.ts (1)
192-196
:❌ Incorrect review comment
parseYaml
is not mocked – tests will explode at runtime
vi.mocked(parseYaml).mockReturnValue(...)
works only ifparseYaml
is already a Jest/Vitest mock.
Unlesspackages/webapp/test-setup.ts
callsvi.mock('@rainlanguage/orderbook')
,
.mockReturnValue
isundefined
⇒ TypeError: mockReturnValue is not a function.Quick fix:
vi.mock('@rainlanguage/orderbook', () => ({ parseYaml: vi.fn(), })); import { parseYaml } from '@rainlanguage/orderbook';(or
vi.spyOn
if you want to preserve the real implementation elsewhere).Also applies to: 231-234, 248-252, 268-272, 298-302, 342-344, 380-383
🏁 Script executed:
#!/bin/bash # Locate test-setup.ts setup_file=$(fd test-setup.ts | head -n1) echo "Test setup file: $setup_file" echo "-----------" sed -n '1,200p' "$setup_file" echo echo "Searching for mocks of '@rainlanguage/orderbook' across the repo" rg -n "rainlanguage/orderbook" .Length of output: 22905
🏁 Script executed:
#!/bin/bash # Display the first 200 lines of the webapp test-setup to check for parseYaml mock setup_file_webapp=$(fd --ignore-case test-setup.ts | grep packages/webapp/test-setup.ts | head -n1) echo "Webapp Test setup file: $setup_file_webapp" echo "-----------" sed -n '1,200p' "$setup_file_webapp"Length of output: 801
parseYaml is already mocked in webapp’s test-setup – no change needed
The
packages/webapp/test-setup.ts
file contains:vi.mock('@rainlanguage/orderbook', () => { const DotrainOrderGui = vi.fn(); // …other method mocks… return { DotrainOrderGui, parseYaml: vi.fn() }; });Since
parseYaml
is defined as avi.fn()
, yourvi.mocked(parseYaml).mockReturnValue(...)
calls are valid and will not throw.No updates required here.
Likely an incorrect or invalid review comment.
return mergedConfig?.dotrainOrder.scenarios | ||
? pickBy( |
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.
Fix inconsistent null checking pattern for dotrainOrder property.
Line 8 properly uses optional chaining mergedConfig?.dotrainOrder?.deployments
but line 22 has an inconsistent pattern where the second optional chaining is missing: mergedConfig?.dotrainOrder.scenarios
.
This could lead to runtime errors if dotrainOrder
is undefined.
- return mergedConfig?.dotrainOrder.scenarios
+ return mergedConfig?.dotrainOrder?.scenarios
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
return mergedConfig?.dotrainOrder.scenarios | |
? pickBy( | |
return mergedConfig?.dotrainOrder?.scenarios | |
? pickBy( |
export function pickDeployments( | ||
mergedConfigSource: ConfigSource | undefined, | ||
mergedConfig: Config | undefined, | ||
activeNetworkRef: string | undefined, | ||
) { |
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 (assertive)
Add explicit return type annotations to improve type safety and code documentation.
Both functions are missing return type annotations, which would make the code more self-documenting and help catch type errors during development.
export function pickDeployments(
mergedConfig: Config | undefined,
activeNetworkRef: string | undefined,
-) {
+): Record<string, any> {
The exact return type should match what's in the deployments
structure from the Config type.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export function pickDeployments( | |
mergedConfigSource: ConfigSource | undefined, | |
mergedConfig: Config | undefined, | |
activeNetworkRef: string | undefined, | |
) { | |
export function pickDeployments( | |
mergedConfig: Config | undefined, | |
activeNetworkRef: string | undefined, | |
): Record<string, any> { |
return mergedConfig?.dotrainOrder?.deployments | ||
? pickBy( | ||
mergedConfigSource.deployments, | ||
(d) => mergedConfig?.scenarios?.[d.scenario]?.deployer?.network?.key === activeNetworkRef, | ||
mergedConfig.dotrainOrder.deployments, | ||
(d) => | ||
mergedConfig.dotrainOrder.scenarios?.[d.scenario.key]?.deployer?.network?.key === | ||
activeNetworkRef, | ||
) | ||
: {}; |
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 (assertive)
Consider adding a TypeScript null assertion after optional chaining.
The function correctly checks for the existence of deployments
but when accessing it in the pickBy
function, TypeScript might not properly infer that it can't be undefined.
return mergedConfig?.dotrainOrder?.deployments
? pickBy(
- mergedConfig.dotrainOrder.deployments,
+ mergedConfig.dotrainOrder.deployments!,
(d) =>
mergedConfig.dotrainOrder.scenarios?.[d.scenario.key]?.deployer?.network?.key ===
activeNetworkRef,
)
: {};
This makes it explicit to TypeScript that we've already checked for undefined.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
return mergedConfig?.dotrainOrder?.deployments | |
? pickBy( | |
mergedConfigSource.deployments, | |
(d) => mergedConfig?.scenarios?.[d.scenario]?.deployer?.network?.key === activeNetworkRef, | |
mergedConfig.dotrainOrder.deployments, | |
(d) => | |
mergedConfig.dotrainOrder.scenarios?.[d.scenario.key]?.deployer?.network?.key === | |
activeNetworkRef, | |
) | |
: {}; | |
return mergedConfig?.dotrainOrder?.deployments | |
? pickBy( | |
mergedConfig.dotrainOrder.deployments!, | |
(d) => | |
mergedConfig.dotrainOrder.scenarios?.[d.scenario.key]?.deployer?.network?.key === | |
activeNetworkRef, | |
) | |
: {}; |
return mergedConfig?.dotrainOrder.scenarios | ||
? pickBy( | ||
mergedConfig.dotrainOrder.scenarios, | ||
(d) => d?.deployer?.network?.key === activeNetworkRef, | ||
) | ||
: {}; |
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 (assertive)
Similar TypeScript null assertion needed in pickScenarios.
After fixing the optional chaining, consider adding a null assertion for clarity when accessing the property in the pickBy
function.
- return mergedConfig?.dotrainOrder.scenarios
+ return mergedConfig?.dotrainOrder?.scenarios
? pickBy(
- mergedConfig.dotrainOrder.scenarios,
+ mergedConfig.dotrainOrder.scenarios!,
(d) => d?.deployer?.network?.key === activeNetworkRef,
)
: {};
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
return mergedConfig?.dotrainOrder.scenarios | |
? pickBy( | |
mergedConfig.dotrainOrder.scenarios, | |
(d) => d?.deployer?.network?.key === activeNetworkRef, | |
) | |
: {}; | |
return mergedConfig?.dotrainOrder?.scenarios | |
? pickBy( | |
mergedConfig.dotrainOrder.scenarios!, | |
(d) => d?.deployer?.network?.key === activeNetworkRef, | |
) | |
: {}; |
const settings = writable<OrderbookConfig>(parseYaml([settingsYaml]).orderbook); | ||
const activeNetworkRef = writable<string>(''); |
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.
🛠️ Refactor suggestion
settings
store type violates AppStoresInterface
– pick one schema
AppStoresInterface.settings
is still declared as Writable<Config | undefined>
(full root object), but here we instantiate
writable<OrderbookConfig>
. Because Writable
is invariant this compiles only due to the any
escape hatches below and can break
call-sites that expect dotrainOrder
, accounts
, etc.
Two options:
-
Keep the root config in the store and adapt downstream selectors
diff -const settings = writable<OrderbookConfig>(parseYaml([settingsYaml]).orderbook); +const fullConfig = parseYaml([settingsYaml]); +const settings = writable<Config>(fullConfig);
…then change every$settings.xxx
to$settings.orderbook.xxx
. -
Or change
AppStoresInterface
sosettings
really is theOrderbookConfig
.
Whichever route you choose, align the types to prevent silent breakage.
Also applies to: 59-65
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 needs addressing?
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.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
|
||
export interface LayoutData { | ||
stores: AppStoresInterface; | ||
} | ||
|
||
export const load = async ({ fetch }) => { | ||
const response = await fetch( | ||
'https://raw.githubusercontent.com/rainlanguage/rain.strategies/refs/heads/main/settings.json' | ||
'https://raw.githubusercontent.com/findolor/sample-dotrains/6865d8c76dc4182c5f6f41c20299cb017a6298fe/settings.yaml' |
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.
need to update rain.strategies instead
Motivation
See issue: #1364
Solution
Checks
By submitting this for review, I'm confirming I've done the following:
[ ] included screenshots (if this involves a front-end change)fix #1364
Summary by CodeRabbit
New Features
Refactor
ConfigSource
and related intermediate types with a newConfig
structure for more consistent and modular configuration management.chainId
instead ofchain-id
) and updated all usages across the application.Bug Fixes
Chores
subgraphUrl
tosubgraph
).