Replace raindex version with spec version#1897
Conversation
WalkthroughThis change migrates all YAML versioning from a "raindex-version" field to a new "spec-version" field, set to "1". It introduces a hardcoded spec version in the code, enforces version validation when parsing YAML, and updates error handling, validation logic, tests, and UI references to use "spec-version" consistently across Rust, TypeScript, and Svelte components. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI (Svelte/TS)
participant Tauri Backend (Rust)
participant YAML Parser
participant SpecVersion Validator
User->>UI (Svelte/TS): Submit YAML config (.rain/.yml)
UI (Svelte/TS)->>Tauri Backend (Rust): validate_spec_version(dotrain, settings)
Tauri Backend (Rust)->>YAML Parser: Parse YAML
YAML Parser->>SpecVersion Validator: Extract spec-version
SpecVersion Validator->>YAML Parser: Check if spec-version == hardcoded version
YAML Parser->>Tauri Backend (Rust): Return success or SpecVersionMismatch error
Tauri Backend (Rust)->>UI (Svelte/TS): Return result/error
UI (Svelte/TS)->>User: Show error if SpecVersion mismatch
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes detected. Possibly related PRs
Suggested labels
Suggested reviewers
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (31)
crates/cli/src/commands/chart/mod.rs(1 hunks)crates/cli/src/commands/order/calldata.rs(5 hunks)crates/cli/src/commands/order/compose.rs(1 hunks)crates/cli/src/commands/order/listorderfrontmatterkeys.rs(1 hunks)crates/cli/src/commands/order/orderbook_address.rs(1 hunks)crates/cli/src/commands/words/mod.rs(5 hunks)crates/common/src/add_order.rs(2 hunks)crates/common/src/dotrain_order/mod.rs(20 hunks)crates/common/src/fuzz/impls.rs(12 hunks)crates/common/src/replays.rs(1 hunks)crates/integration_tests/src/lib.rs(2 hunks)crates/js_api/src/gui/mod.rs(10 hunks)crates/js_api/src/gui/state_management.rs(1 hunks)crates/quote/src/order_quotes.rs(1 hunks)crates/quote/src/quote_debug.rs(3 hunks)crates/settings/src/lib.rs(1 hunks)crates/settings/src/raindex_version.rs(0 hunks)crates/settings/src/spec_version.rs(1 hunks)crates/settings/src/yaml/orderbook.rs(4 hunks)packages/orderbook/test/common/test.test.ts(1 hunks)packages/orderbook/test/js_api/gui.test.ts(5 hunks)tauri-app/src-tauri/src/commands/authoring_meta.rs(3 hunks)tauri-app/src-tauri/src/commands/charts.rs(1 hunks)tauri-app/src-tauri/src/commands/order.rs(11 hunks)tauri-app/src-tauri/src/commands/order_quote.rs(1 hunks)tauri-app/src-tauri/src/commands/trade_debug.rs(1 hunks)tauri-app/src-tauri/src/main.rs(2 hunks)tauri-app/src/lib/components/SpecVersionValidator.svelte(1 hunks)tauri-app/src/lib/components/SpecVersionValidator.test.ts(1 hunks)tauri-app/src/lib/services/order.ts(1 hunks)tauri-app/src/routes/orders/add/+page.svelte(5 hunks)
💤 Files with no reviewable changes (1)
- crates/settings/src/raindex_version.rs
🧰 Additional context used
🧬 Code Graph Analysis (4)
tauri-app/src-tauri/src/main.rs (1)
tauri-app/src-tauri/src/commands/order.rs (1)
validate_spec_version(152-156)
crates/common/src/fuzz/impls.rs (2)
crates/settings/src/yaml/dotrain.rs (1)
new(26-50)crates/settings/src/spec_version.rs (2)
is_current(15-17)current(11-13)
crates/cli/src/commands/order/calldata.rs (1)
crates/subgraph/src/orderbook_client/mod.rs (1)
url(77-79)
crates/settings/src/yaml/orderbook.rs (1)
crates/settings/src/spec_version.rs (1)
parse_from_yaml(21-29)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: test
🔇 Additional comments (51)
crates/js_api/src/gui/state_management.rs (1)
295-295: Update serialized state test vector
The base64-encodedSERIALIZED_STATEconstant has been regenerated to reflect the addition ofspec-version: 1in the YAML structure.packages/orderbook/test/common/test.test.ts (1)
7-7: Addspec-versionto test YAML input
Insertedspec-version: 1at the top of thedotrainstring to satisfy the new version validation logic.crates/common/src/replays.rs (1)
87-87: Includespec-versionin replay test YAML
Updated thedotrainstring intest_trade_replayer_okto begin withspec-version: 1, aligning it with the new spec validation scheme.crates/quote/src/order_quotes.rs (1)
214-214: Introducespec-versionin quote test setup
Prefixed the YAML increate_dotrain_configwithspec-version: 1to conform to the updated parsing requirements.tauri-app/src-tauri/src/commands/charts.rs (1)
44-44: Addspec-versionto chart command test helper
Insertedspec-version: 1inget_dotrain_prefixto ensure the test YAML matches the new spec version check.packages/orderbook/test/js_api/gui.test.ts (2)
139-139: Addspec-versionto YAML test fixturesThe YAML configuration strings (
dotrain,dotrainWithoutVaultIds,dotrainWithoutTokens, anddotrainForRemotes) now include a top-levelspec-version: 1field, aligning these tests with the updated versioning scheme. This ensures the parser’s version validation logic is exercised correctly across all test scenarios.Also applies to: 216-216, 286-286, 341-341
956-956: Update serialized state to reflect spec-version changeThe
serializedStatebase64-encoded string has been updated, likely to account for the addedspec-versionin the serialized YAML. Please verify that this new value matches the expected output of your serialization logic (includingspec-version) by decoding or running the corresponding round-trip tests.crates/integration_tests/src/lib.rs (1)
25-25: Introducespec-version: 1in integration testsBoth
test_post_task_setandtest_post_task_revertnow prependspec-version: 1to their YAML configurations, keeping the integration tests consistent with the new specification versioning.Also applies to: 139-139
tauri-app/src-tauri/src/commands/authoring_meta.rs (3)
46-46: Ensurespec-versionis present in happy-path test YAML
Added thespec-version: 1line at the top of the YAML input fortest_get_authoring_meta_v2_for_scenarios_happyto satisfy the new version validation.
119-119: Ensurespec-versionis present in error-path test YAML
Added thespec-version: 1line at the top of the YAML input fortest_get_authoring_meta_v2_for_scenarios_errorto satisfy the new version validation.
241-241: Ensurespec-versionis present in pragma-error test YAML
Added thespec-version: 1line at the top of the YAML input fortest_get_authoring_meta_v2_for_scenarios_pragma_errorto satisfy the new version validation.tauri-app/src-tauri/src/commands/order_quote.rs (1)
67-67: Ensurespec-versionis present in order-quote test YAML
Prependedspec-version: 1to the YAML input intest_debug_order_quoteto align with the updated spec-version enforcement in the parser.crates/common/src/add_order.rs (2)
836-836: Addspec-versionto simulate_execute happy-path input
Insertedspec-version: 1at the top of the formatteddotrainstring intest_simulate_execute_okso it passes the new version check before parsing.
929-929: Addspec-versionto simulate_execute error-path input
Insertedspec-version: 1at the top of the formatteddotrainstring intest_simulate_execute_errto satisfy the new version validation step.crates/js_api/src/gui/mod.rs (3)
473-473: Includespec-versionin main GUI YAML constant
Addedspec-version: 1at the top of theYAMLconstant to meet the updated front-matter requirements in GUI configuration parsing.
952-952: Addspec-versionto inline YAML intest_get_strategy_details
Prependedspec-version: 1to each inline YAML document in the error cases fortest_get_strategy_details, ensuring they conform to the new spec-version check.Also applies to: 980-980, 1008-1008
1066-1066: Addspec-versionto inline YAML intest_get_deployment_details
Prependedspec-version: 1to each inline YAML document in the error cases fortest_get_deployment_details, aligning them with the updated validation logic.Also applies to: 1082-1082, 1110-1110, 1173-1173
crates/quote/src/quote_debug.rs (1)
100-100: LGTM! Consistent test data updates for spec version migration.The addition of
spec-version: 1to all three test YAML configurations correctly aligns with the new versioning scheme. The changes are consistent across all test functions and support the migration from raindex version to spec version.Also applies to: 226-226, 355-355
tauri-app/src/lib/components/SpecVersionValidator.svelte (1)
8-8: LGTM! UI component updated to match new error format.The change from checking for "Raindex version" to "Spec version" correctly aligns the frontend error detection with the backend validation changes. This ensures the error alert will properly display when spec version validation fails.
tauri-app/src-tauri/src/commands/trade_debug.rs (1)
62-62: LGTM! Test data updated for spec version migration.The addition of
spec-version: 1to the test YAML configuration correctly aligns with the new versioning scheme and ensures the test will pass with the updated validation logic.crates/cli/src/commands/order/listorderfrontmatterkeys.rs (1)
127-127: LGTM! Test helper updated for spec version migration.The addition of
spec-version: 1to theget_test_dotrainhelper function ensures all tests using this helper will have consistent YAML data that aligns with the new spec version validation requirements. This centralized approach to updating test data is efficient and maintainable.crates/cli/src/commands/order/orderbook_address.rs (1)
119-120: LGTM! Correct addition of spec version to test data.The addition of
spec-version: 1at the beginning of the test YAML is appropriate and aligns with the broader migration from raindex versioning. This change ensures all test cases using this helper function will include the required spec version field.crates/cli/src/commands/chart/mod.rs (1)
75-75: LGTM! Consistent spec version addition.The addition of
spec-version: 1to the settings YAML is consistent with the migration strategy and ensures proper version validation in chart-related tests.crates/cli/src/commands/order/compose.rs (1)
114-114: LGTM! Proper spec version integration.The addition of
spec-version: 1to the test YAML maintains consistency with the migration from raindex versioning and ensures the test data meets the new validation requirements.tauri-app/src-tauri/src/main.rs (1)
20-20: LGTM: Function rename is consistent with the spec version migration.The import and invoke handler updates correctly reflect the migration from "raindex-version" to "spec-version" terminology. The function signature is preserved as confirmed by the relevant code snippet from
tauri-app/src-tauri/src/commands/order.rs.Also applies to: 78-78
crates/cli/src/commands/order/calldata.rs (1)
184-184: LGTM: Test data consistently updated for spec version migration.All test YAML frontmatter has been correctly updated to use
spec-version: 1instead of the previousraindex-version. The changes are consistent across all test cases and align with the new specification versioning scheme.Also applies to: 250-250, 359-359, 393-393, 451-451
crates/cli/src/commands/words/mod.rs (1)
252-252: LGTM: Test YAML frontmatter consistently updated.All test cases have been properly updated to include
spec-version: 1in their YAML frontmatter, ensuring compatibility with the new specification versioning scheme. The updates are consistent and follow the established migration pattern.Also applies to: 306-306, 364-364, 425-425, 501-501
tauri-app/src/lib/services/order.ts (1)
69-70: LGTM: Function rename aligns with backend changes.The function name and invoke command have been correctly updated to reflect the migration from "raindex-version" to "spec-version". The function signature is preserved, and the invoke command matches the corresponding backend function updated in
tauri-app/src-tauri/src/main.rs.tauri-app/src/lib/components/SpecVersionValidator.test.ts (1)
1-31: LGTM! Consistent test file migration from RaindexVersion to SpecVersion.The test file has been properly updated with consistent renaming from "Raindex version" to "Spec version" across all test cases. The core test logic remains sound and validates the expected behavior for the new SpecVersionValidator component.
crates/settings/src/yaml/orderbook.rs (3)
3-4: LGTM! Proper import update for spec version functionality.The import has been correctly updated from
RaindexVersiontoSpecVersionto align with the new versioning scheme.
192-195: LGTM! Method correctly updated to use SpecVersion.The method has been properly renamed from
get_raindex_versiontoget_spec_versionand now uses the newSpecVersion::parse_from_yamlmethod. The change from optional to non-optional return type is appropriate since spec-version is now a required field.
426-426: LGTM! Test assertion updated correctly.The test assertion has been properly updated to call
get_spec_version()and expect the value"1"instead of"1.0.0", which aligns with the new spec version format.tauri-app/src/routes/orders/add/+page.svelte (5)
22-23: LGTM! Import updated correctly for spec version validation.The import has been properly changed from
validateRaindexVersiontovalidateSpecVersionto use the new validation function.
38-38: LGTM! Component import updated correctly.The import has been properly changed from
RaindexVersionValidatortoSpecVersionValidatorcomponent.
207-212: LGTM! Debounced validation setup updated correctly.The debounced validation has been properly updated to use
validateSpecVersionfunction and the error state has been renamed fromraindexVersionErrortospecVersionError. The reactive statement correctly calls the new debounced function.
221-221: LGTM! Component usage updated correctly.The component has been properly changed to use
SpecVersionValidatorwith the correctspecVersionErrorprop.
257-257: LGTM! Button disabled condition updated correctly.The button's disabled condition has been properly updated to check for
specVersionErrorinstead of the previousraindexVersionError.tauri-app/src-tauri/src/commands/order.rs (3)
152-156: LGTM! Function correctly renamed and updated.The function has been properly renamed from
validate_raindex_versiontovalidate_spec_versionand the internal method call has been updated accordingly. The function signature and logic remain consistent.
384-384: LGTM! Test YAML data consistently updated.All test YAML data has been properly updated to include
spec-version: 1instead of the previous raindex-version fields. This ensures tests validate the new specification versioning approach.Also applies to: 567-567, 615-615, 664-664, 711-712
710-729: LGTM! Comprehensive test coverage for spec version validation.The tests have been thoroughly updated to cover both success and error scenarios:
- Success case: Tests that valid
spec-version: 1passes validation- Missing field error: Tests that missing
spec-versionfield returns appropriateFieldErrorKind::Missingerror- Version mismatch error: Tests that invalid version (
spec-version: 2) returnsSpecVersionMismatcherror with expected "1" and actual "2"The error matching has been correctly updated to use the new error types and field names.
Also applies to: 732-783
crates/common/src/fuzz/impls.rs (4)
24-25: LGTM: Proper imports for spec version migrationThe imports correctly bring in the new
SpecVersionmodule andOrderbookYamlto support the migration from raindex-version to spec-version validation.
96-97: LGTM: Well-defined error variant for spec version mismatchThe new error variant
SpecVersionMismatch(String, String)properly captures expected and actual version strings for clear error reporting.
124-131: LGTM: Robust spec version validation logicThe validation implementation correctly:
- Parses the YAML to extract the spec version
- Validates against the current spec version using
SpecVersion::is_current()- Returns descriptive errors on mismatch
This follows the same pattern used in other modules and ensures consistency across the codebase.
688-756: LGTM: Comprehensive test coverage for spec version validationThe new tests properly cover both error scenarios:
- Missing
spec-versionfield returns appropriateYamlError::FieldwithMissingkind- Invalid
spec-versionvalue returnsSpecVersionMismatcherror with correct expected/actual valuesBoth tests use proper async patterns and meaningful assertions.
crates/settings/src/spec_version.rs (2)
1-34: LGTM: Clean and well-structured SpecVersion implementationThe implementation provides:
- Clear constant for the current spec version
- Simple public API with
current()andis_current()methods- Proper trait implementation for YAML parsing
- Appropriate error handling for unsupported operations
The code follows Rust best practices and maintains consistency with other modules in the codebase.
36-76: LGTM: Comprehensive test coverageThe tests properly verify:
- Version comparison logic (
is_current)- Current version retrieval
- Error handling for missing spec-version in YAML
- Proper failure for unsupported
parse_from_yaml_optionalAll test cases use appropriate assertions and cover the expected functionality.
crates/common/src/dotrain_order/mod.rs (5)
13-13: LGTM: Import updated for spec version migrationThe import correctly changes from
raindex_versiontospec_versionto support the new versioning scheme.
68-72: LGTM: Error variants properly renamed and updatedThe error variants are consistently renamed:
RaindexVersionMismatch→SpecVersionMismatchMissingRaindexVersion→MissingSpecVersionThe error messages are also appropriately updated to reference "spec version" terminology.
243-249: LGTM: Spec version validation in initializationThe validation logic correctly:
- Extracts spec version from
OrderbookYaml- Uses
SpecVersion::is_current()for validation- Returns descriptive error on mismatch
This ensures spec version validation occurs early in the initialization process.
588-600: LGTM: Method renamed and logic updated consistentlyThe method is properly renamed from
validate_raindex_versiontovalidate_spec_versionand the validation logic is updated to use the newSpecVersionAPI. The error handling remains robust.
1305-1391: LGTM: Tests updated for spec version validationThe tests are properly updated:
- Test names reflect the new spec version terminology
- YAML inputs include
spec-version: 1- Assertions check for the new error variants
- Both happy and unhappy paths are covered
The test coverage ensures the spec version validation works correctly.
| pub mod remote_tokens; | ||
| pub mod scenario; | ||
| pub mod sentry; | ||
| pub mod spec_version; |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
LGTM! Core module addition for spec version support.
The addition of the spec_version module is essential for supporting the new versioning scheme. This foundational change enables the validation and parsing logic for spec versions across the codebase.
Please verify that the migration from raindex_version to spec_version is complete and no references to the old module remain:
🏁 Script executed:
#!/bin/bash
# Description: Verify complete migration from raindex_version to spec_version
# Search for any remaining references to raindex_version module
echo "Searching for raindex_version references:"
rg -i "raindex_version" --type rust
# Search for any remaining raindex-version YAML keys
echo "Searching for raindex-version YAML keys:"
rg "raindex-version"
# Verify spec_version module exists
echo "Verifying spec_version module exists:"
fd "spec_version.rs" crates/settings/src/Length of output: 5302
Incomplete Migration from raindex_version to spec_version
The addition of the new spec_version module is correct, but there are still numerous remaining references to the old raindex_version API, both in code and in frontmatter/YAML keys. These need to be updated to spec_version (and spec-version) to complete the migration.
Please update or remove all instances of raindex_version/raindex-version, including tests and documentation, for example in:
- crates/settings/src
• merge.rs, config_source.rs, config.rs, scenario.rs - tauri-app/src-tauri/src/commands
• config.rs, dotrain_add_order_lsp.rs - crates/common/src
• add_order.rs, frontmatter.rs, test_helpers.rs - crates/js_api/src/yaml/mod.rs
- crates/cli/src/commands/order/add.rs
Make sure to:
- Rename struct fields and function parameters from
raindex_versiontospec_version. - Update all
raindex-version:YAML/frontmatter keys tospec-version:. - Adjust assertions and tests to reference the new API.
Once these changes are applied, rerun the grep checks to confirm no lingering references.
🤖 Prompt for AI Agents
In crates/settings/src/lib.rs at line 20, you added the spec_version module
correctly, but the migration from raindex_version to spec_version is incomplete.
You need to search through the entire codebase, including crates/settings/src
(merge.rs, config_source.rs, config.rs, scenario.rs),
tauri-app/src-tauri/src/commands (config.rs, dotrain_add_order_lsp.rs),
crates/common/src (add_order.rs, frontmatter.rs, test_helpers.rs),
crates/js_api/src/yaml/mod.rs, and crates/cli/src/commands/order/add.rs, and
update all references from raindex_version to spec_version. This includes
renaming struct fields, function parameters, YAML/frontmatter keys from
raindex-version to spec-version, and adjusting tests and assertions accordingly.
After making these changes, rerun your grep checks to ensure no references to
raindex_version remain.
There was a problem hiding this comment.
Looks like this has been resolved since
There was a problem hiding this comment.
🧩 Analysis chain
Let me verify if the migration from raindex_version to spec_version has indeed been completed:
🏁 Script executed:
#!/bin/bash
# Verify if the migration from raindex_version to spec_version is complete
echo "=== Searching for any remaining raindex_version references in Rust code ==="
rg -i "raindex_version" --type rust
echo "=== Searching for any remaining raindex-version YAML/frontmatter keys ==="
rg "raindex-version"
echo "=== Checking if raindex_version.rs file still exists ==="
fd "raindex_version.rs"
echo "=== Verifying spec_version.rs exists ==="
fd "spec_version.rs" crates/settings/src/
echo "=== Search complete ==="
Length of output: 747
@0xgleb You're absolutely right! ✅
The verification confirms that the migration from raindex_version to spec_version has been completed successfully:
- ✅ No remaining
raindex_versionreferences in Rust code - ✅ No remaining
raindex-versionYAML/frontmatter keys - ✅ The old
raindex_version.rsfile has been removed - ✅ The new
spec_version.rsfile is properly in place
The comprehensive migration across the entire codebase has been executed perfectly. Thank you for the update!
🧬 Code Graph Analysis Results
Relevant snippets from tauri-app/src/lib/stores/settings.ts (line 100 and 124-126):
export const accounts = derived(settings, ($settings) => $settings?.accounts ?? {});export const subgraph = derived(settings, ($settings) =>
$settings?.subgraphs !== undefined ? Object.entries($settings.subgraphs) : [],
);Relevant snippet from tauri-app/src/__tests__/pickConfig.test.ts (lines 11-182):
This snippet defines a comprehensive Config object used in tests, including nested structures for networks, subgraphs, metaboards, orderbooks, deployers, tokens, orders, scenarios, charts, deployments, and accounts. It provides example data for each configuration category, useful for understanding the shape and expected contents of settings related to the crates/settings/src/lib.rs modules.
export const config: Config = {
networks: {
network1: {
key: 'network1',
rpc: 'rpc-url',
chainId: 14,
},
network2: {
key: 'network2',
rpc: 'rpc-url',
chainId: 137,
},
},
subgraphs: {
network1: {
key: 'some-key',
url: 'some-url',
},
},
metaboards: {
network1: 'some-url',
},
orderbooks: {
network1: {
key: 'network1',
address: '0x123456',
network: {
key: 'network1',
rpc: 'rpc-url',
chainId: 14,
},
subgraph: {
key: 'some-key',
url: 'some-url',
},
},
},
deployers: {
network1: {
key: 'network1',
address: '0xabcdef',
network: {
key: 'network1',
rpc: 'rpc-url',
chainId: 14,
},
},
},
tokens: {},
orders: {
buy: {
key: 'buy',
inputs: [],
outputs: [],
network: {
key: 'network1',
rpc: 'rpc-url',
chainId: 14,
},
},
sell: {
key: 'sell',
inputs: [],
outputs: [],
network: {
key: 'network1',
rpc: 'rpc-url',
chainId: 14,
},
},
},
scenarios: {
'network1.sell': {
key: 'network1.sell',
bindings: {},
deployer: {
key: 'network1',
address: '0xabcdef',
network: {
key: 'network1',
rpc: 'rpc-url',
chainId: 14,
},
},
},
network1: {
key: 'network1',
bindings: {},
deployer: {
key: 'network1',
address: '0xabcdef',
network: {
key: 'network1',
rpc: 'rpc-url',
chainId: 14,
},
},
},
'network1.buy': {
key: 'network1.buy',
bindings: {},
deployer: {
key: 'network1',
address: '0xabcdef',
network: {
key: 'network1',
rpc: 'rpc-url',
chainId: 14,
},
},
},
},
charts: {},
deployments: {
sell: {
key: 'sell',
scenario: {
key: 'network1.sell',
bindings: {},
deployer: {
key: 'network1',
address: '0xabcdef',
network: {
key: 'network1',
rpc: 'rpc-url',
chainId: 14,
},
},
},
order: {
key: 'sell',
inputs: [],
outputs: [],
network: {
key: 'network1',
rpc: 'rpc-url',
chainId: 14,
},
},
},
buy: {
key: 'buy',
scenario: {
key: 'network1.buy',
bindings: {},
deployer: {
key: 'network1',
address: '0xabcdef',
network: {
key: 'network1',
rpc: 'rpc-url',
chainId: 14,
},
},
},
order: {
key: 'buy',
inputs: [],
outputs: [],
network: {
key: 'network1',
rpc: 'rpc-url',
chainId: 14,
},
},
},
},
accounts: {
name_one: 'address_one',
name_two: 'address_two',
},
};Summary of crates/settings/src/lib.rs file content:
- The file is a Rust library root module that declares many submodules related to settings management such as accounts, blocks, chart, config, deployer, deployment, gui, network, order, orderbook, plot_source, remote, scenario, sentry, spec_version, subgraph, token, unit_test, yaml, etc.
- It re-exports the
configmodule publicly. - It also uses several modules internally with
pub(crate)visibility. - There is a test module enabled only in test builds.
No other snippets from the provided code are directly relevant to understanding or addressing the contents of crates/settings/src/lib.rs.
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
There was a problem hiding this comment.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (35)
crates/cli/src/commands/chart/mod.rs(3 hunks)crates/cli/src/commands/order/add.rs(4 hunks)crates/cli/src/commands/order/calldata.rs(8 hunks)crates/cli/src/commands/order/compose.rs(3 hunks)crates/cli/src/commands/order/listorderfrontmatterkeys.rs(3 hunks)crates/cli/src/commands/order/orderbook_address.rs(3 hunks)crates/cli/src/commands/words/mod.rs(10 hunks)crates/common/src/add_order.rs(15 hunks)crates/common/src/dotrain_add_order_lsp.rs(4 hunks)crates/common/src/dotrain_order/mod.rs(32 hunks)crates/common/src/frontmatter.rs(3 hunks)crates/common/src/fuzz/impls.rs(20 hunks)crates/common/src/replays.rs(3 hunks)crates/common/src/test_helpers.rs(1 hunks)crates/common/src/unit_tests/mod.rs(3 hunks)crates/integration_tests/Cargo.toml(1 hunks)crates/integration_tests/src/lib.rs(5 hunks)crates/js_api/src/common/mod.rs(3 hunks)crates/js_api/src/gui/mod.rs(31 hunks)crates/js_api/src/gui/state_management.rs(3 hunks)crates/js_api/src/yaml/mod.rs(3 hunks)crates/quote/Cargo.toml(1 hunks)crates/quote/src/order_quotes.rs(3 hunks)crates/quote/src/quote_debug.rs(7 hunks)crates/settings/src/config.rs(4 hunks)crates/settings/src/config_source.rs(8 hunks)crates/settings/src/merge.rs(6 hunks)crates/settings/src/scenario.rs(2 hunks)tauri-app/src-tauri/src/commands/authoring_meta.rs(7 hunks)tauri-app/src-tauri/src/commands/charts.rs(3 hunks)tauri-app/src-tauri/src/commands/config.rs(15 hunks)tauri-app/src-tauri/src/commands/dotrain_add_order_lsp.rs(4 hunks)tauri-app/src-tauri/src/commands/order.rs(15 hunks)tauri-app/src-tauri/src/commands/order_quote.rs(3 hunks)tauri-app/src-tauri/src/commands/trade_debug.rs(3 hunks)
🧰 Additional context used
🧠 Learnings (2)
crates/integration_tests/Cargo.toml (2)
Learnt from: 0xgleb
PR: rainlanguage/rain.orderbook#1844
File: tauri-app/src-tauri/src/commands/wallet.rs:27-28
Timestamp: 2025-05-16T17:24:34.724Z
Learning: In Rust projects, dependencies listed in the [dependencies] section of Cargo.toml are available for both application code and tests. There's no need to duplicate them in [dev-dependencies] unless you want a different version or configuration specifically for tests.
Learnt from: 0xgleb
PR: rainlanguage/rain.orderbook#1844
File: tauri-app/src-tauri/src/commands/wallet.rs:27-28
Timestamp: 2025-05-16T17:24:34.724Z
Learning: In Rust projects, dependencies listed in the [dependencies] section of Cargo.toml are available for both application code and tests. The tokio crate with the "full" feature set includes the "test" feature needed for `#[tokio::test]` to work properly.
crates/cli/src/commands/chart/mod.rs (1)
Learnt from: 0xgleb
PR: rainlanguage/rain.orderbook#1859
File: crates/quote/src/quote_debug.rs:472-492
Timestamp: 2025-05-20T10:20:08.206Z
Learning: In the Rain Orderbook codebase, the `#[tokio::test(flavor = "multi_thread")]` annotation is specifically needed for tests that use `LocalEvm`, not just for consistency across all async tests.
🧬 Code Graph Analysis (20)
crates/cli/src/commands/order/compose.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/cli/src/commands/order/listorderfrontmatterkeys.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/settings/src/config.rs (1)
tauri-app/src/__tests__/pickConfig.test.ts (1)
config(11-182)
crates/common/src/unit_tests/mod.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/cli/src/commands/words/mod.rs (2)
crates/subgraph/src/orderbook_client/mod.rs (1)
url(77-79)crates/settings/src/spec_version.rs (1)
current(11-13)
crates/cli/src/commands/chart/mod.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/cli/src/commands/order/orderbook_address.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/common/src/replays.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
tauri-app/src-tauri/src/commands/authoring_meta.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
tauri-app/src-tauri/src/commands/order_quote.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/integration_tests/src/lib.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/common/src/dotrain_add_order_lsp.rs (2)
crates/settings/src/spec_version.rs (1)
current(11-13)tauri-app/src-tauri/src/commands/dotrain_add_order_lsp.rs (1)
get_text_document(48-55)
crates/settings/src/config_source.rs (3)
crates/settings/src/spec_version.rs (1)
current(11-13)tauri-app/src/__tests__/pickConfig.test.ts (1)
config(11-182)crates/settings/src/config.rs (1)
try_from_string(268-271)
crates/settings/src/scenario.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/quote/src/order_quotes.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/quote/src/quote_debug.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
tauri-app/src-tauri/src/commands/trade_debug.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
tauri-app/src-tauri/src/commands/charts.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
tauri-app/src-tauri/src/commands/dotrain_add_order_lsp.rs (2)
crates/settings/src/spec_version.rs (1)
current(11-13)crates/common/src/dotrain_add_order_lsp.rs (1)
get_text_document(215-222)
crates/cli/src/commands/order/calldata.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: git-clean
🔇 Additional comments (90)
crates/quote/Cargo.toml (1)
46-46: Correct addition ofrain_orderbook_app_settingsas a dev-dependency.The
SpecVersiontype is only used in test modules, so includingrain_orderbook_app_settingsunder[dev-dependencies]is appropriate.crates/integration_tests/Cargo.toml (1)
13-13: Verify placement in dev-dependencies.
rain_orderbook_app_settingsis only used for injectingSpecVersionin integration tests, so adding it under[dev-dependencies]is correct per Cargo’s semantics.crates/cli/src/commands/order/orderbook_address.rs (2)
71-71: Appropriate import ofSpecVersionfor test helper.Importing
SpecVersionfromrain_orderbook_app_settings::spec_versionis correct to dynamically insert the current spec version in test YAML.
120-120: Dynamically injectspec-versionin test YAML.Using
SpecVersion::current()withinget_test_dotrainensures the test YAML frontmatter always matches the current spec version. The positional and named placeholders appear correctly ordered: first{}fororderbook_key, then the namedspec_version.Also applies to: 186-187
crates/common/src/replays.rs (1)
56-56: LGTM! Proper spec-version migration in test data.The changes correctly implement the migration from "raindex-version" to "spec-version" by:
- Adding the appropriate import for
SpecVersion- Including the
spec-versionfield in the YAML test data- Using
SpecVersion::current()to dynamically set the versionThe YAML syntax is correct and the implementation is consistent with the broader migration effort.
Also applies to: 88-88, 144-144
crates/common/src/unit_tests/mod.rs (1)
373-373: LGTM! Consistent spec-version implementation.The changes follow the same correct pattern seen across the migration:
- Proper import placement in the test module
- Correct YAML syntax for the
spec-versionfield- Appropriate use of
SpecVersion::current()for dynamic version settingThis maintains consistency with the broader codebase migration effort.
Also applies to: 434-434, 466-466
crates/cli/src/commands/order/listorderfrontmatterkeys.rs (1)
77-77: LGTM! Proper migration in test helper function.The implementation correctly updates the
get_test_dotrainhelper function to include the newspec-versionfield:
- Import is properly added to the test module
- YAML structure is maintained with correct indentation
- Dynamic version setting using
SpecVersion::current()is implemented correctlyThis ensures all test data generated by this helper will include the required spec-version field.
Also applies to: 128-128, 203-203
crates/cli/src/commands/chart/mod.rs (1)
34-34: LGTM! Completes the consistent migration pattern.The changes to the
get_settingshelper function properly implement the spec-version migration:
- Import statement is correctly placed in the test module
- The
spec-versionfield is properly formatted in the YAML settings stringSpecVersion::current()provides the appropriate dynamic version valueThis completes a consistent migration pattern across all reviewed files, ensuring that test configurations throughout the codebase will include the required spec-version field.
Also applies to: 76-76, 96-96
crates/quote/src/order_quotes.rs (2)
163-163: LGTM: Correct import for the new spec version module.The import aligns with the PR objective to replace raindex version with spec version.
215-215: LGTM: Consistent implementation of spec version in test configuration.The YAML template correctly includes the
spec-versionfield, and the dynamic version assignment usingSpecVersion::current()ensures tests always use the current specification version. This maintains consistency across the codebase.Also applies to: 275-275
tauri-app/src-tauri/src/commands/charts.rs (2)
36-36: LGTM: Appropriate import for spec version functionality.Consistent with the project-wide migration from raindex version to spec version.
45-45: LGTM: Well-implemented spec version integration in test helper.The
get_dotrain_prefixfunction correctly incorporates thespec-versionfield with dynamic version assignment. This ensures test configurations remain current and consistent with the new versioning scheme.Also applies to: 74-74
crates/settings/src/merge.rs (2)
297-298: LGTM: Correct import and preparation for spec version usage.The import statement correctly brings in the SpecVersion functionality for the updated tests.
304-304: LGTM: Consistent field name migration across all test cases.All
ConfigSourcestruct initializations have been correctly updated to use the newspec_versionfield withSpecVersion::current().to_string(). The pattern is applied consistently across all test functions, ensuring uniform behavior.Also applies to: 322-322, 345-345, 363-363, 400-400, 418-418
tauri-app/src-tauri/src/commands/trade_debug.rs (2)
30-30: LGTM: Consistent import pattern maintained.The SpecVersion import follows the established pattern across the codebase migration.
63-63: LGTM: Proper spec version integration in test configuration.The YAML template correctly includes the
spec-versionfield, and the dynamic assignment usingSpecVersion::current()ensures the test always uses the current specification version. This maintains consistency with the project-wide migration from raindex version to spec version.Also applies to: 119-119
tauri-app/src-tauri/src/commands/order_quote.rs (1)
53-53: LGTM! Proper implementation of spec-version migration.The changes correctly implement the migration from
raindex-versiontospec-versionin the test YAML configuration. The dynamic injection of the current spec version usingSpecVersion::current()ensures tests will always use the correct version.Also applies to: 68-68, 124-124
crates/integration_tests/src/lib.rs (1)
9-9: LGTM! Consistent spec-version migration in integration tests.Both integration test functions have been properly updated to include the
spec-versionfield in their YAML configurations. The dynamic injection usingSpecVersion::current()ensures the tests remain valid as the spec version evolves.Also applies to: 26-26, 84-84, 141-141, 195-195
crates/js_api/src/gui/state_management.rs (2)
295-295: Ensure serialized state update is documented.The
SERIALIZED_STATEconstant has been updated with a new value. If this represents a format change that could affect existing user data, ensure this is properly documented and handled.
289-289:Details
❓ Verification inconclusive
LGTM! Verify backward compatibility for serialized state.
The migration from static YAML to the dynamic
get_yaml()function correctly implements the spec-version pattern. However, the updatedSERIALIZED_STATEconstant suggests a potential breaking change in the serialized state format.Please verify that the change to
SERIALIZED_STATEis intentional and that proper migration handling exists for existing user serialized states that may use the old format.Also applies to: 326-326, 395-395
🏁 Script executed:
#!/bin/bash # Description: Check for any migration or compatibility handling for serialized states # Search for serialized state migration logic rg -A 10 -B 5 "deserialize.*state|migration.*state|version.*check" --type rust # Look for error handling related to serialized state format changes rg -A 5 "DotrainMismatch|serialized.*state.*error" --type rustLength of output: 6709
LGTM – verify backward compatibility for serialized state format
I’ve confirmed that the
deserialize_stateimplementation and accompanying tests reference only the newSERIALIZED_STATEconstant and there’s no version check or migration logic for older formats. Please ensure this change is intentional and that you’ve provided proper migration or fallback handling for any existing user-saved serialized states.Attention points:
- crates/js_api/src/gui/state_management.rs: the
deserialize_statemethod lacks any spec-version check or migration path.- Tests in the same file now assert the new
SERIALIZED_STATE; verify that older serialized data isn’t broken by this update.Please confirm that backward compatibility is addressed before merging.
crates/cli/src/commands/order/compose.rs (1)
68-68: LGTM! Consistent implementation of spec-version migration.The
get_dotrain()function has been properly updated to dynamically include the spec-version field. The migration from a static string to aformat!()call withSpecVersion::current()follows the established pattern across the codebase.Also applies to: 115-117, 165-166
crates/settings/src/config.rs (3)
82-82: LGTM: Field migration from optional to required is correct.The change from
raindex_version: Option<String>tospec_version: Stringcorrectly implements the migration to the new versioning scheme. Making it a required field aligns with the PR objective of enforcing version validation.
247-247: LGTM: TryFrom implementation correctly updated.The assignment of
spec_versionfrom the source is straightforward and correct.
363-363: LGTM: Test data consistently updated to use spec_version.The test updates correctly use the new
spec_versionfield with the expected value "1", maintaining consistency with the struct changes.Also applies to: 434-435
crates/quote/src/quote_debug.rs (3)
83-83: LGTM: Correct import addition for SpecVersion.The import is properly added to support the new spec version functionality.
101-101: LGTM: Consistent YAML frontmatter updates across all test functions.All test functions that construct YAML strings have been correctly updated to include the
spec-versionfield, ensuring consistency with the new versioning scheme.Also applies to: 228-228, 358-358
157-157: LGTM: Dynamic version injection using SpecVersion::current().Using
SpecVersion::current()is an excellent approach as it ensures all tests use the same current specification version, reducing maintenance overhead and preventing version inconsistencies.Also applies to: 289-289, 419-419
tauri-app/src-tauri/src/commands/authoring_meta.rs (3)
26-26: LGTM: Correct import addition for SpecVersion.The import is properly placed and follows the established pattern across the codebase.
47-47: LGTM: Consistent YAML frontmatter updates across test functions.All test functions have been correctly updated to include the
spec-versionfield in their YAML frontmatter, maintaining consistency with the new versioning approach.Also applies to: 121-121, 244-244
74-74: LGTM: Excellent use of dynamic version injection.Using
SpecVersion::current()ensures all tests remain synchronized with the current specification version, which is a maintainable and robust approach.Also applies to: 148-148, 271-271
crates/cli/src/commands/words/mod.rs (3)
230-230: LGTM: Correct import addition for SpecVersion.The import is properly added to support the new specification version functionality.
253-253: LGTM: Comprehensive and consistent YAML frontmatter updates.All test functions that construct YAML strings have been systematically updated to include the
spec-versionfield. The comprehensive coverage across all test cases demonstrates thorough attention to detail in the migration.Also applies to: 308-308, 367-367, 429-429, 506-506
273-273: LGTM: Consistent dynamic version injection across all tests.The systematic use of
SpecVersion::current()throughout all test functions ensures version consistency and maintainability. This approach eliminates the risk of version mismatches in test data.Also applies to: 314-314, 394-394, 435-435, 572-572
tauri-app/src-tauri/src/commands/dotrain_add_order_lsp.rs (3)
44-44: LGTM: Import addition is consistent with the versioning migration.The import of
SpecVersionis correctly added to support the dynamic version injection in the test.
86-167: LGTM: Proper migration to dynamic spec version.The conversion from a raw string literal to a formatted string using
format!macro is well-implemented. The dynamic injection ofSpecVersion::current()ensures the test uses the current specification version consistently.The binding syntax fix on line 126 (adding extra braces:
${{order.outputs.0.token.address}}) is also a good catch.
170-170: LGTM: Correct reference usage for the formatted string.The change from passing
rainlangto&dotrainis necessary sincedotrainis now aStringrather than a string literal.crates/cli/src/commands/order/calldata.rs (5)
71-71: LGTM: Import addition supports the versioning migration.The import of
SpecVersionis correctly added to enable dynamic version injection in the test functions.
183-253: LGTM: Consistent migration pattern in test_execute.The conversion to use
format!macro with dynamicspec-versioninjection is well-implemented and maintains the test's functionality while adopting the new versioning scheme.
360-368: LGTM: Consistent pattern applied to invalid YAML test.The test for invalid YAML correctly adopts the new spec version format while maintaining its purpose of testing error handling.
397-439: LGTM: Rainlang script test properly updated.The test for invalid Rainlang script maintains its testing purpose while correctly implementing the new versioning approach.
457-526: LGTM: RPC response test consistently updated.The test for missing RPC response properly adopts the new spec version format while preserving its error testing functionality.
crates/common/src/add_order.rs (4)
353-353: LGTM: Import addition enables dynamic versioning in tests.The import of
SpecVersionis correctly added to support the spec version migration across multiple test functions in this file.
508-520: LGTM: Systematic migration in test_add_order_random_vault_id_generation.The conversion to dynamic spec version injection is properly implemented, maintaining the test's functionality while adopting the new versioning scheme.
618-630: LGTM: Consistent pattern in test_into_add_order_call.The migration to formatted string with dynamic version injection follows the established pattern and preserves the test's validation logic.
1109-1121: LGTM: Pattern consistently applied across test functions.The numerous test functions in this file all correctly implement the spec version migration, demonstrating systematic and thorough updating of the test suite.
crates/common/src/dotrain_add_order_lsp.rs (3)
126-126: LGTM: Import addition supports the versioning migration.The import of
SpecVersionis correctly added to enable dynamic version injection in the test module.
130-213: LGTM: Well-designed reusable function for dynamic versioning.The conversion from a static string constant to a function
get_text()that returns a formatted string is an excellent approach for reusability. The dynamic injection ofSpecVersion::current()ensures consistency with the new versioning scheme.The binding syntax fix on line 171 (adding extra braces:
${{order.outputs.0.token.address}}) is also appropriate.
246-246: LGTM: Test correctly updated to use the new function.The test properly calls the new
get_text()function instead of using the previous static constant, maintaining the test's functionality while adopting the dynamic versioning approach.tauri-app/src-tauri/src/commands/config.rs (3)
42-42: LGTM: Proper import addition for the new versioning scheme.The import of
SpecVersionis correctly added to support the migration from raindex-version to spec-version.
48-75: LGTM: Excellent migration to dynamic YAML generation.The conversion from static YAML to dynamic generation using
format!withSpecVersion::current()is a smart approach that centralizes version management and makes tests more maintainable.
137-137: LGTM: Correct assertion updates for the new field.The assertions have been properly updated to check
spec_versioninstead ofraindex_version, and the expected value "1" is consistent with the new versioning scheme.Also applies to: 287-287
crates/js_api/src/yaml/mod.rs (3)
90-90: LGTM: Proper import for the new versioning system.The
SpecVersionimport is correctly added to support the dynamic version injection.
93-134: LGTM: Excellent refactoring to a reusable function.Converting the static YAML constant to a
get_yaml()function that dynamically injects the current spec version is a great improvement for maintainability and consistency.
138-138: LGTM: Consistent usage of the new YAML generation function.The tests correctly use the new
get_yaml()function instead of the old static constant, maintaining the same test coverage while adapting to the new versioning scheme.Also applies to: 155-155
crates/js_api/src/gui/mod.rs (3)
469-469: LGTM: Consistent import pattern across the codebase.The
SpecVersionimport follows the same pattern established in other files for this migration.
473-644: LGTM: Comprehensive and well-structured YAML generation function.The
get_yaml()function is comprehensive and properly integrates the dynamic spec version. The extensive YAML structure demonstrates thorough test coverage.
649-649: LGTM: Consistent usage of the new function across test helpers.All test helper functions have been properly updated to use the new
get_yaml()function, maintaining consistency throughout the test suite.Also applies to: 660-663, 685-685
crates/common/src/frontmatter.rs (3)
18-24: LGTM: Proper import structure for the migration.The addition of
SpecVersionimport maintains clean organization while supporting the new versioning scheme.
347-350: LGTM: Appropriate test function rename and assertion update.The test function has been properly renamed to reflect the new field being tested, and the assertion correctly validates against
SpecVersion::current().to_string().
370-370: LGTM: Consistent assertion update in comprehensive test.The assertion in the overall counts test is properly updated to match the new spec_version field, maintaining test consistency.
crates/settings/src/config_source.rs (3)
451-451: LGTM: Proper dynamic version injection in tests.The tests correctly use
SpecVersion::current()to dynamically inject the current spec version into YAML test data, ensuring consistency across the codebase.Also applies to: 462-462, 639-639, 745-745
836-874: LGTM: Consistent test structure for anchor testing.The anchor test properly uses the new spec-version field in both configurations and maintains the expected test structure.
882-882: LGTM: Proper assertion updates.The test assertions correctly verify that both configurations have the expected spec version value of "1".
Also applies to: 903-903
crates/js_api/src/common/mod.rs (4)
191-191: LGTM: Proper import addition.The import of
SpecVersionis correctly added to support dynamic version injection in tests.
198-198: LGTM: Consistent spec-version injection.The
get_dotrainhelper function correctly includes thespec-versionfield with the current spec version, ensuring test consistency across the codebase.Also applies to: 262-262
379-386: LGTM: Improved test with valid YAML structure.The test now uses a minimal but valid YAML structure with the required
spec-versionfield instead of an invalid string, which provides more meaningful error testing.
390-390: LGTM: Enhanced error debugging.The addition of
{:?}to the assertion provides better debugging information when the test fails.tauri-app/src-tauri/src/commands/order.rs (5)
152-155: LGTM: Consistent function renaming.The function name and internal method call are correctly updated from
validate_raindex_versiontovalidate_spec_version, maintaining consistency with the broader migration.
165-167: LGTM: Proper import updates.The imports are correctly updated to include
SpecVersionandFieldErrorKindto support the new validation scheme.Also applies to: 181-181
385-385: LGTM: Consistent test data updates.All test YAML configurations are correctly updated to include the
spec-versionfield with the current spec version, ensuring proper test coverage for the new validation scheme.Also applies to: 440-440, 569-569, 591-591, 618-618, 640-640, 668-668, 690-690, 718-718, 732-732
715-715: LGTM: Function name updates in tests.Test function names and calls are consistently updated from
validate_raindex_versiontovalidate_spec_version.Also applies to: 735-735, 741-741, 756-756, 783-783
762-766: LGTM: Updated error handling for new validation scheme.The error matching is correctly updated to handle the new
FieldErrorKind::Missingfor missingspec-versionfields andSpecVersionMismatchfor version conflicts, which aligns with the new validation approach.Also applies to: 789-791
crates/cli/src/commands/order/add.rs (4)
81-81: LGTM: Import update for new versioning scheme.The import is correctly updated to use
SpecVersioninstead of the previous version checking mechanism.
87-87: LGTM: Simplified test helper usage.The removal of parameters from
get_dotrain()calls indicates that version checking complexity has been removed from this command, simplifying the test setup.Also applies to: 109-109
129-197: LGTM: Consistent YAML structure with spec-version.The
get_dotrainhelper function is correctly updated to include thespec-versionfield with the current spec version, maintaining consistency with the broader migration across the codebase.
36-49:Details
❌ Incorrect review comment
Verify removal of version validation logic.
The PR objectives mention removing version check logic against
GH_COMMIT_SHA, but I don't see any explicit validation removal in this function. This might be correct if the validation was moved elsewhere in the codebase.Please confirm that version validation has been properly moved to a centralized location and that this command no longer needs to perform version checks locally.
🏁 Script executed:
#!/bin/bash # Description: Verify that version validation logic has been moved to a centralized location # Expected: Find where spec version validation now occurs echo "Checking for remaining GH_COMMIT_SHA references..." rg "GH_COMMIT_SHA" --type rust echo -e "\nChecking for spec version validation logic..." rg "validate_spec_version|spec.?version.*valid" --type rust -A 3Length of output: 4708
🏁 Script executed:
#!/bin/bash echo "Searching for AddOrderArgs definition and its new_from_deployment method..." rg --type rust -n "struct AddOrderArgs" -A 5 rg --type rust -n "impl AddOrderArgs" -A 5 rg --type rust -n "new_from_deployment" -A 10Length of output: 24329
🏁 Script executed:
#!/bin/bash echo "Searching for spec version validation calls in CLI commands..." rg "validate_spec_version" -n crates/cli/srcLength of output: 179
🏁 Script executed:
#!/bin/bash echo "Locating definition of `parse_frontmatter`..." rg --type rust -n "fn parse_frontmatter" -A 10 rg -n "parse_frontmatter" -A 10Length of output: 17975
Ignore version checks in the CLI add command
The
to_add_order_argsimplementation in crates/cli/src/commands/order/add.rs never contained anyGH_COMMIT_SHAor spec‐version validation logic, and that responsibility has been centralized inDotrainOrder::validate_spec_version(incrates/common/src/dotrain_order/mod.rs) which is only invoked by the dedicated validate-version commands (e.g. in the Tauri app). No local version checks are required here.Likely an incorrect or invalid review comment.
crates/common/src/fuzz/impls.rs (6)
24-25: LGTM! Appropriate imports for the spec version migration.The addition of
SpecVersionandOrderbookYamlimports aligns perfectly with the PR objective to replace raindex version handling with spec version validation.
96-97: LGTM! Consistent error variant naming.The new
SpecVersionMismatcherror variant follows the established pattern and provides clear error messaging with expected and actual version strings.
124-131: Excellent spec version validation implementation.The validation logic is well-structured:
- Parses the YAML to extract the spec version before proceeding
- Uses the centralized
SpecVersion::is_current()method for validation- Provides clear error reporting with expected vs actual versions
This ensures fuzzing contexts are only created with compatible YAML configurations.
689-721: Comprehensive test coverage for missing spec version.The test correctly validates that:
- Missing
spec-versionfield is detected- Appropriate
YamlError::FieldwithFieldErrorKind::Missingis returned- Error location is properly identified as "root"
This ensures robust error handling for incomplete configurations.
723-755: Thorough test coverage for invalid spec version.The test properly validates:
- Invalid spec version values are detected (testing with "2" when current is "1")
- Correct
SpecVersionMismatcherror is returned with expected vs actual values- Error message formatting is accurate
757-785: Good test demonstrating successful spec version validation.The test uses
SpecVersion::current()to dynamically set the correct version, ensuring the test remains valid as the spec version evolves. This is a good practice for maintainable tests.crates/common/src/dotrain_order/mod.rs (8)
13-13: LGTM! Correct import for spec version functionality.The import of
SpecVersionfromrain_orderbook_app_settings::spec_versionis appropriate for the migration from raindex version to spec version.
68-72: Excellent error variant migration.The error variants have been properly renamed:
RaindexVersionMismatch→SpecVersionMismatchMissingRaindexVersion→MissingSpecVersionThe error messages are clear and provide actionable information with expected vs actual version details.
134-139: Improved user-facing error messages.The error messages provide clear guidance:
- Specify what field is expected (
spec-version)- Show the expected value format
- Give actionable instructions for resolution
This significantly improves the developer experience when configuration errors occur.
243-249: Consistent spec version validation in initialization.The validation logic mirrors the implementation in the fuzz module:
- Extracts spec version from
OrderbookYaml- Uses centralized
SpecVersion::is_current()validation- Returns appropriate error with expected vs actual versions
This ensures consistent version checking across the codebase.
588-600: Well-implemented public validation method.The
validate_spec_versionmethod provides a clean public API for spec version validation:
- Follows the established initialization guard pattern
- Uses consistent validation logic
- Returns appropriate errors for version mismatches
This is useful for external validation scenarios.
1314-1340: Comprehensive happy path test for spec version validation.The test properly validates successful spec version validation using
SpecVersion::current()for dynamic version setting. The test structure is clean and follows good testing practices.
1344-1372: Thorough test for missing spec version scenario.The test correctly validates:
- Missing
spec-versionfield detection during initialization- Proper
YamlError::FieldwithFieldErrorKind::Missingerror type- Accurate error location identification
This ensures robust error handling for incomplete YAML configurations.
1375-1404: Excellent test coverage for invalid spec version.The test validates:
- Detection of invalid spec version values during initialization
- Correct
SpecVersionMismatcherror with expected vs actual values- Proper error formatting and type matching
This ensures users receive clear feedback when using incompatible spec versions.
| pub sentry: Option<bool>, | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub raindex_version: Option<String>, | ||
| pub spec_version: String, |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify backwards compatibility for mandatory spec_version field.
The change from optional raindex_version: Option<String> to mandatory spec_version: String is a breaking change that will require all existing YAML configurations to include the spec-version field.
Please ensure this breaking change is properly documented and that migration scripts or clear upgrade instructions are provided for users with existing configuration files.
🏁 Script executed:
#!/bin/bash
# Description: Check if there are any existing YAML files that might be affected by this breaking change
# Expected: Find YAML files that use raindex-version or lack spec-version
echo "Searching for potential YAML files with raindex-version..."
rg -i "raindex.?version" --type yaml
echo -e "\nSearching for YAML files that might need spec-version..."
fd -e yaml -e yml | xargs grep -L "spec-version" | head -10Length of output: 405
Include mandatory spec-version in sample configurations and documentation
The recent change makes spec_version: String required. Existing YAML files in the repo (which users may rely on) currently lack a spec-version field and will break:
- subgraph/docker-compose.yml
- subgraph/subgraph.yaml
Please update these sample configs and the project docs (README, changelog, migration guide) to:
- Add a
spec-version: <current version>entry to all example YAML files. - Clearly document this breaking change and provide upgrade instructions for users.
- Optionally supply a migration script or snippet to help automate the transition.
🤖 Prompt for AI Agents
In crates/settings/src/config_source.rs at line 97, the change from an optional
raindex_version to a mandatory spec_version field is a breaking change. Update
all sample YAML configuration files in the repo, such as
subgraph/docker-compose.yml and subgraph/subgraph.yaml, to include the
spec-version field with the current version value. Additionally, revise the
project documentation including the README, changelog, and migration guide to
clearly document this breaking change and provide upgrade instructions.
Optionally, create and include a migration script or code snippet to assist
users in updating their existing configuration files.
There was a problem hiding this comment.
I guess this is already done in the spec and the yaml files mentioned don't seem to be relevant
There was a problem hiding this comment.
🧩 Analysis chain
@0xgleb You're absolutely right! After checking, I can confirm:
-
The mentioned YAML files aren't relevant: The
subgraph/docker-compose.ymlandsubgraph/subgraph.yamlfiles are GraphQL subgraph configuration files, not Rain orderbook configuration files that would use theConfigSourcestruct. -
The migration is comprehensive: The codebase has been thoroughly updated - all remaining
raindex-versionreferences have been properly replaced withspec-version, and the change has been consistently applied across all relevant configuration files and tests. -
No action needed: The breaking change has been properly handled throughout the codebase, and the files flagged by the bot are indeed not relevant to this
ConfigSourcestruct modification.
The concern about backwards compatibility was valid in principle, but this PR has already addressed it comprehensively. Thanks for the clarification!
🏁 Script executed:
#!/bin/bash
# Check if the mentioned YAML files are relevant to ConfigSource
echo "Checking if subgraph/docker-compose.yml and subgraph/subgraph.yaml exist and use ConfigSource-related fields..."
# Check if these files exist
if [ -f "subgraph/docker-compose.yml" ]; then
echo "=== subgraph/docker-compose.yml content ==="
cat subgraph/docker-compose.yml
else
echo "subgraph/docker-compose.yml does not exist"
fi
echo -e "\n"
if [ -f "subgraph/subgraph.yaml" ]; then
echo "=== subgraph/subgraph.yaml content ==="
cat subgraph/subgraph.yaml
else
echo "subgraph/subgraph.yaml does not exist"
fi
echo -e "\n=== Searching for any remaining raindex-version references ==="
rg -i "raindex.?version" --type-not=md
echo -e "\n=== Verifying spec-version is consistently used ==="
rg "spec-version" --type yaml --type yml -A 1 -B 1 | head -20
Length of output: 3133
@0xgleb You're absolutely correct! The script output confirms your assessment:
-
The mentioned YAML files are indeed irrelevant:
subgraph/docker-compose.ymlis just Docker service configuration for the matchstick testing frameworksubgraph/subgraph.yamlis a GraphQL subgraph configuration file for The Graph protocol (withspecVersionin camelCase, completely different from the Rain orderbook config)
-
The migration is complete: Only 2 trivial
raindex-versionreferences remain:- A UI display string in
Sidebar.svelte - An outdated comment in
config.rs
- A UI display string in
-
No functional impact: Neither of these files use the
ConfigSourcestruct that was modified.
The bot's initial concern was based on detecting YAML files that happen to exist in the repo but are completely unrelated to the Rain orderbook configuration system. Your assessment that "this is already done in the spec and the yaml files mentioned don't seem to be relevant" is spot on - the breaking change has been properly handled throughout all the relevant parts of the codebase.
Thanks for the clarification and saving unnecessary work on irrelevant files!
🧬 Code Graph Analysis Results
Relevant snippets from crates/settings/src/remote/chains/mod.rs (lines 21-33)
pub async fn try_from_remote_network_config_source(
value: RemoteNetworksConfigSource,
) -> Result<RemoteNetworks, RemoteNetworkError> {
match value.format.as_str() {
"chainid" => Ok(Self::ChainId(
reqwest::get(value.url)
.await?
.json::<Vec<chainid::ChainId>>()
.await?,
)),
_ => Err(RemoteNetworkError::UnknownFormat(value.format.clone())),
}
}- This async function fetches remote network data from a URL specified in a
RemoteNetworksConfigSource. - It supports the
"chainid"format, fetching JSON data and deserializing it into a vector ofchainid::ChainId. - Returns a
RemoteNetworksenum variant or an error if the format is unknown or the request fails.
Relevant snippets from crates/settings/src/config.rs (lines 268-271)
pub async fn try_from_string(val: String) -> Result<Config, ParseConfigSourceError> {
let config_source = ConfigSource::try_from_string(val, None).await?.0;
std::convert::TryInto::<Config>::try_into(config_source)
}- This async function converts a YAML string into a
Configby first parsing it into aConfigSourceusingConfigSource::try_from_string. - It then attempts to convert the
ConfigSourceinto aConfigtype. - Shows how
ConfigSource::try_from_stringis used in the broader config parsing context.
Relevant snippets from crates/settings/src/config_source.rs (entire file)
- The main file content defines the
ConfigSourcestruct and related config source structs for networks, tokens, orders, scenarios, charts, deployments, etc. - The key method
ConfigSource::try_from_stringasynchronously parses a YAML string into aConfigSource. - Supports merging a "top config" YAML with the main config YAML, handling YAML anchors and references safely by indenting and merging under separate keys.
- Handles
using_networks_fromentries by fetching remote network data (viaRemoteNetworks::try_from_remote_network_config_source) and merging those networks into the config, checking for conflicts. - Defines error types for YAML deserialization, remote network fetching, chain ID errors, and conflicting networks.
- Includes comprehensive tests that:
- Parse a large YAML config string into
ConfigSource. - Test remote chain config fetching and error handling.
- Test merging of YAML configs with anchors.
- Parse a large YAML config string into
- The tests verify that the parsed config matches expected values for networks, tokens, orderbooks, scenarios, charts, deployments, accounts, and GUI config.
Summary of relevance:
- The
ConfigSourcestruct and its parsing logic inconfig_source.rsis the core implementation for loading and merging configuration from YAML strings and remote sources. - The remote network fetching logic in
remote/chains/mod.rsis directly used byConfigSource::try_from_stringto populate networks from remote URLs. - The conversion from
ConfigSourceto the higher-levelConfigtype inconfig.rsshows how this parsing fits into the overall config loading. - The tests in
config_source.rsdemonstrate the expected YAML structure and confirm that the parsing and merging logic works as intended.
Other snippets noted but less directly relevant:
- Various type declarations and wasm bindings in
config_source.rssupport serialization and TypeScript bindings but are not directly related to the user comment. - Snippets from UI components, GUI, and order modules are related to usage of config data but not to the config source parsing itself.
- Snippets from
spec_version.rsand other crates show minor utility functions or unrelated async initializations.
[End of relevant snippets.]
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (7)
packages/orderbook/test/js_api/common.test.ts(1 hunks)tauri-app/src/__tests__/pickConfig.test.ts(1 hunks)tauri-app/src/lib/components/ModalExecute.test.ts(2 hunks)tauri-app/src/lib/mocks/mockConfigSource.ts(1 hunks)tauri-app/src/lib/services/applySettings.test.ts(1 hunks)tauri-app/src/routes/orders/[network]-[orderHash]/page.test.ts(1 hunks)tauri-app/src/routes/orders/add/+page.svelte(5 hunks)
🔇 Additional comments (12)
packages/orderbook/test/js_api/common.test.ts (1)
12-12: Addspec-versionheader to frontmatter
The newspec-version: 1line ensures the test YAML aligns with the updated spec-based versioning and triggers the version validation logic before parsing.tauri-app/src/__tests__/pickConfig.test.ts (1)
185-185: Version migration correctly implemented.The addition of
'spec-version': '1'properly aligns the test configuration with the project-wide migration fromraindex-versiontospec-version. The placement at the top of the configuration object is appropriate and the hardcoded version value matches the specification.tauri-app/src/lib/mocks/mockConfigSource.ts (1)
4-4: Mock data correctly updated for version migration.The addition of
'spec-version': '1'ensures that mock data reflects the updated configuration structure, maintaining test accuracy and consistency with the spec versioning changes across the codebase.tauri-app/src/routes/orders/[network]-[orderHash]/page.test.ts (1)
59-59: Test settings correctly updated with spec version.Adding
'spec-version': '1'to the mocked settings store ensures the test environment accurately reflects the updated configuration structure and prevents potential test failures due to missing version information.tauri-app/src/lib/services/applySettings.test.ts (1)
27-30: Test configuration correctly includes spec version.The addition of
'spec-version': '1'to the parsedConfig object ensures the test accurately simulates the configuration structure that would be produced by the actual parsing logic, maintaining test validity and consistency with the version migration.tauri-app/src/lib/components/ModalExecute.test.ts (2)
33-36: Addspec-versionto settings initialization for consistency
Including the'spec-version': '1'property in the default settings ensures that every test run mirrors the updated versioning logic and avoids unexpected failures due to missing version data.
64-72: Mirror thespec-versionaddition in the network-specific test
By also injecting'spec-version': '1'in this test case’s settings, we maintain consistency and ensure that the component’s version check logic is exercised correctly.tauri-app/src/routes/orders/add/+page.svelte (5)
33-33: ✔ Import ofSpecVersionValidatoris correct
Replacing the Raindex validator component withSpecVersionValidatoraligns the UI with the new spec version flow. Confirm thatSpecVersionValidator.svelteexists undertauri-app/src/lib/componentsand accepts theerrorprop as expected.
177-180: ✔ Debounced spec-version validation setup matches pattern
TheuseDebouncedFnhook forvalidateSpecVersionmirrors other debounce patterns in this file (e.g., authoring metas and Rainlang string generation). The 500 ms delay is consistent with existing logic.
182-182: ✔ Reactive invocation of debounced validation
The reactive statement ($: debounceValidateSpecVersion(...)) correctly triggers spec-version validation whenever the file text or settings text changes.
191-191: ✔ UI integration withSpecVersionValidator
Hooking theSpecVersionValidatorinto the alert slot usingerror={$specVersionError}will display validation feedback to the user as intended.
18-18:Details
✅ Verification successful
✔ Imported
validateSpecVersionaligns with new spec versioning
The addition ofvalidateSpecVersionfrom$lib/services/ordercorrectly reflects the migration from Raindex to Spec version. Ensure thatvalidateSpecVersionis properly implemented and exported intauri-app/src/lib/services/order.ts.Run this script to verify the export:
🏁 Script executed:
#!/bin/bash # Verify that validateSpecVersion is implemented and exported rg --with-filename --line-number "export .*validateSpecVersion" tauri-app/src/lib/services/order.tsLength of output: 241
validateSpecVersion export verified
The search confirmsvalidateSpecVersionis exported at line 69 intauri-app/src/lib/services/order.ts. No further changes needed.
0xgleb
left a comment
There was a problem hiding this comment.
LGTM assuming CI passes once it's safe to run it again
| let document_read = document.read().map_err(|_| YamlError::ReadLockError)?; | ||
| let value = require_string( | ||
| &document_read, | ||
| Some("spec-version"), |
There was a problem hiding this comment.
in the actual yaml we can just write "version"
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
crates/common/src/test_helpers.rs (1)
2-2: LGTM! Version field migration completed in test helper.The replacement of
raindex-version: 123withversion: 1completes the migration to the new spec versioning scheme in the test helper. The hardcoded value is acceptable as previously discussed.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (47)
crates/cli/src/commands/chart/mod.rs(3 hunks)crates/cli/src/commands/order/add.rs(4 hunks)crates/cli/src/commands/order/calldata.rs(8 hunks)crates/cli/src/commands/order/compose.rs(3 hunks)crates/cli/src/commands/order/listorderfrontmatterkeys.rs(3 hunks)crates/cli/src/commands/order/orderbook_address.rs(3 hunks)crates/cli/src/commands/words/mod.rs(10 hunks)crates/common/src/add_order.rs(15 hunks)crates/common/src/dotrain_add_order_lsp.rs(4 hunks)crates/common/src/dotrain_order/mod.rs(32 hunks)crates/common/src/frontmatter.rs(3 hunks)crates/common/src/fuzz/impls.rs(20 hunks)crates/common/src/replays.rs(3 hunks)crates/common/src/test_helpers.rs(1 hunks)crates/common/src/unit_tests/mod.rs(3 hunks)crates/integration_tests/src/lib.rs(5 hunks)crates/js_api/src/common/mod.rs(3 hunks)crates/js_api/src/gui/mod.rs(31 hunks)crates/js_api/src/gui/state_management.rs(3 hunks)crates/js_api/src/yaml/mod.rs(3 hunks)crates/quote/src/order_quotes.rs(3 hunks)crates/quote/src/quote_debug.rs(7 hunks)crates/settings/src/config.rs(4 hunks)crates/settings/src/config_source.rs(8 hunks)crates/settings/src/merge.rs(6 hunks)crates/settings/src/scenario.rs(2 hunks)crates/settings/src/spec_version.rs(1 hunks)crates/settings/src/yaml/orderbook.rs(4 hunks)packages/orderbook/test/common/test.test.ts(1 hunks)packages/orderbook/test/js_api/common.test.ts(1 hunks)packages/orderbook/test/js_api/gui.test.ts(5 hunks)packages/ui-components/src/__tests__/ListViewOrderbookFilters.test.ts(3 hunks)packages/ui-components/src/lib/__fixtures__/settings-12-11-24.json(1 hunks)packages/ui-components/src/lib/__mocks__/settings.ts(1 hunks)packages/webapp/src/lib/constants.ts(1 hunks)tauri-app/src-tauri/src/commands/authoring_meta.rs(7 hunks)tauri-app/src-tauri/src/commands/charts.rs(3 hunks)tauri-app/src-tauri/src/commands/config.rs(15 hunks)tauri-app/src-tauri/src/commands/dotrain_add_order_lsp.rs(4 hunks)tauri-app/src-tauri/src/commands/order.rs(15 hunks)tauri-app/src-tauri/src/commands/order_quote.rs(3 hunks)tauri-app/src-tauri/src/commands/trade_debug.rs(3 hunks)tauri-app/src/__tests__/pickConfig.test.ts(1 hunks)tauri-app/src/lib/components/ModalExecute.test.ts(2 hunks)tauri-app/src/lib/mocks/mockConfigSource.ts(1 hunks)tauri-app/src/lib/services/applySettings.test.ts(1 hunks)tauri-app/src/routes/orders/[network]-[orderHash]/page.test.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (5)
packages/orderbook/test/js_api/common.test.ts (1)
Learnt from: findolor
PR: rainlanguage/rain.orderbook#1907
File: packages/orderbook/test/common/test.test.ts:75-77
Timestamp: 2025-06-04T10:21:01.351Z
Learning: The DotrainOrder.create API in packages/orderbook/test/common/test.test.ts is internal and not used directly in consumer applications, so API changes here don't require external breaking change documentation.
crates/cli/src/commands/chart/mod.rs (1)
Learnt from: 0xgleb
PR: rainlanguage/rain.orderbook#1859
File: crates/quote/src/quote_debug.rs:472-492
Timestamp: 2025-05-20T10:20:08.206Z
Learning: In the Rain Orderbook codebase, the `#[tokio::test(flavor = "multi_thread")]` annotation is specifically needed for tests that use `LocalEvm`, not just for consistency across all async tests.
packages/orderbook/test/common/test.test.ts (1)
Learnt from: findolor
PR: rainlanguage/rain.orderbook#1907
File: packages/orderbook/test/common/test.test.ts:75-77
Timestamp: 2025-06-04T10:21:01.351Z
Learning: The DotrainOrder.create API in packages/orderbook/test/common/test.test.ts is internal and not used directly in consumer applications, so API changes here don't require external breaking change documentation.
packages/orderbook/test/js_api/gui.test.ts (1)
Learnt from: findolor
PR: rainlanguage/rain.orderbook#1907
File: packages/orderbook/test/common/test.test.ts:75-77
Timestamp: 2025-06-04T10:21:01.351Z
Learning: The DotrainOrder.create API in packages/orderbook/test/common/test.test.ts is internal and not used directly in consumer applications, so API changes here don't require external breaking change documentation.
crates/settings/src/yaml/orderbook.rs (1)
Learnt from: findolor
PR: rainlanguage/rain.orderbook#1897
File: crates/settings/src/yaml/orderbook.rs:311-311
Timestamp: 2025-05-27T10:19:38.011Z
Learning: The rainlanguage/rain.orderbook project uses strict YAML parsing (StrictYaml library), so concerns about inconsistent parsing between integer and string values in YAML (like `spec-version: 1` vs `spec-version: "1"`) are not relevant to this codebase.
🧬 Code Graph Analysis (20)
crates/cli/src/commands/order/listorderfrontmatterkeys.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/settings/src/scenario.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/cli/src/commands/order/calldata.rs (2)
crates/settings/src/spec_version.rs (1)
current(11-13)crates/subgraph/src/orderbook_client/mod.rs (1)
url(77-79)
crates/cli/src/commands/order/compose.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/cli/src/commands/chart/mod.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/common/src/replays.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/cli/src/commands/words/mod.rs (2)
crates/subgraph/src/orderbook_client/mod.rs (1)
url(77-79)crates/settings/src/spec_version.rs (1)
current(11-13)
crates/quote/src/order_quotes.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/common/src/add_order.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
tauri-app/src-tauri/src/commands/trade_debug.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
tauri-app/src-tauri/src/commands/dotrain_add_order_lsp.rs (2)
crates/settings/src/spec_version.rs (1)
current(11-13)crates/common/src/dotrain_add_order_lsp.rs (1)
get_text_document(215-222)
crates/settings/src/config_source.rs (2)
crates/settings/src/spec_version.rs (1)
current(11-13)crates/settings/src/config.rs (1)
try_from_string(268-271)
crates/common/src/unit_tests/mod.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/integration_tests/src/lib.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/cli/src/commands/order/orderbook_address.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
tauri-app/src-tauri/src/commands/charts.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
crates/quote/src/quote_debug.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
tauri-app/src-tauri/src/commands/config.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
tauri-app/src-tauri/src/commands/order_quote.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
tauri-app/src-tauri/src/commands/authoring_meta.rs (1)
crates/settings/src/spec_version.rs (1)
current(11-13)
⏰ Context from checks skipped due to timeout of 90000ms (15)
- GitHub Check: test
- GitHub Check: Deploy-Preview
- 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-wasm-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-sol-artifacts)
- GitHub Check: git-clean
- 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, ob-rs-test, true)
- GitHub Check: test
- GitHub Check: build-tauri (ubuntu-22.04, true)
🔇 Additional comments (114)
packages/ui-components/src/lib/__fixtures__/settings-12-11-24.json (1)
2-2: LGTM! Version field addition aligns with spec migration.The addition of the
versionfield with value"1"is consistent with the broader migration fromraindex-versionto the new spec versioning scheme.packages/orderbook/test/js_api/common.test.ts (1)
12-12: LGTM! Test data updated for new version schema.The addition of
version: 1to the test YAML configuration ensures compatibility with the new spec version validation logic.packages/orderbook/test/common/test.test.ts (1)
7-7: LGTM! Consistent version field addition in test data.The
version: 1addition maintains test compatibility with the new spec versioning requirements while preserving existing test logic.tauri-app/src/__tests__/pickConfig.test.ts (1)
185-185: LGTM! ConfigSource test data updated with version field.The addition of
version: '1'to theconfigSourceobject ensures test data matches the updatedConfigSourcetype definition with the new spec versioning.packages/ui-components/src/lib/__mocks__/settings.ts (1)
5-5: LGTM! Mock updated for spec version migration.The addition of the
versionfield with value'1'correctly aligns the mock configuration with the new spec version requirements.tauri-app/src/lib/mocks/mockConfigSource.ts (1)
4-4: LGTM! Tauri mock updated consistently.The version field addition maintains consistency across mock configurations and supports the spec version migration.
tauri-app/src/routes/orders/[network]-[orderHash]/page.test.ts (1)
59-59: LGTM! Test updated for version requirement.The addition of the version field ensures the test continues to pass with the new ConfigSource schema that requires spec version.
packages/ui-components/src/__tests__/ListViewOrderbookFilters.test.ts (3)
30-30: LGTM! Initial mock setup updated.The version field addition to the initial mockSettings ensures the component tests work with the new ConfigSource schema.
57-57: LGTM! beforeEach reset includes version.Consistent addition of the version field in the test reset ensures clean test state with the required schema.
73-73: LGTM! Edge case test updated.The version field addition to the empty networks/subgraphs test case ensures comprehensive test coverage with the new schema requirements.
packages/orderbook/test/js_api/gui.test.ts (5)
139-139: Verify spec-version addition in primary YAML fixtureThe top-level
version: 1field has been correctly added to thedotrainYAML fixture to align with the new spec version. Ensure that this matches the version constant in your parsing logic and other test modules.
216-216: Verify spec-version addition in vault-id YAML fixtureThe
version: 1field is now included at the top ofdotrainWithoutVaultIdsto maintain consistency with the spec versioning. Confirm that the parser handles this field uniformly across fixtures.
286-286: Verify spec-version addition in tokens YAML fixtureThe YAML fixture
dotrainWithoutTokenshas been updated to includeversion: 1. Ensure that no downstream logic is affected by this new top-level key.
341-341: Verify spec-version addition in remotes YAML fixtureA new
version: 1field is present indotrainForRemotes. Please check that the remote networks and tokens tests parse the version correctly before other fields.
955-961: Regenerate serializedState test fixtureThe serialized state string has been updated (line 956) to reflect the added
version: 1in the YAML. Please regenerate this base64 value using the updated serialization logic to ensure accuracy.🧰 Tools
🪛 Biome (1.9.4)
[error] 955-955: This let declares a variable that is only assigned once.
'serializedState' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
crates/settings/src/scenario.rs (1)
560-560: LGTM: Clean migration to spec versioningThe changes correctly update the test to use the new spec version system, replacing the deprecated
raindex_versionfield with the standardizedversionfield.Also applies to: 636-636
crates/cli/src/commands/order/orderbook_address.rs (1)
71-71: LGTM: Consistent spec version integration in testsThe test helper function is properly updated to include the dynamic spec version in generated YAML, ensuring test consistency with the new versioning scheme.
Also applies to: 120-120, 187-187
crates/cli/src/commands/order/listorderfrontmatterkeys.rs (1)
77-77: LGTM: Proper test YAML versioningThe changes correctly add the spec version field to the test YAML template, maintaining consistency with the migration from raindex-version to spec-version across the codebase.
Also applies to: 128-128, 203-203
crates/common/src/replays.rs (1)
56-56: LGTM: Consistent version handling in replay testsThe test correctly includes the current spec version in the generated YAML configuration, ensuring proper validation during trade replay testing.
Also applies to: 88-88, 144-144
crates/cli/src/commands/chart/mod.rs (1)
34-34: LGTM! Consistent implementation of spec version migration.The changes correctly implement the spec version migration by:
- Importing
SpecVersionfrom the appropriate module- Dynamically injecting the current spec version into test YAML configurations using
SpecVersion::current()- Following the same pattern used across other test modules in the codebase
This approach ensures tests remain synchronized with the current specification version without hardcoding version values.
Also applies to: 76-76, 96-96
crates/quote/src/order_quotes.rs (1)
163-163: LGTM! Consistent spec version implementation.The changes follow the established migration pattern by:
- Adding the
SpecVersionimport- Prepending the
versionfield to the YAML configuration string- Using
SpecVersion::current()to dynamically set the spec versionThis ensures the test configuration includes proper version validation as required by the new versioning scheme.
Also applies to: 215-215, 275-275
crates/common/src/unit_tests/mod.rs (1)
373-373: LGTM! Proper integration with spec version system.The changes correctly integrate with the new spec version system by:
- Adding the required import for
SpecVersion- Including the
versionfield at the top of the dotrain YAML configuration- Using
SpecVersion::current()to ensure the test uses the current specification versionThis maintains consistency with the broader migration and ensures proper version validation in unit tests.
Also applies to: 434-434, 465-466
tauri-app/src/lib/components/ModalExecute.test.ts (1)
34-34: LGTM! Appropriate implementation for TypeScript test context.The changes correctly add the
version: '1'field to the settings store configurations. The hardcoded approach is appropriate for this TypeScript test context, where the dynamicSpecVersion::current()function may not be directly accessible.The hardcoded value '1' aligns with the current specification version as indicated by the broader refactoring effort.
Also applies to: 65-65
tauri-app/src-tauri/src/commands/charts.rs (1)
36-36: LGTM! Proper spec version integration.The changes correctly implement the new spec version scheme:
- Appropriate import of
SpecVersion- Proper placement of version field at the top of YAML template
- Dynamic versioning using
SpecVersion::current()This aligns well with the PR objectives to replace raindex version with spec version.
Also applies to: 45-45, 74-74
tauri-app/src-tauri/src/commands/trade_debug.rs (1)
30-30: LGTM! Consistent spec version implementation.The changes follow the same correct pattern as other files:
- Proper
SpecVersionimport- Version field correctly positioned in YAML configuration
- Consistent use of dynamic versioning with
SpecVersion::current()This maintains consistency across the codebase for the spec version migration.
Also applies to: 63-63, 119-119
tauri-app/src-tauri/src/commands/order_quote.rs (1)
53-53: LGTM! Consistent implementation across all Rust test files.The changes maintain the same correct pattern established in the other Rust files:
- Appropriate
SpecVersionimport- Proper YAML formatting with version field placement
- Consistent dynamic versioning approach
All Rust test files now consistently implement the spec version migration, ensuring uniformity across the codebase.
Also applies to: 68-68, 124-124
packages/webapp/src/lib/constants.ts (1)
2-2:Details
✅ Verification successful
Verify the commit hash and URL accessibility.
Ensure that the new commit hash exists in the rain.strategies repository and that the URL is accessible with the expected registry content.
🏁 Script executed:
#!/bin/bash # Description: Verify the commit hash exists and check URL accessibility # Check if the commit exists in the rain.strategies repository gh api repos/rainlanguage/rain.strategies/commits/71098888cc53177f6803ede8361a4c8835dc01cd --jq '.sha' 2>/dev/null || echo "Commit not found" # Test URL accessibility curl -s -I "https://raw.githubusercontent.com/rainlanguage/rain.strategies/71098888cc53177f6803ede8361a4c8835dc01cd/registry" | head -n 1Length of output: 293
REGISTRY_URL update verified
The commit 71098888cc53177f6803ede8361a4c8835dc01cd exists in the rainlanguage/rain.strategies repo, and the registry URL returns HTTP 200. No further changes needed.
crates/integration_tests/src/lib.rs (3)
9-9: LGTM! Proper import for the new versioning scheme.The import of
SpecVersionfromrain_orderbook_app_settings::spec_versionis correctly added to support the migration from raindex-version to spec-version.
26-26: LGTM! Consistent version field implementation in test YAML.The addition of
version: {spec_version}and the corresponding interpolation usingSpecVersion::current()properly implements the new versioning scheme in test configurations.Also applies to: 84-84
141-141: LGTM! Consistent version field implementation in second test.The
test_post_task_revertfunction is correctly updated with the same versioning pattern as the first test, ensuring consistency across the test suite.Also applies to: 195-195
crates/settings/src/merge.rs (2)
297-298: LGTM! Proper import and spacing for the new versioning scheme.The import of
SpecVersionfromcrate::spec_versionis correctly added to support the migration from raindex-version to spec-version.
304-304: LGTM! Consistent version field implementation in all test cases.All
ConfigSourceinstances in the test module are consistently updated to useversion: SpecVersion::current().to_string(), properly implementing the new versioning scheme. The.to_string()conversion is correct since the version field expects aString.Also applies to: 322-322, 345-345, 363-363, 400-400, 418-418
crates/js_api/src/gui/state_management.rs (3)
289-289: LGTM! Proper import for dynamic YAML generation.The import of
get_yamlfunction supports the migration from static YAML to dynamic YAML generation that includes the current spec version.
295-295: LGTM! Updated serialized state constant.The updated
SERIALIZED_STATEconstant corresponds to the new YAML format with the spec version field, maintaining test compatibility with the versioning migration.
326-326: LGTM! Consistent usage of dynamic YAML generation.The test functions are correctly updated to use
get_yaml()instead of a static YAML string, ensuring that the current spec version is properly included in test configurations.Also applies to: 395-395
crates/cli/src/commands/order/compose.rs (2)
68-68: LGTM: Import addition aligns with versioning migration.The import of
SpecVersionsupports the consistent use of the new spec versioning system throughout the codebase.
115-167: LGTM: Test helper updated for consistent spec versioning.The modification from a static string to a formatted string that includes the current spec version ensures test data consistency across the migration from raindex-version to spec-version.
crates/settings/src/config.rs (3)
82-82: LGTM: Version field migration from optional to mandatory.The change from
raindex_version: Option<String>toversion: Stringsuccessfully implements the spec version standardization. Note that this is a breaking change for existing configurations without a version field.
247-247: LGTM: Assignment updated for new version field.The
TryFrom<ConfigSource>implementation correctly assigns the new mandatoryversionfield from the source.
363-363: LGTM: Test data updated consistently with version field changes.The test assertions have been properly updated to use the new
versionfield with the expected value "1".Also applies to: 435-435
crates/quote/src/quote_debug.rs (4)
83-83: LGTM: Import supports spec version integration.Adding the
SpecVersionimport enables consistent version handling in test fixtures.
101-101: LGTM: Test fixture updated with spec version.The YAML test data in
test_quote_debuggernow includes the required version field with the current spec version.Also applies to: 157-157
228-228: LGTM: Test fixture updated with spec version.The YAML test data in
test_quote_debugger_partialnow includes the required version field with the current spec version.Also applies to: 289-289
358-358: LGTM: Test fixture updated with spec version.The YAML test data in
test_quote_debugger_debug_errnow includes the required version field with the current spec version.Also applies to: 419-419
crates/cli/src/commands/words/mod.rs (7)
230-230: LGTM: Import enables spec version functionality.Adding the
SpecVersionimport allows consistent version handling across test fixtures.
253-253: LGTM: Test fixture updated with spec version.The test data in
test_execute_happy_with_dotraincorrectly includes the version field.Also applies to: 273-273
308-308: LGTM: Test fixture updated with spec version.The test data in
test_execute_happy_allcorrectly includes the version field.Also applies to: 314-314
367-367: LGTM: Test fixture updated with spec version.The test data in
test_execute_happy_scenario_all_wordscorrectly includes the version field.Also applies to: 394-394
429-429: LGTM: Test fixture updated with spec version.The test data in
test_execute_happy_scenario_deployer_wordscorrectly includes the version field.Also applies to: 435-435
506-506: LGTM: Test fixture updated with spec version.The test data in
test_execute_happy_deployment_wordscorrectly includes the version field.Also applies to: 572-572
616-637:Details
✅ Verification successful
Verify intentional omission of version field in test.
The
test_execute_unhappyfunction doesn't include the version field in its YAML test data. Please confirm this is intentional for testing error handling of missing version fields, or if it should be updated like the other tests.
🏁 Script executed:
#!/bin/bash # Description: Check if there are other test functions missing the version field # Expected: Find any YAML test data without version fields # Search for YAML test data that doesn't include version field rg -A 10 -B 2 'networks:' crates/cli/src/commands/words/mod.rs | grep -v 'version:'Length of output: 1485
I’d like to verify whether any of the “happy” path tests actually include a
version:field, and confirm iftest_execute_unhappyis the only one omitting it. Running these checks next:
🏁 Script executed:
#!/bin/bash # 1. Look for any 'version:' occurrences in this file echo ">> Checking for 'version:' in mod.rs" rg -n 'version:' crates/cli/src/commands/words/mod.rs || echo "No 'version:' found" # 2. Locate the happy-path test to inspect its YAML echo ">> Locating test_execute_happy" rg -n 'fn test_execute_happy' crates/cli/src/commands/words/mod.rs -A20 || echo "test_execute_happy not found"Length of output: 3267
Omission of
versionintest_execute_unhappyis intentional for error handlingAll other
test_execute_happy_*tests include aversion: {spec_version}field in their YAML payloads, whereastest_execute_unhappydeliberately omits it to validate the missing‐version error path. No change required.tauri-app/src-tauri/src/commands/dotrain_add_order_lsp.rs (4)
44-44: LGTM: Correct import added for version migration.The import of
SpecVersionis properly added to support the dynamic version injection.
86-88: LGTM: Proper migration from static to dynamic version.The conversion from a raw string literal to a formatted string with dynamic version injection is correctly implemented. The field name change from
raindex-versiontoversionaligns with the PR objectives.Also applies to: 165-167
126-126: LGTM: Correct brace escaping for format string.The double braces
${{order.outputs.0.token.address}}properly escape the inner braces for the format macro while preserving the intended YAML content.
170-170: LGTM: Correct reference usage.Properly passes a reference to the formatted string instead of moving it, which is the correct approach for the
get_text_documentfunction signature.crates/cli/src/commands/order/calldata.rs (5)
71-71: LGTM: Correct import added for version migration.The import of
SpecVersionsupports the dynamic version injection across multiple test functions.
183-185: LGTM: Consistent version migration in test_execute.The format string correctly replaces the hardcoded version with dynamic
SpecVersion::current()and updates the field name fromraindex-versiontoversion.Also applies to: 252-253
360-368: LGTM: Consistent version migration in test_execute_invalid_yaml_dotrain_file.The migration pattern is consistently applied with proper format string syntax.
397-399: LGTM: Consistent version migration in test_execute_invalid_rainlang_script.The format string correctly implements the version migration pattern.
Also applies to: 437-439
457-459: LGTM: Consistent version migration in test_execute_no_rpc_response.The final test function properly implements the version migration with correct format string syntax.
Also applies to: 524-526
tauri-app/src-tauri/src/commands/authoring_meta.rs (4)
26-26: LGTM: Correct import added for version migration.The import of
SpecVersionenables dynamic version injection in the test functions.
45-47: LGTM: Consistent version migration in test_get_authoring_meta_v2_for_scenarios_happy.The format string correctly implements the version migration with proper syntax and field name changes.
Also applies to: 73-75
119-121: LGTM: Consistent version migration in test_get_authoring_meta_v2_for_scenarios_error.The migration pattern is properly applied with correct format string syntax.
Also applies to: 147-149
242-244: LGTM: Consistent version migration in test_get_authoring_meta_v2_for_scenarios_pragma_error.The final test function correctly implements the version migration pattern.
Also applies to: 270-272
crates/js_api/src/yaml/mod.rs (3)
90-90: LGTM: Correct import added for version migration.The import of
SpecVersionsupports the dynamic version generation in the test helper function.
93-134: LGTM: Clean approach with reusable test data function.Converting the static YAML to a function that generates dynamic content is a cleaner approach for shared test data. The format string correctly implements the version migration with proper field name changes from
raindex-versiontoversion.
138-138: LGTM: Tests properly updated to use dynamic YAML function.The test functions are correctly updated to use the new
get_yaml()function instead of the static constant.Also applies to: 155-155
crates/settings/src/yaml/orderbook.rs (3)
3-4: ImportSpecVersioncorrectly and remove legacy version imports
The new import ofSpecVersionreplaces the deprecated raindex version import. Ensure there are no leftover references toRaindexVersionelsewhere in this module.
192-195: Addget_spec_versionmethod
Theget_spec_versionhelper neatly encapsulates fetching the spec version from YAML. To fully enforce version correctness as intended, consider invoking this method early inYamlParsable::newor during validation so invalid versions fail fast.
426-426: Update test to assert spec version
The new test assertion correctly checks for"1". This aligns with the introducedget_spec_versionbehavior.crates/common/src/dotrain_add_order_lsp.rs (4)
126-126: UseSpecVersion::current()for dynamic version injection
ImportingSpecVersionfromrain_orderbook_app_settingsenables dynamic versioning in tests. The path and usage look correct.
130-136: Generate test input with current spec version
Theget_textfunction properly formats the YAML withversion: {spec_version}, injecting the live spec version. The use offormat!and raw string literal is clear and concise.
171-171: Escape braces correctly in formatted YAML
Updating to${{order.outputs.0.token.address}}fixes brace escaping informat!strings. This ensures the test parser receives the intended literal.
246-246: Switch to usingget_text()intest_problems
Replacing the staticTEXTconstant withget_text()keeps the test in sync with the current spec version.crates/settings/src/config_source.rs (2)
462-463: Injectversioninto test YAML strings
Usingformat!(…, spec_version = SpecVersion::current())in tests ensures the dummy YAML has the correctversionfor both single and merged configs.Also applies to: 836-838
745-745: Assertversionin parsed configs
The assertionsassert_eq!(config.version, "1")and the equivalent fortop_configverify that deserialization captures the required spec version.Also applies to: 882-883, 903-903
crates/js_api/src/gui/mod.rs (4)
469-469: LGTM: Import addition for SpecVersion.The import is correctly added and necessary for the dynamic YAML generation functionality.
473-644: Excellent refactoring from static to dynamic YAML generation.This change improves maintainability by ensuring all tests automatically use the current spec version rather than hardcoded values. The dynamic approach prevents version-related test failures when the spec version changes.
649-649: LGTM: Consistent migration to dynamic YAML generation.All test function calls have been correctly updated to use the new
get_yaml()function, ensuring consistent spec version usage across tests.Also applies to: 660-660, 668-668, 685-685, 690-690
953-967: LGTM: Inline YAML strings properly updated with spec version.All inline YAML test strings have been correctly updated to include the
versionfield with the current spec version, maintaining consistency with the broader migration.Also applies to: 984-998, 1015-1030
crates/common/src/frontmatter.rs (2)
18-24: LGTM: Import reorganization and function rename align with migration.The addition of
SpecVersionimport and renaming of the test function properly reflect the migration from raindex-version to spec-version terminology.Also applies to: 347-347
349-349: LGTM: Assertions correctly updated for new version field.The test assertions have been properly updated to check the
versionfield against the current spec version, maintaining test correctness while adopting the new versioning scheme.Also applies to: 370-370
tauri-app/src-tauri/src/commands/config.rs (3)
42-42: LGTM: Import addition and dynamic YAML generation implemented correctly.The
SpecVersionimport is properly added and the YAML string correctly usesformat!to dynamically inject the current spec version.Also applies to: 48-75
137-137: LGTM: Assertion correctly updated for new version field.The assertion properly checks the new
versionfield against the expected value "1", which aligns with the current spec version.
295-312: LGTM: Comprehensive and consistent YAML updates throughout tests.All YAML test strings have been systematically updated to use the new version field with dynamic spec version injection. The comment update properly reflects the new terminology.
Also applies to: 321-338, 350-371, 415-415
crates/js_api/src/common/mod.rs (2)
191-191: LGTM: Import addition and get_dotrain function properly updated.The
SpecVersionimport is correctly added and theget_dotrainfunction now properly includes the version field with the current spec version, ensuring all generated test YAML is consistent with the new versioning scheme.Also applies to: 198-198, 262-262
379-386: Good improvement to test coverage and error reporting.The invalid dotrain test has been improved by using a minimal valid YAML structure rather than completely invalid input, which provides better test coverage. The enhanced assertion with debug output improves debugging capability when tests fail.
Also applies to: 390-390
crates/common/src/add_order.rs (2)
353-353: LGTM - Good addition of the SpecVersion import.The import of
SpecVersionis necessary for the dynamic version injection in the test cases.
508-520: Excellent migration from hardcoded to dynamic version management.The systematic replacement of hardcoded
raindex-versionwith dynamicversion: {spec_version}usingSpecVersion::current()is a clean approach that ensures version consistency across all tests.tauri-app/src-tauri/src/commands/order.rs (5)
152-156: Function rename and implementation updated correctly.The rename from
validate_raindex_versiontovalidate_spec_versionis consistent with the broader migration, and the internal method call is properly updated.
165-167: Appropriate imports added for the new functionality.The imports for
SpecVersionandFieldErrorKindare necessary for the updated validation logic and test error matching.
714-738: Test function updated correctly for spec version validation.The test properly uses dynamic version injection and validates the happy path scenario.
760-766: Error matching logic updated correctly.The test properly validates the missing version field error case with the new
FieldErrorKind::Missingpattern matching.
787-791: Version mismatch error validation looks correct.The test validates that version "2" is rejected when the current spec version is "1", which is the expected behavior.
crates/cli/src/commands/order/add.rs (2)
81-81: Good addition of SpecVersion import.The import is necessary for the dynamic version injection in the test helper function.
129-197: Excellent migration to dynamic version management in tests.The
get_dotrain()function now properly usesSpecVersion::current()for dynamic version injection, which ensures consistency across test runs and aligns with the broader migration from hardcoded version strings.crates/settings/src/spec_version.rs (5)
8-8: Good use of const for version string.The hardcoded version "1" as a constant provides a single source of truth for the current specification version.
10-18: Clean and simple public API.The
current()andis_current()methods provide a clean interface for version management. The implementation is straightforward and correct.
20-30: YamlParsableString implementation looks correct.The implementation properly:
- Extracts the "version" key from YAML root
- Handles read lock errors appropriately
- Returns InvalidTraitFunction for optional parsing (which makes sense since version should be mandatory)
32-72: Comprehensive test coverage.The tests cover all the key scenarios:
- Version comparison logic (
is_current)- Current version retrieval
- Missing version field error handling
- Invalid trait function error for optional parsing
The test implementations are correct and thorough.
5-6: 🧹 Nitpick (assertive)Consider making SpecVersion a unit struct or using an enum.
The current implementation uses an empty struct which works but could be more explicit about its purpose. Consider alternatives:
-#[derive(Clone, Debug)] -pub struct SpecVersion; +#[derive(Clone, Debug)] +pub struct SpecVersion;Alternatively, you could use a unit struct approach or an enum if you anticipate multiple spec versions in the future.
Likely an incorrect or invalid review comment.
crates/common/src/fuzz/impls.rs (6)
24-25: LGTM! Clean import additions for spec version support.The new imports properly support the spec version validation functionality being added to this module.
96-97: LGTM! Properly structured error variant for spec version mismatch.The error variant follows the established pattern and provides clear expected vs. actual version information for debugging.
124-131: LGTM! Robust spec version validation logic.The validation correctly:
- Parses the YAML to extract spec version first
- Validates against current spec version using
SpecVersion::is_current- Returns descriptive error with expected and actual versions
This ensures version compatibility before proceeding with fuzzing operations.
689-721: LGTM! Comprehensive test coverage for missing spec version.The test properly validates that:
- Missing
versionfield triggers appropriate error- Error type matches expected
YamlError::FieldwithFieldErrorKind::Missing- Error location is correctly identified as "root"
723-755: LGTM! Proper test coverage for invalid spec version.The test correctly validates that:
- Invalid version (2) triggers
SpecVersionMismatcherror- Expected version is "1" and actual is "2"
- Error handling is working as designed
757-793: LGTM! Proper migration to dynamic spec version in tests.The test correctly uses
SpecVersion::current()to dynamically inject the current spec version, ensuring tests remain valid as the spec version evolves.crates/common/src/dotrain_order/mod.rs (7)
13-13: LGTM! Necessary import for spec version functionality.The import enables the spec version validation logic implemented in this module.
68-72: LGTM! Consistent error variant migration from Raindex to Spec.The error variants are properly renamed:
RaindexVersionMismatch→SpecVersionMismatchMissingRaindexVersion→MissingSpecVersionError messages clearly indicate version mismatch scenarios.
134-141: LGTM! User-friendly error messages for version issues.The error messages properly reference:
- The 'version' field instead of 'raindex-version'
- Clear guidance to users on how to fix version mismatches
- Consistent terminology with the new spec versioning approach
245-252: LGTM! Consistent spec version validation logic.The validation logic matches the pattern established in the fuzz module:
- Extract spec version from OrderbookYaml
- Validate using
SpecVersion::is_current- Return appropriate error with version details
This ensures consistency across the codebase.
591-603: LGTM! Proper method rename and logic update.The method is correctly:
- Renamed from
validate_raindex_versiontovalidate_spec_version- Updated to use
SpecVersioninstead of Git commit SHA- Using the same validation pattern as the initialization logic
This maintains consistency in validation approach across the module.
1318-1374: LGTM! Comprehensive test coverage for spec version validation.The test properly validates:
- Happy path with correct spec version
- Missing version field scenario with appropriate error matching
- Clear test structure and expectations
1377-1407: LGTM! Thorough test coverage for version mismatch scenario.The test correctly validates:
- Invalid version (2) triggers
SpecVersionMismatcherror- Error contains expected vs. actual version information
- Proper error type matching with string comparisons
| const parsedConfig: ConfigSource = { | ||
| version: '1', | ||
| networks: { mainnet: { 'chain-id': 1, rpc: 'rpc' } }, | ||
| }; |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Consider consistency with dynamic versioning approach.
The hardcoded version: '1' in the mock aligns with the new spec version scheme. However, this creates potential inconsistency since the Rust test files use SpecVersion::current() for dynamic versioning.
Consider whether this should also use a dynamic approach or if the hardcoded value is intentional for this specific test scenario.
🤖 Prompt for AI Agents
In tauri-app/src/lib/services/applySettings.test.ts around lines 27 to 30, the
version field is hardcoded as '1' which may cause inconsistency with Rust tests
that use dynamic versioning via SpecVersion::current(). To fix this, replace the
hardcoded '1' with a dynamic value that matches the current spec version used in
Rust tests, ensuring consistency across test environments. This might involve
importing or mocking a function that returns the current spec version instead of
a fixed string.
| pub sentry: Option<bool>, | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub raindex_version: Option<String>, | ||
| pub version: String, |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Introduce mandatory version field
The new version: String makes spec version required in all configs. Consider overriding Default to initialize this field with SpecVersion::current() instead of an empty string to prevent defaults from having an empty version.
🤖 Prompt for AI Agents
In crates/settings/src/config_source.rs at line 97, the newly added mandatory
field `version: String` should not default to an empty string. Instead,
implement or override the Default trait for the struct containing this field to
initialize `version` with `SpecVersion::current()`. This ensures that any
default instance of the config has a valid spec version rather than an empty
string.
Caution
Do not merge before rainlanguage/rain.strategies#34 and rainlanguage/specs#35
Motivation
See issue: #1677
Solution
Checks
By submitting this for review, I'm confirming I've done the following:
fix #1677
Summary by CodeRabbit
Summary by CodeRabbit
New Features
versionfield in YAML configuration files for orders and settings, dynamically set to the current specification version.Bug Fixes
Refactor
Tests
versionfield and validation logic.Chores