Skip to content

fix(strategies): stop false Adjusted on pasted strategies - #730

Merged
kirillDevPro merged 1 commit into
mainfrom
fix/strategy-paste-adjusted
Sep 25, 2026
Merged

kirillDevPro merged 1 commit into
mainfrom
fix/strategy-paste-adjusted

Conversation

@kirillDevPro

Copy link
Copy Markdown
Collaborator

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 Active and FVersion, 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.

  • Create and restore now send only fields the schema shows for the strategy's kind, stored under the schema's spelling (BuyPrice -> buyPrice). Active/FVersion are dropped at debug level; any other dropped key is named once on an info line.
  • An Adjusted resolution now carries the differing fields (submitted snapshot vs echo, using the same missing-equals-default rule as moonproto). The log prints 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 no Active/FVersion field and uses schema names; the diff reports only the field that differs and ignores a default-valued absent field; the banner suffix is bounded).
  • Paste a MoonBot export into the Strategies window: no Adjusted banner.

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.
@kirillDevPro
kirillDevPro merged commit 3f32602 into main Sep 25, 2026
8 checks passed
@kirillDevPro
kirillDevPro deleted the fix/strategy-paste-adjusted branch September 25, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant