fix(strategies): stop false Adjusted on pasted strategies - #730
Merged
Merged
Conversation
Every strategy pasted from a MoonBot export shows "core saved different values" although the core stored every parameter as sent. The create path sends all export keys as fields, including the service keys Active and FVersion, and looks field names up case-sensitively. The core drops names it does not know, so the echo lacks them and the edit resolves as Adjusted. Create and restore now send only fields the schema shows for the strategy's kind, under the schema's own spelling (BuyPrice -> buyPrice). Other keys are dropped and named once in the log. An Adjusted resolution now carries the fields that differ between the submitted snapshot and the echo. The log lists them as "name: sent -> saved", and the Strategies banner and the toast show the first three.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Pasting strategies from a MoonBot text export marks every one of them with "core saved different values", even though the core stored every parameter exactly as sent.
The create path forwards every export key as a strategy field, including the export's service keys
ActiveandFVersion, and matches names against the schema case-sensitively. The core drops names it does not know, so the echo lacks them and moonproto resolves the edit as Adjusted.BuyPrice->buyPrice).Active/FVersionare dropped at debug level; any other dropped key is named once on an info line.name: sent -> saved, and the Strategies banner and the toast show the first three plus+N.Edits of existing strategies are unchanged.
How to verify
cargo test --workspace(new tests: a trimmed MoonBot export builds noActive/FVersionfield and uses schema names; the diff reports only the field that differs and ignores a default-valued absent field; the banner suffix is bounded).